commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Narendhiran K (JIRA)" <j...@apache.org>
Subject [jira] [Created] (LANG-1106) StringUtils equals() method produces wrong result for the below scenario
Date Fri, 03 Apr 2015 09:43:52 GMT
Narendhiran K created LANG-1106:
-----------------------------------

             Summary: StringUtils equals() method produces wrong result for the below scenario
                 Key: LANG-1106
                 URL: https://issues.apache.org/jira/browse/LANG-1106
             Project: Commons Lang
          Issue Type: Bug
          Components: lang.*
    Affects Versions: 3.3.2, 2.6
         Environment: java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
windows 7
            Reporter: Narendhiran K


When we use StringUtils equals() method with below scenario, it returns wrong results.
Scenario : StringUtils.equals("someStr", null);
Result : true
Expected result : false
Explanation:
Some logical / typo mistake on the below line.

return ((str1 == null) ? false : (str2 == null) ? true : str1.equals(str2));

Instead of "true" it should be "false", when str2 is checked.




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message