[jira] Created: (LANG-600) Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[jira] Created: (LANG-600) Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)

Gary D. Gregory (Jira)
Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)
------------------------------------------------------------------------------------

                 Key: LANG-600
                 URL: https://issues.apache.org/jira/browse/LANG-600
             Project: Commons Lang
          Issue Type: Task
          Components: lang.*
    Affects Versions: 2.4
            Reporter: Sean Montgomery
            Priority: Trivial


The javadoc's examples show how indexOf should work not lastIndexOf.
 StringUtils.lastIndexOf(null, *)          = -1
 StringUtils.lastIndexOf(*, null)          = -1
 StringUtils.lastIndexOf("", "")           = 0
 StringUtils.lastIndexOf("aabaabaa", "a")  = 0
 StringUtils.lastIndexOf("aabaabaa", "b")  = 2
 StringUtils.lastIndexOf("aabaabaa", "ab") = 1
 StringUtils.lastIndexOf("aabaabaa", "")   = 8


--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LANG-600) Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)

Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/LANG-600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12841972#action_12841972 ]

Shaun Elliott commented on LANG-600:
------------------------------------

I can confirm this.

Running the following:

                // Copied from the javadoc      
                System.out.println( StringUtils.lastIndexOf( null, "*" ) );
                System.out.println( StringUtils.lastIndexOf( "*", null ) );
                System.out.println( StringUtils.lastIndexOf( "", "" ) );
                System.out.println( StringUtils.lastIndexOf( "aabaabaa", "a" ) );
                System.out.println( StringUtils.lastIndexOf( "aabaabaa", "b" ) );
                System.out.println( StringUtils.lastIndexOf( "aabaabaa", "ab" ) );
                System.out.println( StringUtils.lastIndexOf( "aabaabaa", "" ) );

Yields this:
-1
-1
0
7
5
4
8

Not this (as presented in the javadoc):
-1
-1
0
0
2
1
8

> Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-600
>                 URL: https://issues.apache.org/jira/browse/LANG-600
>             Project: Commons Lang
>          Issue Type: Task
>          Components: lang.*
>    Affects Versions: 2.4
>            Reporter: Sean Montgomery
>            Priority: Trivial
>
> The javadoc's examples show how indexOf should work not lastIndexOf.
>  StringUtils.lastIndexOf(null, *)          = -1
>  StringUtils.lastIndexOf(*, null)          = -1
>  StringUtils.lastIndexOf("", "")           = 0
>  StringUtils.lastIndexOf("aabaabaa", "a")  = 0
>  StringUtils.lastIndexOf("aabaabaa", "b")  = 2
>  StringUtils.lastIndexOf("aabaabaa", "ab") = 1
>  StringUtils.lastIndexOf("aabaabaa", "")   = 8

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Updated: (LANG-600) Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Henri Yandell updated LANG-600:
-------------------------------

    Fix Version/s: 3.0

> Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-600
>                 URL: https://issues.apache.org/jira/browse/LANG-600
>             Project: Commons Lang
>          Issue Type: Task
>          Components: lang.*
>    Affects Versions: 2.4
>            Reporter: Sean Montgomery
>            Priority: Trivial
>             Fix For: 3.0
>
>
> The javadoc's examples show how indexOf should work not lastIndexOf.
>  StringUtils.lastIndexOf(null, *)          = -1
>  StringUtils.lastIndexOf(*, null)          = -1
>  StringUtils.lastIndexOf("", "")           = 0
>  StringUtils.lastIndexOf("aabaabaa", "a")  = 0
>  StringUtils.lastIndexOf("aabaabaa", "b")  = 2
>  StringUtils.lastIndexOf("aabaabaa", "ab") = 1
>  StringUtils.lastIndexOf("aabaabaa", "")   = 8

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Commented: (LANG-600) Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

    [ https://issues.apache.org/jira/browse/LANG-600?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12842219#action_12842219 ]

Henri Yandell commented on LANG-600:
------------------------------------

Confirmed.

> Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-600
>                 URL: https://issues.apache.org/jira/browse/LANG-600
>             Project: Commons Lang
>          Issue Type: Task
>          Components: lang.*
>    Affects Versions: 2.4
>            Reporter: Sean Montgomery
>            Priority: Trivial
>             Fix For: 3.0
>
>
> The javadoc's examples show how indexOf should work not lastIndexOf.
>  StringUtils.lastIndexOf(null, *)          = -1
>  StringUtils.lastIndexOf(*, null)          = -1
>  StringUtils.lastIndexOf("", "")           = 0
>  StringUtils.lastIndexOf("aabaabaa", "a")  = 0
>  StringUtils.lastIndexOf("aabaabaa", "b")  = 2
>  StringUtils.lastIndexOf("aabaabaa", "ab") = 1
>  StringUtils.lastIndexOf("aabaabaa", "")   = 8

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply | Threaded
Open this post in threaded view
|

[jira] Closed: (LANG-600) Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)

Gary D. Gregory (Jira)
In reply to this post by Gary D. Gregory (Jira)

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

Henri Yandell closed LANG-600.
------------------------------

    Resolution: Fixed

svn ci -m "Fixing javadoc per LANG-600. Examples already in tests. " src/main/java/org/apache/commons/lang3/StringUtils.java
Sending        src/main/java/org/apache/commons/lang3/StringUtils.java
Transmitting file data .
Committed revision 924372.


> Javadoc is incorrect for public static int lastIndexOf(String str, String searchStr)
> ------------------------------------------------------------------------------------
>
>                 Key: LANG-600
>                 URL: https://issues.apache.org/jira/browse/LANG-600
>             Project: Commons Lang
>          Issue Type: Task
>          Components: lang.*
>    Affects Versions: 2.4
>            Reporter: Sean Montgomery
>            Priority: Trivial
>             Fix For: 3.0
>
>
> The javadoc's examples show how indexOf should work not lastIndexOf.
>  StringUtils.lastIndexOf(null, *)          = -1
>  StringUtils.lastIndexOf(*, null)          = -1
>  StringUtils.lastIndexOf("", "")           = 0
>  StringUtils.lastIndexOf("aabaabaa", "a")  = 0
>  StringUtils.lastIndexOf("aabaabaa", "b")  = 2
>  StringUtils.lastIndexOf("aabaabaa", "ab") = 1
>  StringUtils.lastIndexOf("aabaabaa", "")   = 8

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.