Multiple user referentials working with IPA.
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / security / ChecksumFactory.java
index 69e8a08fda9b616885d4870e7c37a27530d3733d..7344f01bc25ee6ebda7b7c6cd4f5dd6c16ce7844 100644 (file)
@@ -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");