Skip to content

Commit

Permalink
close file after checksum calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
chakrabandla committed Aug 27, 2020
1 parent 0cb1ed3 commit c5dd705
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/uk/ac/ebi/pride/gui/util/Hash.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ public class Hash {
private final static Logger LOGGER = LoggerFactory.getLogger(Hash.class);

public static String getSha1Checksum(File file) throws IOException {
return DigestUtils.sha1Hex(new FileInputStream(file));

FileInputStream fileInputStream = new FileInputStream(file);
String checksum = DigestUtils.sha1Hex(fileInputStream);
fileInputStream.close();

return checksum;
}

public static String getSha256Checksum(String str) {
Expand Down

0 comments on commit c5dd705

Please sign in to comment.