commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23041] - [collections][PATCH] OutOfMemoryError test case for MapUtils.verbosePrint.
Date Wed, 10 Sep 2003 04:47:28 GMT
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=23041>.
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=23041

[collections][PATCH] OutOfMemoryError test case for MapUtils.verbosePrint.





------- Additional Comments From phil@steitz.com  2003-09-10 04:47 -------
Is this really a bug??

As a user, I would personally not complain about a documented limitation/warning
that this method should not be used for maps that may contain cyclic object
graphs.  I agree that infinite recursions are evil, but if you want to ask for
recursive traversals... As the javadoc states, "When the value is a Map,
recursive behaviour occurs."

Otherwise what are the choices?

1. limit the depth of the recursion

2. hold an array of visited nodes and check each new node against the visited
list to prevent cycles

3. put some other absolute limit on the number of nodes visited

Options 1 and 3 are ugly.  I suppose that I could live with 2., but do we really
need to do this?

I suppose we could also consider dumping the recursive contract -- i.e., just
iterate and print the map entries, eliminating the quoted line above from the
javadoc.

Mime
View raw message