Skip to content

Commit

Permalink
Refactor Some Code. (#4887). (Ayush Saxena, reviewed by Denys Kuzmenko)
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushtkn authored Nov 23, 2023
1 parent ae89034 commit 7638cb1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions service/src/java/org/apache/hive/service/CookieSigner.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,8 @@ public String verifyAndExtract(String signedStr) {
String rawValue = signedStr.substring(0, index);
String currentSignature = getSignature(rawValue);

LOG.debug("Signature generated for {} inside verify is {}", rawValue, currentSignature);
if (!MessageDigest.isEqual(originalSignature.getBytes(), currentSignature.getBytes())) {
throw new IllegalArgumentException("Invalid sign, original = " + originalSignature +
" current = " + currentSignature);
throw new IllegalArgumentException("Invalid sign= " + originalSignature);
}
return rawValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void testVerifyAndExtractInvalidSignature() {
try {
cs.verifyAndExtract(modifedSignedStr);
} catch (IllegalArgumentException e) {
assertTrue(e.getMessage().startsWith("Invalid sign, original = "));
assertTrue(e.getMessage().startsWith("Invalid sign= "));
return;
}
fail("Expected IllegalArgumentException checking signature");
Expand Down

0 comments on commit 7638cb1

Please sign in to comment.