You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Paul Nepywoda (JIRA)" <ji...@apache.org> on 2012/07/14 02:16:33 UTC

[jira] [Created] (LANG-813) StringUtils.equalsIgnoreCase doesn't check string reference equality

Paul Nepywoda created LANG-813:
----------------------------------

             Summary: StringUtils.equalsIgnoreCase doesn't check string reference equality
                 Key: LANG-813
                 URL: https://issues.apache.org/jira/browse/LANG-813
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.*
    Affects Versions: 3.1
            Reporter: Paul Nepywoda


This looks like a regression from .lang versions prior to 3. If the 2 given CharSequences are strings (and both not null) you should check reference equality before delegating to regionMatches()

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (LANG-813) StringUtils.equalsIgnoreCase doesn't check string reference equality

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-813?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13414223#comment-13414223 ] 

Sebb commented on LANG-813:
---------------------------

Another optimisation would be to check that the lengths are the same.
The code already calculates both lengths, so this would not add any overhead and would be more efficient for sequences that differ only in length.
                
> StringUtils.equalsIgnoreCase doesn't check string reference equality
> --------------------------------------------------------------------
>
>                 Key: LANG-813
>                 URL: https://issues.apache.org/jira/browse/LANG-813
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Paul Nepywoda
>
> This looks like a regression from .lang versions prior to 3. If the 2 given CharSequences are strings (and both not null) you should check reference equality before delegating to regionMatches()

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (LANG-813) StringUtils.equalsIgnoreCase doesn't check string reference equality

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

Sebb resolved LANG-813.
-----------------------

       Resolution: Fixed
    Fix Version/s: 3.2

URL: http://svn.apache.org/viewvc?rev=1361462&view=rev
Log:
LANG-813 StringUtils.equalsIgnoreCase doesn't check string reference equality
Also check lengths.

Modified:
    commons/proper/lang/trunk/src/changes/changes.xml
    commons/proper/lang/trunk/src/main/java/org/apache/commons/lang3/StringUtils.java
    commons/proper/lang/trunk/src/test/java/org/apache/commons/lang3/StringUtilsEqualsIndexOfTest.java

                
> StringUtils.equalsIgnoreCase doesn't check string reference equality
> --------------------------------------------------------------------
>
>                 Key: LANG-813
>                 URL: https://issues.apache.org/jira/browse/LANG-813
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.1
>            Reporter: Paul Nepywoda
>             Fix For: 3.2
>
>
> This looks like a regression from .lang versions prior to 3. If the 2 given CharSequences are strings (and both not null) you should check reference equality before delegating to regionMatches()

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira