Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1193

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.5
    • Component/s: None
    • Labels:
      None
    • Environment:

      OS X Yosemite 10.10.5. Maven project.

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                qin.li@everydayratings.com Qin Li
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: