Oops - the Lists can also contain non-Strings. May have to revert a few other casts.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@1024488 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-10-20 01:52:22 +00:00
parent c81f67f5a8
commit 7a36e60c96
1 changed files with 5 additions and 5 deletions

View File

@ -713,9 +713,9 @@ public class ExtendedProperties extends Hashtable<String, Object> {
} else if (current instanceof List) {
// already a list - just add the new token
@SuppressWarnings("unchecked") // We only add Strings to the Lists
List<String> list = (List<String>) current;
list.add((String) value);
@SuppressWarnings("unchecked") // OK to cast to Object
List<Object> list = (List<Object>) current;
list.add(value);
} else {
// brand new key - store in keysAsListed to retain order
@ -950,9 +950,9 @@ public class ExtendedProperties extends Hashtable<String, Object> {
return interpolate(defaultValue);
}
} else if (value instanceof List) {
@SuppressWarnings("unchecked") // Must be OK as we only add Strings to Lists
@SuppressWarnings("unchecked") // Only expecting Strings here
List<String> entry = (List<String>) value;
return interpolate(entry.get(0));
return interpolate(entry.get(0)); // requires a String
} else {
throw new ClassCastException('\'' + key + "' doesn't map to a String object");
}