Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 42296 invoked from network); 29 Sep 2006 20:03:00 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 29 Sep 2006 20:03:00 -0000 Received: (qmail 35175 invoked by uid 500); 29 Sep 2006 20:02:57 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 35064 invoked by uid 500); 29 Sep 2006 20:02:57 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 35050 invoked by uid 99); 29 Sep 2006 20:02:57 -0000 Received: from idunn.apache.osuosl.org (HELO idunn.apache.osuosl.org) (140.211.166.84) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Sep 2006 13:02:57 -0700 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests= Received: from [209.237.227.198] ([209.237.227.198:33750] helo=brutus.apache.org) by idunn.apache.osuosl.org (ecelerity 2.1.1.8 r(12930)) with ESMTP id 66/9C-13110-4AB7D154 for ; Fri, 29 Sep 2006 13:01:50 -0700 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 48D627142DA for ; Fri, 29 Sep 2006 12:57:21 -0700 (PDT) Message-ID: <19117413.1159559841295.JavaMail.root@brutus> Date: Fri, 29 Sep 2006 12:57:21 -0700 (PDT) From: "Gary Gregory (JIRA)" To: commons-dev@jakarta.apache.org Subject: [jira] Commented: (LANG-69) [lang] ToStringBuilder throws StackOverflowError when an Object cycle exists MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N [ http://issues.apache.org/jira/browse/LANG-69?page=comments#action_12438787 ] Gary Gregory commented on LANG-69: ---------------------------------- Fix already in CVS. Please see HashCodeBuilderTest#testReflectionObjectCycle(). > [lang] ToStringBuilder throws StackOverflowError when an Object cycle exists > ---------------------------------------------------------------------------- > > Key: LANG-69 > URL: http://issues.apache.org/jira/browse/LANG-69 > Project: Commons Lang > Issue Type: Bug > Affects Versions: 2.1 > Environment: Operating System: other > Platform: Other > Reporter: Maarten Coene > Assigned To: Gary Gregory > Fix For: 2.3 > > Attachments: 15938.patch, 36061.patch, ReflectionToStringBuilder.java.patch, ToStringBuilderTest.java.patch, ToStringStyle.java.patch > > > 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 -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org