You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Oliver Sauder (JIRA)" <ji...@apache.org> on 2010/03/13 21:10:27 UTC
[jira] Created: (LANG-606) EqualsBuilder causes
StackOverflowException
EqualsBuilder causes StackOverflowException
-------------------------------------------
Key: LANG-606
URL: https://issues.apache.org/jira/browse/LANG-606
Project: Commons Lang
Issue Type: Bug
Components: lang.builder.*
Affects Versions: 2.5
Reporter: Oliver Sauder
Priority: Minor
EqualsBuilder causes StackOverflowException when comparing objects with cyclical object references.
e,g.
static class TestObjectReference {
@SuppressWarnings("unused")
private TestObjectReference reference;
@SuppressWarnings("unused")
private TestObject one;
public TestObjectReference(int one) {
this.one = new TestObject(one);
}
public void setObjectReference(
TestObjectReference reference) {
this.reference = reference;
}
@Override
public boolean equals(Object obj) {
return EqualsBuilder.reflectionEquals(this, obj);
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-606) EqualsBuilder causes
StackOverflowException
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell updated LANG-606:
-------------------------------
Fix Version/s: 3.0
> EqualsBuilder causes StackOverflowException
> -------------------------------------------
>
> Key: LANG-606
> URL: https://issues.apache.org/jira/browse/LANG-606
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.builder.*
> Affects Versions: 2.5
> Reporter: Oliver Sauder
> Priority: Minor
> Fix For: 3.0
>
> Attachments: EqualsBuilderCyclicalObjectReferences.patch
>
>
> EqualsBuilder causes StackOverflowException when comparing objects with cyclical object references.
> e,g.
> static class TestObjectReference {
> @SuppressWarnings("unused")
> private TestObjectReference reference;
> @SuppressWarnings("unused")
> private TestObject one;
>
> public TestObjectReference(int one) {
> this.one = new TestObject(one);
> }
>
> public void setObjectReference(
> TestObjectReference reference) {
> this.reference = reference;
> }
> @Override
> public boolean equals(Object obj) {
> return EqualsBuilder.reflectionEquals(this, obj);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Commented: (LANG-606) EqualsBuilder causes
StackOverflowException
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-606?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12846514#action_12846514 ]
Henri Yandell commented on LANG-606:
------------------------------------
Can you check the patch? It doesn't apply cleanly, but neither file in question has changed since you posted the patch.
> EqualsBuilder causes StackOverflowException
> -------------------------------------------
>
> Key: LANG-606
> URL: https://issues.apache.org/jira/browse/LANG-606
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.builder.*
> Affects Versions: 2.5
> Reporter: Oliver Sauder
> Priority: Minor
> Fix For: 3.0
>
> Attachments: EqualsBuilderCyclicalObjectReferences.patch
>
>
> EqualsBuilder causes StackOverflowException when comparing objects with cyclical object references.
> e,g.
> static class TestObjectReference {
> @SuppressWarnings("unused")
> private TestObjectReference reference;
> @SuppressWarnings("unused")
> private TestObject one;
>
> public TestObjectReference(int one) {
> this.one = new TestObject(one);
> }
>
> public void setObjectReference(
> TestObjectReference reference) {
> this.reference = reference;
> }
> @Override
> public boolean equals(Object obj) {
> return EqualsBuilder.reflectionEquals(this, obj);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-606) EqualsBuilder causes
StackOverflowException
Posted by "Oliver Sauder (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Sauder updated LANG-606:
-------------------------------
Attachment: EqualsBuilderCyclicalObjectReferences.patch
Attached patch should solve the issue.
I've used the same attempt used in HashCodeBuilder solving the cyclical reference issue.
Only difference is that a registry with objects pairs is used. When checking if two objects have already be compared resp. registered those two objects need to be swapped as the cyclical reference takes place when "the other object" is the "this object".
> EqualsBuilder causes StackOverflowException
> -------------------------------------------
>
> Key: LANG-606
> URL: https://issues.apache.org/jira/browse/LANG-606
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.builder.*
> Affects Versions: 2.5
> Reporter: Oliver Sauder
> Priority: Minor
> Attachments: EqualsBuilderCyclicalObjectReferences.patch
>
>
> EqualsBuilder causes StackOverflowException when comparing objects with cyclical object references.
> e,g.
> static class TestObjectReference {
> @SuppressWarnings("unused")
> private TestObjectReference reference;
> @SuppressWarnings("unused")
> private TestObject one;
>
> public TestObjectReference(int one) {
> this.one = new TestObject(one);
> }
>
> public void setObjectReference(
> TestObjectReference reference) {
> this.reference = reference;
> }
> @Override
> public boolean equals(Object obj) {
> return EqualsBuilder.reflectionEquals(this, obj);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Closed: (LANG-606) EqualsBuilder causes
StackOverflowException
Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Henri Yandell closed LANG-606.
------------------------------
Resolution: Fixed
Thanks Oliver.
I modified the @since tags, but otherwise committed as is.
svn ci -m "Applying the copy of the HashCodeBuilder code to stop cyclic references over to EqualsBuilder per LANG-606 and Oliver Sauder's patch" src/
Sending src/main/java/org/apache/commons/lang3/builder/EqualsBuilder.java
Sending src/test/java/org/apache/commons/lang3/builder/EqualsBuilderTest.java
Transmitting file data ..
Committed revision 925671.
> EqualsBuilder causes StackOverflowException
> -------------------------------------------
>
> Key: LANG-606
> URL: https://issues.apache.org/jira/browse/LANG-606
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.builder.*
> Affects Versions: 2.5
> Reporter: Oliver Sauder
> Priority: Minor
> Fix For: 3.0
>
> Attachments: EqualsBuilderCyclicalObjectReferences-v01.patch, EqualsBuilderCyclicalObjectReferences.patch
>
>
> EqualsBuilder causes StackOverflowException when comparing objects with cyclical object references.
> e,g.
> static class TestObjectReference {
> @SuppressWarnings("unused")
> private TestObjectReference reference;
> @SuppressWarnings("unused")
> private TestObject one;
>
> public TestObjectReference(int one) {
> this.one = new TestObject(one);
> }
>
> public void setObjectReference(
> TestObjectReference reference) {
> this.reference = reference;
> }
> @Override
> public boolean equals(Object obj) {
> return EqualsBuilder.reflectionEquals(this, obj);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
[jira] Updated: (LANG-606) EqualsBuilder causes
StackOverflowException
Posted by "Oliver Sauder (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/LANG-606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Oliver Sauder updated LANG-606:
-------------------------------
Attachment: EqualsBuilderCyclicalObjectReferences-v01.patch
Strange. I created the patch with svn diff > EqualsBuilderCyclicalObjectReferences.patch. When I then reverted all files (svn revert -R .) and tried to apply the patch it did not apply cleanly on my system either.
After some research I found out that I probably hit a subversion bug (http://subversion.tigris.org/issues/show_bug.cgi?id=2164).
Well to workaround this problem instead of using svn diff I used the old fashion but working diff utility.
This patch now applies cleanly with the command patch -p1 -i EqualsBuilderCyclicalObjectReferences-v01.patch.
> EqualsBuilder causes StackOverflowException
> -------------------------------------------
>
> Key: LANG-606
> URL: https://issues.apache.org/jira/browse/LANG-606
> Project: Commons Lang
> Issue Type: Bug
> Components: lang.builder.*
> Affects Versions: 2.5
> Reporter: Oliver Sauder
> Priority: Minor
> Fix For: 3.0
>
> Attachments: EqualsBuilderCyclicalObjectReferences-v01.patch, EqualsBuilderCyclicalObjectReferences.patch
>
>
> EqualsBuilder causes StackOverflowException when comparing objects with cyclical object references.
> e,g.
> static class TestObjectReference {
> @SuppressWarnings("unused")
> private TestObjectReference reference;
> @SuppressWarnings("unused")
> private TestObject one;
>
> public TestObjectReference(int one) {
> this.one = new TestObject(one);
> }
>
> public void setObjectReference(
> TestObjectReference reference) {
> this.reference = reference;
> }
> @Override
> public boolean equals(Object obj) {
> return EqualsBuilder.reflectionEquals(this, obj);
> }
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.