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);
}
}
======================================================================
- duplicates
-
JDK-4015701 java.io.ByteArrayOutputStream can throw NegativeArraySizeException
-
- Closed
-