Skip to content

Commit 05a0b1f

Browse files
committed
Collapse multiple identical catch clauses into one.
1 parent 2a1fc6b commit 05a0b1f

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

src/main/java/org/apache/commons/codec/digest/HmacUtils.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@ public static Mac getInitializedMac(final String algorithm, final byte[] key) {
236236
final Mac mac = Mac.getInstance(algorithm);
237237
mac.init(keySpec);
238238
return mac;
239-
} catch (final NoSuchAlgorithmException e) {
240-
throw new IllegalArgumentException(e);
241-
} catch (final InvalidKeyException e) {
239+
} catch (final NoSuchAlgorithmException | InvalidKeyException e) {
242240
throw new IllegalArgumentException(e);
243241
}
244242
}

src/test/java/org/apache/commons/codec/binary/HexTest.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,7 @@ private boolean charsetSanityCheck(final String name) {
105105
log("FAILED charsetSanityCheck=Interesting Java charset oddity: Roundtrip failed for " + name);
106106
}
107107
return equals;
108-
} catch (final UnsupportedEncodingException e) {
109-
// Should NEVER happen since we are getting the name from the Charset class.
110-
if (LOG) {
111-
log("FAILED charsetSanityCheck=" + name + ", e=" + e);
112-
log(e);
113-
}
114-
return false;
115-
} catch (final UnsupportedOperationException e) {
108+
} catch (final UnsupportedEncodingException | UnsupportedOperationException e) {
116109
// Caught here with:
117110
// x-JISAutoDetect on Windows XP and Java Sun 1.4.2_19 x86 32-bits
118111
// x-JISAutoDetect on Windows XP and Java Sun 1.5.0_17 x86 32-bits

0 commit comments

Comments
 (0)