From 32d8bdfdbbe9cdfa6d0a969208b25f4ca08058e7 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 6 Jul 2023 15:36:46 -0400 Subject: [PATCH] Throw a RuntimeException subclass instead of an Error --- .../org/apache/commons/collections4/map/AbstractHashedMap.java | 2 +- src/main/java/org/apache/commons/collections4/map/Flat3Map.java | 2 +- .../java/org/apache/commons/collections4/map/MultiKeyMap.java | 2 +- .../java/org/apache/commons/collections4/map/SingletonMap.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java index 8508180e28..a7a54081a2 100644 --- a/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java +++ b/src/main/java/org/apache/commons/collections4/map/AbstractHashedMap.java @@ -1306,7 +1306,7 @@ protected AbstractHashedMap clone() { cloned.putAll(this); return cloned; } catch (final CloneNotSupportedException ex) { - throw new InternalError(); + throw new UnsupportedOperationException(ex); } } diff --git a/src/main/java/org/apache/commons/collections4/map/Flat3Map.java b/src/main/java/org/apache/commons/collections4/map/Flat3Map.java index 4ac53fcaa8..4666a79392 100644 --- a/src/main/java/org/apache/commons/collections4/map/Flat3Map.java +++ b/src/main/java/org/apache/commons/collections4/map/Flat3Map.java @@ -1155,7 +1155,7 @@ public Flat3Map clone() { } return cloned; } catch (final CloneNotSupportedException ex) { - throw new InternalError(); + throw new UnsupportedOperationException(ex); } } diff --git a/src/main/java/org/apache/commons/collections4/map/MultiKeyMap.java b/src/main/java/org/apache/commons/collections4/map/MultiKeyMap.java index 0250f3f368..64b38a50a3 100644 --- a/src/main/java/org/apache/commons/collections4/map/MultiKeyMap.java +++ b/src/main/java/org/apache/commons/collections4/map/MultiKeyMap.java @@ -828,7 +828,7 @@ public MultiKeyMap clone() { try { return (MultiKeyMap) super.clone(); } catch (final CloneNotSupportedException e) { - throw new InternalError(); + throw new UnsupportedOperationException(e); } } diff --git a/src/main/java/org/apache/commons/collections4/map/SingletonMap.java b/src/main/java/org/apache/commons/collections4/map/SingletonMap.java index d952f1d090..c76917c857 100644 --- a/src/main/java/org/apache/commons/collections4/map/SingletonMap.java +++ b/src/main/java/org/apache/commons/collections4/map/SingletonMap.java @@ -538,7 +538,7 @@ public SingletonMap clone() { try { return (SingletonMap) super.clone(); } catch (final CloneNotSupportedException ex) { - throw new InternalError(); + throw new UnsupportedOperationException(ex); } }