You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2021/01/08 14:23:21 UTC
[commons-codec] branch master updated: Collapse multiple identical
catch clauses into one.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
The following commit(s) were added to refs/heads/master by this push:
new 05a0b1f Collapse multiple identical catch clauses into one.
05a0b1f is described below
commit 05a0b1f55efc69a1a249b87163ca19d47fca9f57
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Jan 8 09:23:16 2021 -0500
Collapse multiple identical catch clauses into one.
---
src/main/java/org/apache/commons/codec/digest/HmacUtils.java | 4 +---
src/test/java/org/apache/commons/codec/binary/HexTest.java | 9 +--------
2 files changed, 2 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/apache/commons/codec/digest/HmacUtils.java b/src/main/java/org/apache/commons/codec/digest/HmacUtils.java
index 81dcf5f..00700dd 100644
--- a/src/main/java/org/apache/commons/codec/digest/HmacUtils.java
+++ b/src/main/java/org/apache/commons/codec/digest/HmacUtils.java
@@ -236,9 +236,7 @@ public final class HmacUtils {
final Mac mac = Mac.getInstance(algorithm);
mac.init(keySpec);
return mac;
- } catch (final NoSuchAlgorithmException e) {
- throw new IllegalArgumentException(e);
- } catch (final InvalidKeyException e) {
+ } catch (final NoSuchAlgorithmException | InvalidKeyException e) {
throw new IllegalArgumentException(e);
}
}
diff --git a/src/test/java/org/apache/commons/codec/binary/HexTest.java b/src/test/java/org/apache/commons/codec/binary/HexTest.java
index bab8754..4bfcd67 100644
--- a/src/test/java/org/apache/commons/codec/binary/HexTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/HexTest.java
@@ -105,14 +105,7 @@ public class HexTest {
log("FAILED charsetSanityCheck=Interesting Java charset oddity: Roundtrip failed for " + name);
}
return equals;
- } catch (final UnsupportedEncodingException e) {
- // Should NEVER happen since we are getting the name from the Charset class.
- if (LOG) {
- log("FAILED charsetSanityCheck=" + name + ", e=" + e);
- log(e);
- }
- return false;
- } catch (final UnsupportedOperationException e) {
+ } catch (final UnsupportedEncodingException | UnsupportedOperationException e) {
// Caught here with:
// x-JISAutoDetect on Windows XP and Java Sun 1.4.2_19 x86 32-bits
// x-JISAutoDetect on Windows XP and Java Sun 1.5.0_17 x86 32-bits