X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms%2Fsrc%2Forg%2Fargeo%2Fcms%2Fsecurity%2FChecksumFactory.java;h=7344f01bc25ee6ebda7b7c6cd4f5dd6c16ce7844;hb=138e686fbf65683c3c94a52f1cfbaf8e02362e19;hp=69e8a08fda9b616885d4870e7c37a27530d3733d;hpb=810aecacb19916bade7e4bcfcbbb54c301f672df;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms/src/org/argeo/cms/security/ChecksumFactory.java b/org.argeo.cms/src/org/argeo/cms/security/ChecksumFactory.java index 69e8a08fd..7344f01bc 100644 --- a/org.argeo.cms/src/org/argeo/cms/security/ChecksumFactory.java +++ b/org.argeo.cms/src/org/argeo/cms/security/ChecksumFactory.java @@ -11,11 +11,10 @@ import java.nio.file.Paths; import java.nio.file.SimpleFileVisitor; import java.nio.file.attribute.BasicFileAttributes; import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; import java.util.Base64; import java.util.zip.Checksum; -import org.argeo.cms.CmsException; - /** Allows to fine tune how files are read. */ public class ChecksumFactory { private int regionSize = 10 * 1024 * 1024; @@ -81,8 +80,8 @@ public class ChecksumFactory { return digest; } } - } catch (Exception e) { - throw new CmsException("Cannot digest " + path, e); + } catch (NoSuchAlgorithmException | IOException e) { + throw new IllegalStateException("Cannot digest " + path, e); } } @@ -113,8 +112,8 @@ public class ChecksumFactory { cursor = cursor + regionSize; } return crc.getValue(); - } catch (Exception e) { - throw new CmsException("Cannot checksum " + path, e); + } catch (IOException e) { + throw new IllegalStateException("Cannot checksum " + path, e); } finally { long duration = System.currentTimeMillis() - begin; System.out.println(duration / 1000 + "s");