You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2010/10/20 03:52:22 UTC
svn commit: r1024488 -
/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
Author: sebb
Date: Wed Oct 20 01:52:22 2010
New Revision: 1024488
URL: http://svn.apache.org/viewvc?rev=1024488&view=rev
Log:
Oops - the Lists can also contain non-Strings. May have to revert a few other casts.
Modified:
commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java?rev=1024488&r1=1024487&r2=1024488&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/ExtendedProperties.java Wed Oct 20 01:52:22 2010
@@ -713,9 +713,9 @@ public class ExtendedProperties extends
} 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
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");
}