Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4351217

java.lang.String.indexOf(String,int) in jdk1.4 has wrong javadoc comments

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 1.4.0
    • Component/s: docs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      sparc
    • OS:
      solaris_2.6

      Description



      Name: auR10023 Date: 07/07/2000



      java.lang.String.indexOf(String,int) in jdk1.4 has wrong javadoc comments.

      Here is the part of the java doc for this method:

      ...
      There is no restriction on the value of fromIndex. If it is negative, it has the
      same effect as if it were zero: this entire string may be searched. If it is
                                                                          ^^^^^^^^
      greater than the length of this string, it has the same effect as if it were
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      equal to the length of this string: -1 is returned.
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      ...

      But if fromIndex is greater than the length of this string, it should return
      length of the string(due to the fix of 4276204).

      -------------example-------------------

      public class TestString {
          public static void main(String[] args){
              int x1 = "abc".indexOf("",10);
              System.out.println(x1);
          }
      }

      ----output result in jdk1.4---
      3


      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            mmcclosksunw Michael Mccloskey (Inactive)
            Reporter:
            avusunw Avu Avu (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: