You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "David T. Adcox (JIRA)" <tu...@ws.apache.org> on 2008/01/21 23:00:50 UTC

[jira] Created: (TUSCANY-2009) Java SDO's EqualityHelper doesn't compare Bytes values correctly

Java SDO's EqualityHelper doesn't compare Bytes values correctly
----------------------------------------------------------------

                 Key: TUSCANY-2009
                 URL: https://issues.apache.org/jira/browse/TUSCANY-2009
             Project: Tuscany
          Issue Type: Bug
          Components: Java SDO Implementation
    Affects Versions: Java-SDO-1.0
         Environment: n/a
            Reporter: David T. Adcox
             Fix For: Java-SDO-Next


Comparison of two Bytes values fails when it should succeed.  The test for equality passes through the EqualityHelperImpl.equal method.  In that method, the test is passed to EcoreUtil.haveEqualAttribute(EObject, EObject, EAttribute).  For a simple type, it defers to java's '==' operator.  So, two different object arrays are being compared, not for their contents, but rather if they are the same object.  Attached is a test case which demonstrates this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-2009) Java SDO's EqualityHelper doesn't compare Bytes values correctly

Posted by "David T. Adcox (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David T. Adcox updated TUSCANY-2009:
------------------------------------

    Attachment: 2009.patch

This patch validates byte[] types in the EqualityHelperImpl class.  I've augmented the SimpleEqualityTestCase to test for this condition, as well.

> Java SDO's EqualityHelper doesn't compare Bytes values correctly
> ----------------------------------------------------------------
>
>                 Key: TUSCANY-2009
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2009
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>         Environment: n/a
>            Reporter: David T. Adcox
>             Fix For: Java-SDO-Next
>
>         Attachments: 2009.patch, Test2009.java
>
>
> Comparison of two Bytes values fails when it should succeed.  The test for equality passes through the EqualityHelperImpl.equal method.  In that method, the test is passed to EcoreUtil.haveEqualAttribute(EObject, EObject, EAttribute).  For a simple type, it defers to java's '==' operator.  So, two different object arrays are being compared, not for their contents, but rather if they are the same object.  Attached is a test case which demonstrates this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-2009) Java SDO's EqualityHelper doesn't compare Bytes values correctly

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561598#action_12561598 ] 

Amita Vadhavkar commented on TUSCANY-2009:
------------------------------------------

The patch looks fine to me.

There is another pre-existing issue in the current SDO code base. Please see - http://www.mail-archive.com/tuscany-user@ws.apache.org/msg02434.html, is this a known issue and is there a solution to it?  



> Java SDO's EqualityHelper doesn't compare Bytes values correctly
> ----------------------------------------------------------------
>
>                 Key: TUSCANY-2009
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2009
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>         Environment: n/a
>            Reporter: David T. Adcox
>             Fix For: Java-SDO-Next
>
>         Attachments: 2009.patch, Test2009.java
>
>
> Comparison of two Bytes values fails when it should succeed.  The test for equality passes through the EqualityHelperImpl.equal method.  In that method, the test is passed to EcoreUtil.haveEqualAttribute(EObject, EObject, EAttribute).  For a simple type, it defers to java's '==' operator.  So, two different object arrays are being compared, not for their contents, but rather if they are the same object.  Attached is a test case which demonstrates this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Resolved: (TUSCANY-2009) Java SDO's EqualityHelper doesn't compare Bytes values correctly

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amita Vadhavkar resolved TUSCANY-2009.
--------------------------------------

    Resolution: Fixed

Applied patch at revision 614489

> Java SDO's EqualityHelper doesn't compare Bytes values correctly
> ----------------------------------------------------------------
>
>                 Key: TUSCANY-2009
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2009
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>         Environment: n/a
>            Reporter: David T. Adcox
>             Fix For: Java-SDO-Next
>
>         Attachments: 2009.patch, Test2009.java
>
>
> Comparison of two Bytes values fails when it should succeed.  The test for equality passes through the EqualityHelperImpl.equal method.  In that method, the test is passed to EcoreUtil.haveEqualAttribute(EObject, EObject, EAttribute).  For a simple type, it defers to java's '==' operator.  So, two different object arrays are being compared, not for their contents, but rather if they are the same object.  Attached is a test case which demonstrates this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-2009) Java SDO's EqualityHelper doesn't compare Bytes values correctly

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amita Vadhavkar updated TUSCANY-2009:
-------------------------------------

    Fix Version/s:     (was: Java-SDO-Next)
                   Java-SDO-1.1

> Java SDO's EqualityHelper doesn't compare Bytes values correctly
> ----------------------------------------------------------------
>
>                 Key: TUSCANY-2009
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2009
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>         Environment: n/a
>            Reporter: David T. Adcox
>             Fix For: Java-SDO-1.1
>
>         Attachments: 2009.patch, Test2009.java
>
>
> Comparison of two Bytes values fails when it should succeed.  The test for equality passes through the EqualityHelperImpl.equal method.  In that method, the test is passed to EcoreUtil.haveEqualAttribute(EObject, EObject, EAttribute).  For a simple type, it defers to java's '==' operator.  So, two different object arrays are being compared, not for their contents, but rather if they are the same object.  Attached is a test case which demonstrates this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-2009) Java SDO's EqualityHelper doesn't compare Bytes values correctly

Posted by "Kelvin Goodson (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561304#action_12561304 ] 

Kelvin Goodson commented on TUSCANY-2009:
-----------------------------------------

I'm surprised that the Ecore equality helper doesn't handle this.  If my understanding is correct then Ecore could check the eAttribute.getEAttributeType().getInstanceClass().isArray() and then use Arrays.equals() for all arrays.  Maybe there's a fix in a later version of EMF?

This is our only array of primitives type, so we can special case it. We should check for type Bytes and use java.util.Arrays.equals(arg1,arg2) in our impl of haveEqualAttribute

> Java SDO's EqualityHelper doesn't compare Bytes values correctly
> ----------------------------------------------------------------
>
>                 Key: TUSCANY-2009
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2009
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>         Environment: n/a
>            Reporter: David T. Adcox
>             Fix For: Java-SDO-Next
>
>         Attachments: Test2009.java
>
>
> Comparison of two Bytes values fails when it should succeed.  The test for equality passes through the EqualityHelperImpl.equal method.  In that method, the test is passed to EcoreUtil.haveEqualAttribute(EObject, EObject, EAttribute).  For a simple type, it defers to java's '==' operator.  So, two different object arrays are being compared, not for their contents, but rather if they are the same object.  Attached is a test case which demonstrates this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Commented: (TUSCANY-2009) Java SDO's EqualityHelper doesn't compare Bytes values correctly

Posted by "Amita Vadhavkar (JIRA)" <tu...@ws.apache.org>.
    [ https://issues.apache.org/jira/browse/TUSCANY-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12561294#action_12561294 ] 

Amita Vadhavkar commented on TUSCANY-2009:
------------------------------------------

http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.emf.doc/references/javadoc/org/eclipse/emf/ecore/util/EcoreUtil.EqualityHelper.html
specifies that Java equality is followed and in Java below bt1 is not equal to bt2.
	byte[] bt1 = new byte[]{120, 80, -40};
        byte[] bt2 = new byte[]{120, 80, -40};
        if(bt1.equals(bt2)) {
           //false
        }

In SDO Impl, super.haveEqualAttribute(eObject1, eObject2, attribute);  is called. So to make meaningful comparisons, instead of calling super viz. EMF 
EcoreUtil.EqualityHelper(), will meaningful equality check be needed inside SDO Impl itself?

Regards,
Amita

> Java SDO's EqualityHelper doesn't compare Bytes values correctly
> ----------------------------------------------------------------
>
>                 Key: TUSCANY-2009
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2009
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>         Environment: n/a
>            Reporter: David T. Adcox
>             Fix For: Java-SDO-Next
>
>         Attachments: Test2009.java
>
>
> Comparison of two Bytes values fails when it should succeed.  The test for equality passes through the EqualityHelperImpl.equal method.  In that method, the test is passed to EcoreUtil.haveEqualAttribute(EObject, EObject, EAttribute).  For a simple type, it defers to java's '==' operator.  So, two different object arrays are being compared, not for their contents, but rather if they are the same object.  Attached is a test case which demonstrates this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org


[jira] Updated: (TUSCANY-2009) Java SDO's EqualityHelper doesn't compare Bytes values correctly

Posted by "David T. Adcox (JIRA)" <tu...@ws.apache.org>.
     [ https://issues.apache.org/jira/browse/TUSCANY-2009?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David T. Adcox updated TUSCANY-2009:
------------------------------------

    Attachment: Test2009.java

This test demonstrates the problem described in T-2009.

> Java SDO's EqualityHelper doesn't compare Bytes values correctly
> ----------------------------------------------------------------
>
>                 Key: TUSCANY-2009
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-2009
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SDO Implementation
>    Affects Versions: Java-SDO-1.0
>         Environment: n/a
>            Reporter: David T. Adcox
>             Fix For: Java-SDO-Next
>
>         Attachments: Test2009.java
>
>
> Comparison of two Bytes values fails when it should succeed.  The test for equality passes through the EqualityHelperImpl.equal method.  In that method, the test is passed to EcoreUtil.haveEqualAttribute(EObject, EObject, EAttribute).  For a simple type, it defers to java's '==' operator.  So, two different object arrays are being compared, not for their contents, but rather if they are the same object.  Attached is a test case which demonstrates this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org