commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roy...@Toyota.com
Subject Question about ToStringStyle.appendInternal() method
Date Thu, 25 Mar 2004 00:25:21 GMT
Hi,

I was trying to figure out an infinate loop problem when I am printing out 
an object. I have an object 'a' of class 'A' which has a collection of 
object 'b' of class 'B', and 'B' has a reference back to 'A'. The 
toString() method of both 'A' and 'B' contains each other. When I tried to 
print 'a' out, I got into an infinate loop.

>From looking at the source code of ToStringStyle.java, it appears to me 
that its appendInternal() method never registers the object to be printed 
to the registry. Therefore, the if check on the first line of this method 
"if (ReflectionToStringBuilder.isRegistered(value)" always returns false, 
and thus result in an infinate loop.

Please let me know if this is the case. Thanks.

Roy

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message