java.lang.StringBuffer.getChars() works incorrectly on NT

XMLWordPrintable

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: P3
    • None
    • Affects Version/s: 1.3.0
    • Component/s: core-libs
    • None
    • sparc
    • solaris_2.6

      java.lang.StringBuffer.getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) throws StringIndexOutOfBoundsException on NT when
      srcBegin == srcEnd == current length of StringBuffer
      This happens in kestrel build L

      On solaris it returns silently(4272838 was fixed this way) as it should because the block of zero length is specified at the end of StringBuffer and
      this is in line with the current javadoc.

      The example to demonstrate the problem:

      -----
      class test3 {
          public static void main(String[] args) {
              StringBuffer sb = new StringBuffer("sample");
              sb.getChars(6, 6, new char[1], 1);
              System.out.println("no exception thrown");
          }
      }

      -----

      solaris run:
      javator:/home/sko/mytests 304 /net/novo35/opt/build13/jdk1.3/L/bin/java test3
      no exception thrown

      NT run:
      >java test3
      java.lang.StringIndexOutOfBoundsException: String index out of range: 6
      at java.lang.StringBuffer.getChars(StringBuffer.java:274)
      at test.main(test.java:5)

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: