-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
1.2fcs
-
sparc
-
solaris_2.5
-
Verified
Name: sdC67446 Date: 02/12/98
Constructor java.util.zip.DeflaterOutputStream(OutputStream os, Deflater def)
doesn't check parameter "def" for null. Thus calling the write method later
causes undocumented NullPointerException.
The similar bug is present in InflaterInputStream constructor as well.
--------------------------------------------------
Here is the test demonstrating the bug:
-----------------Test.java------------------------
import java.util.zip.*;
import java.io.*;
public class Test {
public static void main(String[] args) {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Deflater def = null;
DeflaterOutputStream defOS = new DeflaterOutputStream(bos, def);
System.out.println("Constructed!");
try {
defOS.write(100);
} catch ( NullPointerException e ) {
System.out.println("NullPointerException thrown while writing!");
} catch ( IOException e ) {
System.out.println(e);
}
}
}
---------Output from the test---------------------
Constructed!
NullPointerException thrown while writing!
--------------------------------------------------
======================================================================