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 19096] - BeanMap.toString() causes infinite loop on circular object graph
Date Fri, 18 Apr 2003 23:15:38 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=19096>.
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=19096

BeanMap.toString() causes infinite loop on circular object graph





------- Additional Comments From mohankishore@yahoo.com  2003-04-18 23:15 -------
BeanMap< bean.toString() > sounds good to me.

JDK collection classes dont check for cyclic references either...
Ran a test program:
        Map m = new HashMap();
        m.put("1", "One");
        m.put("2", m);
        m.put("3", "Three");
        System.out.println(m);

Output:
Exception in thread "main" java.lang.StackOverflowError
        at java.util.AbstractMap.toString(AbstractMap.java:559)
        at java.lang.String.valueOf(String.java:2013)
        at java.lang.StringBuffer.append(StringBuffer.java:365)
        at java.util.AbstractMap.toString(AbstractMap.java:562)
        at java.lang.String.valueOf(String.java:2013)
        at java.lang.StringBuffer.append(StringBuffer.java:365)
        at java.util.AbstractMap.toString(AbstractMap.java:562)
        ...

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


Mime
View raw message