You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/01/14 03:22:42 UTC
DO NOT REPLY [Bug 26115] New: -
debug and verbose print in MapUtils only handles String keys
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26115>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26115
debug and verbose print in MapUtils only handles String keys
Summary: debug and verbose print in MapUtils only handles String
keys
Product: Commons
Version: 2.1 Final
Platform: All
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Collections
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: mpg@mpgsoftware.com
In MapUtils, if the key is e.g., Integer, fails with a ClassCastException:
for ( Iterator iter = map.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry) iter.next();
==> String childKey = (String) entry.getKey();
Object childValue = entry.getValue();
if ( childValue instanceof Map ) {
verbosePrint( out, childKey, (Map) childValue );
}
Should not be cast to a String, just use Object, and it works.
Same thing goes for the less verbose sister method, debugPrint
Thanks,
Matt
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org