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

(bf) CharBuffer.charAt(index) accepts index < 0

XMLWordPrintable

    • beta3
    • sparc
    • solaris_7
    • Verified

      String s = "This is to test charAt()";
      CharBuffer c = CharBuffer.wrap(s.toCharArray());
      c.position(8);
      c.charAt(-1);

      compiles and runs without throwing IndexOutOfBoundsException exception, for index < 0.

      ###@###.### 2001-10-04
      java version "1.4.0-beta3"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b82)
      Java HotSpot(TM) Client VM (build 1.4.0-beta3-b82, mixed mode)

      /net/sqesvr/export/xlt/libs/merlin/dev/testbase/src/libs_api_tests/common/java_nio/Buffer/CharBufferTest/CBCharAt 6 % java CBCharAt
      Total tests for Exec : 1
      Expected IndexOutOfBoundsException thrown for index < 0
      Expected IndexOutOfBoundsException thrown for index > remaining()
      Expected IndexOutOfBoundsException thrown for index > limit()
      Pass count: 1
      Fail count: 0
      Test for CharAt.java Passed

            iris Iris Clark
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: