Skip to content

Commit 18f8c45

Browse files
committed
Improving how the signature exception is thrown in the signature calculation code.
1 parent 35671b4 commit 18f8c45

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ds3-sdk/src/main/java/com/spectralogic/ds3client/utils/Signature.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public final class Signature {
4747
* java.security.SignatureException when signature generation fails
4848
*/
4949
public static String calculateRFC2104HMAC(final String data, final String key)
50-
throws java.security.SignatureException
50+
throws SignatureException
5151
{
5252
LOG.debug("String to sign: {}", data.replace("\n", "\\n"));
5353
final String result;
@@ -63,7 +63,7 @@ public static String calculateRFC2104HMAC(final String data, final String key)
6363
final byte[] rawHmac = mac.doFinal(data.getBytes(Charset.forName("UTF-8")));
6464
result = Base64.encodeBase64String(rawHmac);
6565
} catch (final Exception e) {
66-
throw new SignatureException("Failed to generate HMAC : " + e.getMessage());
66+
throw new SignatureException("Failed to generate HMAC: " + e.getMessage(), e);
6767
}
6868
return result.trim();
6969
}

0 commit comments

Comments
 (0)