From 72a716bafdb43da904ecb06c81c05c5746602d22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Richard=20K=C3=B6rber?= Date: Sun, 7 Apr 2019 10:46:17 +0200 Subject: [PATCH] Use consistent exceptions, remove unneccessary throws clause --- .../main/java/org/shredzone/acme4j/toolbox/JoseUtils.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/acme4j-client/src/main/java/org/shredzone/acme4j/toolbox/JoseUtils.java b/acme4j-client/src/main/java/org/shredzone/acme4j/toolbox/JoseUtils.java index 49737675..aeeaef23 100644 --- a/acme4j-client/src/main/java/org/shredzone/acme4j/toolbox/JoseUtils.java +++ b/acme4j-client/src/main/java/org/shredzone/acme4j/toolbox/JoseUtils.java @@ -29,8 +29,6 @@ import org.jose4j.jwk.RsaJsonWebKey; import org.jose4j.jws.AlgorithmIdentifiers; import org.jose4j.jws.JsonWebSignature; import org.jose4j.lang.JoseException; -import org.shredzone.acme4j.exception.AcmeException; -import org.shredzone.acme4j.exception.AcmeProtocolException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -103,7 +101,7 @@ public final class JoseUtils { jb.put("signature", jws.getEncodedSignature()); return jb; } catch (JoseException ex) { - throw new AcmeProtocolException("Failed to sign a JSON request", ex); + throw new IllegalArgumentException("Could not create a JOSE request", ex); } } @@ -121,7 +119,7 @@ public final class JoseUtils { * @return Created JSON structure */ public static Map createExternalAccountBinding(String kid, - PublicKey accountKey, SecretKey macKey, URL resource) throws AcmeException { + PublicKey accountKey, SecretKey macKey, URL resource) { try { PublicJsonWebKey keyJwk = PublicJsonWebKey.Factory.newPublicJwk(accountKey); @@ -140,7 +138,7 @@ public final class JoseUtils { outerClaim.put("payload", innerJws.getEncodedPayload()); return outerClaim.toMap(); } catch (JoseException ex) { - throw new AcmeException("Could not create external account binding", ex); + throw new IllegalArgumentException("Could not create external account binding", ex); } }