java.io.CharArrayWriter(negative) throws NegativeArraySizeException

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P4
    • None
    • Affects Version/s: 1.2.0
    • Component/s: core-libs
    • generic
    • generic



      Name: bb33257 Date: 06/26/98


      If you construct a CharArrayWriter with a negative buffer size parameter,
      you'll see a NegativeArraySizeException rather than an IllegalArgumentException.
      This problem causes a JCK test to fail.
      ---------------------------------------------
      import java.io.*;
      public class CWCons {
        public static void main(String[] args) throws IOException {
          try {
             CharArrayWriter caw = new CharArrayWriter(-10);
          }
          catch (IllegalArgumentException e) {
            System.out.println("OK, good exception");
            System.exit(0);
          }
          System.out.println("Didn't get expected exception");
          System.exit(0);
        }
      }

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

            Assignee:
            Benedict Gomes (Inactive)
            Reporter:
            Brian Beck (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: