From 045fda850a92afb51ab48db9d242aa45676b2d25 Mon Sep 17 00:00:00 2001 From: Thomas Neidhart Date: Thu, 7 Feb 2013 17:15:24 +0000 Subject: [PATCH] [COLLECTIONS-441] throw an internal error when clone failed instead of returning null, which is against the contract of clone, also fixes a findbug error. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1443606 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/commons/collections/map/AbstractHashedMap.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java b/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java index 0dbad8105..4a29f239b 100644 --- a/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java +++ b/src/main/java/org/apache/commons/collections/map/AbstractHashedMap.java @@ -1278,6 +1278,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab * Cloneable interface and make this method public. * * @return a shallow clone + * @throws java.lang.InternalError if {@link super#clone()} failed */ @Override @SuppressWarnings("unchecked") @@ -1294,7 +1295,7 @@ public class AbstractHashedMap extends AbstractMap implements Iterab cloned.putAll(this); return cloned; } catch (final CloneNotSupportedException ex) { - return null; // should never happen + throw new InternalError(); } }