[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
This commit is contained in:
parent
add3a934ce
commit
045fda850a
|
@ -1278,6 +1278,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
|
||||||
* <code>Cloneable</code> interface and make this method public.
|
* <code>Cloneable</code> interface and make this method public.
|
||||||
*
|
*
|
||||||
* @return a shallow clone
|
* @return a shallow clone
|
||||||
|
* @throws java.lang.InternalError if {@link super#clone()} failed
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@ -1294,7 +1295,7 @@ public class AbstractHashedMap<K, V> extends AbstractMap<K, V> implements Iterab
|
||||||
cloned.putAll(this);
|
cloned.putAll(this);
|
||||||
return cloned;
|
return cloned;
|
||||||
} catch (final CloneNotSupportedException ex) {
|
} catch (final CloneNotSupportedException ex) {
|
||||||
return null; // should never happen
|
throw new InternalError();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue