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/08/06 22:14:31 UTC
DO NOT REPLY [Bug 36061] New: -
ToStringBuilder throws StackOverflowError when an Object cycle exists
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=36061>.
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=36061
Summary: ToStringBuilder throws StackOverflowError when an Object
cycle exists
Product: Commons
Version: 2.1 Final
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: Lang
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: maarten.coene@hotpop.com
Hi,
The ToStringBuilder throws a StackOverflowError if you have a cycle in the
object graph. For instance, the following toString() method will cause a
StackOverflowError:
public class ObjectCycle {
Object obj;
public String toString() {
return new ToStringBuilder(this).append(obj).toString();
}
}
public void testObjectCycle() {
ObjectCycle a = new ObjectCycle();
ObjectCycle b = new ObjectCycle();
a.obj = b;
b.obj = a;
a.toString(); // ouch: StackOverflowError
}
I'll submit some patches that fixes this problem...
regards,
Maarten
--
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