Return-Path: Delivered-To: apmail-commons-issues-archive@locus.apache.org Received: (qmail 11121 invoked from network); 6 Nov 2008 20:29:11 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Nov 2008 20:29:11 -0000 Received: (qmail 17181 invoked by uid 500); 6 Nov 2008 20:29:17 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 17107 invoked by uid 500); 6 Nov 2008 20:29:17 -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 17096 invoked by uid 99); 6 Nov 2008 20:29:17 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Nov 2008 12:29:17 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Nov 2008 20:28:07 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id A921E234C280 for ; Thu, 6 Nov 2008 12:28:49 -0800 (PST) Message-ID: <1503265252.1226003329691.JavaMail.jira@brutus> Date: Thu, 6 Nov 2008 12:28:49 -0800 (PST) From: "Henri Yandell (JIRA)" To: issues@commons.apache.org Subject: [jira] Updated: (LANG-456) HashCodeBuilder throws StackOverflowError in bidirectional navigable association In-Reply-To: <926828740.1219846904284.JavaMail.jira@brutus> 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-456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Henri Yandell updated LANG-456: ------------------------------- Fix Version/s: 3.0 > HashCodeBuilder throws StackOverflowError in bidirectional navigable association > -------------------------------------------------------------------------------- > > Key: LANG-456 > URL: https://issues.apache.org/jira/browse/LANG-456 > Project: Commons Lang > Issue Type: Bug > Affects Versions: 2.4 > Environment: Widows XP. Sun JDK 1.5 or 1.6. > Reporter: Bob Fields > Fix For: 3.0 > > Attachments: HashCodeBuilderStackOverflow.zip, StackOverflowError.zip > > > This is not the reflection methods, it is the regular HashCodeBuilder append methods. It causes EqualsBuilder, ToStringBuilder, CompareToBuilder to also throw the StackOverflowException, but those methods work when one of the HashCodeBuilder bidirectional association attributes .hashCode() is commented out. The problem is that all of the builders call registerObject() which creates a hashCode, but only the reflectionAppend method checks if an object is registered. > Bi-directional associations are a very common pattern in Jaxb and Hibernate. In this case, I generate code from a model in order to avoid the reflection penalty - I already know what the attributes are at compile time, so I use .append instead of .reflectionAppend. > See attached example + unit test. One side of the bidirectional association must be commented out in the hashCode method. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.