LinkedCaseInsensitiveMap properly overrides HashMap.clone()
Issue: SPR-14509
This commit is contained in:
@@ -36,7 +36,7 @@ import java.util.Map;
|
||||
@SuppressWarnings("serial")
|
||||
public class LinkedCaseInsensitiveMap<V> extends LinkedHashMap<String, V> {
|
||||
|
||||
private final Map<String, String> caseInsensitiveKeys;
|
||||
private Map<String, String> caseInsensitiveKeys;
|
||||
|
||||
private final Locale locale;
|
||||
|
||||
@@ -151,6 +151,14 @@ public class LinkedCaseInsensitiveMap<V> extends LinkedHashMap<String, V> {
|
||||
super.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object clone() {
|
||||
LinkedCaseInsensitiveMap<V> copy = (LinkedCaseInsensitiveMap<V>) super.clone();
|
||||
copy.caseInsensitiveKeys = new HashMap<>(this.caseInsensitiveKeys);
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert the given key to a case-insensitive key.
|
||||
|
||||
Reference in New Issue
Block a user