Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 40263 invoked from network); 5 Jan 2008 06:22:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jan 2008 06:22:56 -0000 Received: (qmail 90941 invoked by uid 500); 5 Jan 2008 06:22:44 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 90862 invoked by uid 500); 5 Jan 2008 06:22:44 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 90853 invoked by uid 99); 5 Jan 2008 06:22:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Jan 2008 22:22:44 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Jan 2008 06:22:29 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 49906714204 for ; Fri, 4 Jan 2008 22:22:34 -0800 (PST) Message-ID: <27500524.1199514154298.JavaMail.jira@brutus> Date: Fri, 4 Jan 2008 22:22:34 -0800 (PST) From: "Henri Yandell (JIRA)" To: issues@commons.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-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LANG-69?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12556181#action_12556181 ] Henri Yandell commented on LANG-69: ----------------------------------- Hi Krishna, I doubt you'll see much on a closed ticket - I'd suggest either mailing the user@ list to see if anyone else has had the problem; or if at all possible it would be great if you could chop away at your business objects a bit and create a reusable test case. In either case - please feel free to open a new issue up rather than using the old one. > [lang] ToStringBuilder throws StackOverflowError when an Object cycle exists > ---------------------------------------------------------------------------- > > Key: LANG-69 > URL: https://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 > Assignee: Gary Gregory > Fix For: 2.3 > > Attachments: 15938.patch, 36061.patch, LANG-69-refactor.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. - You can reply to this email to add a comment to the issue online.