(bf) CharBuffer: Expected IndexOutOfBoundsException not thrown

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • None
    • Affects Version/s: 1.4.0
    • Component/s: core-libs
    • sparc
    • solaris_7

      IllegalArgumentException is thrown instead of IndexOutOfBoundsException when the preconditions on the offset and length parameters do not hold.

      int size = 100;
      char[] charArray = new char[size];
      try {
           CharBuffer c = CharBuffer.wrap(charArray,size,size);
      }
      catch(IndexOutOfBoundsException e) {
          System.out.println("Expected exception thrown ");
      }
      catch(IllegalArgumentException e) {
          System.out.println("Unexpected exception thrown ");
      }

      results in Unexpected exception thrown.

            Assignee:
            Iris Clark
            Reporter:
            J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: