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

java.io.CharArrayWriter(negative) throws NegativeArraySizeException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • None
    • 1.2.0
    • core-libs
    • generic
    • generic

    Description



      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);
        }
      }

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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: