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

    • Bug
    • Resolution: Fixed
    • P3
    • 1.4.0
    • 1.4.0
    • docs
    • beta
    • sparc
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: