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 2005/04/29 23:33:54 UTC

DO NOT REPLY [Bug 34686] New: - TransformedMap putAll(empty map) causes IllegalArgumentException

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=34686>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=34686

           Summary: TransformedMap putAll(empty map) causes
                    IllegalArgumentException
           Product: Commons
           Version: 3.1
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Collections
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: mlottman@carefx.com


If you create a TransformedMap, and then call map.putAll with an empty map as 
an argument, an IllegalArgumentException is thrown.  putAll should be able to 
handle empty maps without erroring.  The error occurs regardless of whether 
the decorated map has any contents.  The implementation of the Transformers 
attached does not matter.  I am using Java 1.4.2_07.

Example code:
Map map = TransformedMap.decorate(
        new HashMap(),
        TransformerUtils.nopTransformer(),
        TransformerUtils.nopTransformer());

map.putAll(new HashMap()); // This causes IllegalArgumentException!

Fails with the following error:

java.lang.IllegalArgumentException: Initial capacity must be greater than 0
	at org.apache.commons.collections.map.AbstractHashedMap.<init>
(AbstractHashedMap.java:142)
	at org.apache.commons.collections.map.AbstractHashedMap.<init>
(AbstractHashedMap.java:127)
	at org.apache.commons.collections.map.AbstractLinkedMap.<init>
(AbstractLinkedMap.java:95)
	at org.apache.commons.collections.map.LinkedMap.<init>
(LinkedMap.java:78)
	at org.apache.commons.collections.map.TransformedMap.transformMap
(TransformedMap.java:153)
	at org.apache.commons.collections.map.TransformedMap.putAll
(TransformedMap.java:190)
	at net.carefx.contextagent.plugin.ldapuser.PluginTest.main
(PluginTest.java:71)

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org