Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 78693175C3 for ; Thu, 9 Apr 2015 12:12:16 +0000 (UTC) Received: (qmail 45718 invoked by uid 500); 9 Apr 2015 12:12:12 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 45602 invoked by uid 500); 9 Apr 2015 12:12:12 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 45420 invoked by uid 99); 9 Apr 2015 12:12:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Apr 2015 12:12:12 +0000 Date: Thu, 9 Apr 2015 12:12:12 +0000 (UTC) From: "Narendhiran K (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Issue Comment Deleted] (LANG-1106) StringUtils equals() method produces wrong result for the below scenario MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LANG-1106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Narendhiran K updated LANG-1106: -------------------------------- Comment: was deleted (was: I have checked with "org.apache.commons.lang3.StringUtils" class for the equals method. It produces wrong results. please find the logic which is present in the "org.apache.commons.lang3.StringUtils" class and try it. package org.apache.commons.lang3; public static boolean equals(CharSequence cs1, CharSequence cs2) { return cs1 == null ? false : cs2 == null ? true : cs1.equals(cs2); } If cs2 is null, the above logic returns "true", that means it doesn't produce correct result.) > 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: 2.6, 3.3.2 > Environment: java version "1.7.0_02" > Java(TM) SE Runtime Environment (build 1.7.0_02-b13) > windows 7 > Reporter: Narendhiran K > Labels: bug > > 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)