| 以下内容需要积分高于 5000 才可浏览 
 复制代码   private boolean verifyFile(String expectedSha1, File file) {
      try {
         FileInputStream fileInputStream = new FileInputStream(file);
         Throwable var5 = null;
         String string2;
         try {
            string2 = DigestUtils.sha1Hex(fileInputStream);
         } catch (Throwable var15) {
            var5 = var15;
            throw var15;
         } finally {
            if (fileInputStream != null) {
               if (var5 != null) {
                  try {
                     fileInputStream.close();
                  } catch (Throwable var14) {
                     var5.addSuppressed(var14);
                  }
               } else {
                  fileInputStream.close();
               }
            }
         }
         if (expectedSha1.isEmpty()) {
            LOGGER.info("Found file {} without verification hash", file);
            return true;
         }
         if (string2.toLowerCase(Locale.ROOT).equals(expectedSha1.toLowerCase(Locale.ROOT))) {
            LOGGER.info("Found file {} matching requested hash {}", file, expectedSha1);
            return true;
         }
         LOGGER.warn("File {} had wrong hash (expected {}, found {}).", file, expectedSha1, string2);
      } catch (IOException var17) {
         LOGGER.warn("File {} couldn't be hashed.", file, var17);
      }
      return false;
   }
 
 
 |