You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2015/12/11 14:48:11 UTC

[jira] [Resolved] (LANG-1193) ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1 (correct answer should be 0)

     [ https://issues.apache.org/jira/browse/LANG-1193?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved LANG-1193.
------------------------
       Resolution: Fixed
    Fix Version/s:     (was: 2.6)
                   3.5

LANG-1193 ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1
(correct answer should be 0)
Revert LANG-1077

Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/d75fe46b
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/d75fe46b
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/d75fe46b

Branch: refs/heads/master
Commit: d75fe46b8f1b0d5c27887052ee4714d6a9c7ea4b
Parents: 15e1ea2
Author: Sebb <se...@apache.org>
Authored: Fri Dec 11 13:41:22 2015 +0000
Committer: Sebb <se...@apache.org>
Committed: Fri Dec 11 13:41:22 2015 +0000

----------------------------------------------------------------------
 src/changes/changes.xml                            |  2 +-
 .../java/org/apache/commons/lang3/StringUtils.java | 15 ++++++++++++---
 .../lang3/StringUtilsEqualsIndexOfTest.java        | 17 +++++++++++++++--
 3 files changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------

> ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1 (correct answer should be 0)
> ----------------------------------------------------------------------------------------
>
>                 Key: LANG-1193
>                 URL: https://issues.apache.org/jira/browse/LANG-1193
>             Project: Commons Lang
>          Issue Type: Bug
>    Affects Versions: 3.4
>         Environment: OS X Yosemite 10.10.5. Maven project.
>            Reporter: Qin Li
>             Fix For: 3.5
>
>
> In Apache Commons Lang 3.4, StringUtils.ordinalIndexOf("abc", "ab", 1) gives incorrect answer of -1 (correct answer should be 0)。but StringUtils.ordinalIndexOf("abc", "a", 1) gives correct answer of 0.
> Based on the above mentioned observation, the bug occurrs if the searchStr is of length > 1, and locates at the index 0 of the str.
> In Apache Commons Lang 2.6, this bug is not observed.



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