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 16676] - StackOverflow due to ToStringBuilder
Date Fri, 14 Mar 2003 03:57:26 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=16676>.
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=16676

StackOverflow due to ToStringBuilder





------- Additional Comments From ggregory@seagullsw.com  2003-03-14 03:57 -------
Thank you for your comments.

>It might be better to use a ThreadLocal rather than a static to hold the 
registry... 

Sure, we could do that. This was just a quick experiment, I did not give much 
thought as to where the registry should live.

>In fact, it wouldn't need to be a Map, but a Set (maybe a HashSet) containing 
all objects currently being toStringed on this thread.

Absolutely, a Set makes sense.

>Also, why bother saying "cycle detected" -- why not just return the 
identitycode?  

It is indeed to verbose, the point of toString is not to detect cycles anyway.

I just updated the experiment with your sugestions. Since I have patched the 
reflection code in the past, I'll take a stab at integrating this idea in 
ToStringBuilder.

Since the ThreadLocal will only be used by the reflection methods, it is a bit 
wasteful to have it in ToStringBuilder instead of a subclass but creating a 
ReflectionToStringBuilder subclass might be over the top. I would like to 
avoid further bloating the static side of ToStringBuilder...

---------------------------------------------------------------------
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