Skip to content

Commit 111a275

Browse files
committed
Make hasher throw Runtime Exception instead of silently catching the NoSuchAlgorithmException
1 parent 8052c60 commit 111a275

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/main/java/httpserver/Hasher.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ public String getHash(byte[] input) {
1414
byte[] hash = messageDigest.digest(input);
1515
return bytesToHex(hash);
1616
} catch (NoSuchAlgorithmException e) {
17-
System.out.println("Unable to get hash.");
18-
return "";
17+
throw new RuntimeException(e);
1918
}
2019
}
2120

0 commit comments

Comments
 (0)