You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by "Ben Hale (JIRA)" <ji...@apache.org> on 2008/04/19 18:58:25 UTC

[jira] Created: (IVY-805) onMissingDescriptor doesn't work due to == comparison

onMissingDescriptor doesn't work due to == comparison
-----------------------------------------------------

                 Key: IVY-805
                 URL: https://issues.apache.org/jira/browse/IVY-805
             Project: Ivy
          Issue Type: Bug
          Components: Ant
    Affects Versions: 2.0-RC1
            Reporter: Ben Hale


In the IvyBuildList file, you compare the value passed for onMissingDescriptor to a set of constants using the '==' operator.  In Java, this will always return false unless you have the exact same instance (which is unlikely in this case :))  The code should use the .equals() method which will return true when strings are identical, even when they are not the same instance.

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


[jira] Updated: (IVY-805) onMissingDescriptor doesn't work due to == comparison

Posted by "Ben Hale (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ben Hale updated IVY-805:
-------------------------

    Attachment: onMissingDescriptor.patch

A patch for the fix.  It's pretty straight forward.  You'll noticed I switched the order of comparison.  By putting the constant first, you can prevent an NPE when the value set is 'null'.

> onMissingDescriptor doesn't work due to == comparison
> -----------------------------------------------------
>
>                 Key: IVY-805
>                 URL: https://issues.apache.org/jira/browse/IVY-805
>             Project: Ivy
>          Issue Type: Bug
>          Components: Ant
>    Affects Versions: 2.0-RC1
>            Reporter: Ben Hale
>         Attachments: onMissingDescriptor.patch
>
>
> In the IvyBuildList file, you compare the value passed for onMissingDescriptor to a set of constants using the '==' operator.  In Java, this will always return false unless you have the exact same instance (which is unlikely in this case :))  The code should use the .equals() method which will return true when strings are identical, even when they are not the same instance.

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


[jira] Commented: (IVY-805) onMissingDescriptor doesn't work due to == comparison

Posted by "Xavier Hanin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/IVY-805?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12590756#action_12590756 ] 

Xavier Hanin commented on IVY-805:
----------------------------------

Damned, I'm surprised I'm still able to do such an obvious mistake :-( Thanks for reporting

> onMissingDescriptor doesn't work due to == comparison
> -----------------------------------------------------
>
>                 Key: IVY-805
>                 URL: https://issues.apache.org/jira/browse/IVY-805
>             Project: Ivy
>          Issue Type: Bug
>          Components: Ant
>    Affects Versions: 2.0-RC1
>            Reporter: Ben Hale
>         Attachments: onMissingDescriptor.patch
>
>
> In the IvyBuildList file, you compare the value passed for onMissingDescriptor to a set of constants using the '==' operator.  In Java, this will always return false unless you have the exact same instance (which is unlikely in this case :))  The code should use the .equals() method which will return true when strings are identical, even when they are not the same instance.

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


[jira] Resolved: (IVY-805) onMissingDescriptor doesn't work due to == comparison

Posted by "Maarten Coene (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maarten Coene resolved IVY-805.
-------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0-RC1

Applied your patch (and added an extra equals... you've forgot to remove one "==") and added a junit test.
Thanks a lot for your contribution!

> onMissingDescriptor doesn't work due to == comparison
> -----------------------------------------------------
>
>                 Key: IVY-805
>                 URL: https://issues.apache.org/jira/browse/IVY-805
>             Project: Ivy
>          Issue Type: Bug
>          Components: Ant
>    Affects Versions: 2.0-RC1
>            Reporter: Ben Hale
>            Assignee: Maarten Coene
>             Fix For: 2.0-RC1
>
>         Attachments: onMissingDescriptor.patch
>
>
> In the IvyBuildList file, you compare the value passed for onMissingDescriptor to a set of constants using the '==' operator.  In Java, this will always return false unless you have the exact same instance (which is unlikely in this case :))  The code should use the .equals() method which will return true when strings are identical, even when they are not the same instance.

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


[jira] Assigned: (IVY-805) onMissingDescriptor doesn't work due to == comparison

Posted by "Maarten Coene (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IVY-805?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Maarten Coene reassigned IVY-805:
---------------------------------

    Assignee: Maarten Coene

> onMissingDescriptor doesn't work due to == comparison
> -----------------------------------------------------
>
>                 Key: IVY-805
>                 URL: https://issues.apache.org/jira/browse/IVY-805
>             Project: Ivy
>          Issue Type: Bug
>          Components: Ant
>    Affects Versions: 2.0-RC1
>            Reporter: Ben Hale
>            Assignee: Maarten Coene
>         Attachments: onMissingDescriptor.patch
>
>
> In the IvyBuildList file, you compare the value passed for onMissingDescriptor to a set of constants using the '==' operator.  In Java, this will always return false unless you have the exact same instance (which is unlikely in this case :))  The code should use the .equals() method which will return true when strings are identical, even when they are not the same instance.

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