-
Bug
-
Resolution: Won't Fix
-
P4
-
None
-
1.0.2
-
sparc
-
solaris_2.5
The java.io.FilterOutputStream constructor FilterOutputStream(OutputStream out)
accepts and does not check null parameter. It creates a FilterOutputStream
object with an invalid state: every call to this object results in throwing
undocumented NullPointerException.
Here is the example demonstrating this bug
_______________________Test.java ______________________________________
import java.io.*;
public class Test {
public static void main( String argv[] ) {
MyFilterOutputStream os = new MyFilterOutputStream(null);
try {
os.write(25);
System.out.println("No exceptions - rather strange but alright");
} catch (IOException e) {
System.out.println("IOException is thrown - possible result");
} catch (Throwable e) {
System.out.println(e+" is thrown - this is not allowed");
}
}
}
class MyFilterOutputStream extends FilterOutputStream {
public MyFilterOutputStream (OutputStream out) { super(out); }
}
_____________________Output_________________________________________
java.lang.NullPointerException is thrown - this is not allowed
____________________________________________________________________
accepts and does not check null parameter. It creates a FilterOutputStream
object with an invalid state: every call to this object results in throwing
undocumented NullPointerException.
Here is the example demonstrating this bug
_______________________Test.java ______________________________________
import java.io.*;
public class Test {
public static void main( String argv[] ) {
MyFilterOutputStream os = new MyFilterOutputStream(null);
try {
os.write(25);
System.out.println("No exceptions - rather strange but alright");
} catch (IOException e) {
System.out.println("IOException is thrown - possible result");
} catch (Throwable e) {
System.out.println(e+" is thrown - this is not allowed");
}
}
}
class MyFilterOutputStream extends FilterOutputStream {
public MyFilterOutputStream (OutputStream out) { super(out); }
}
_____________________Output_________________________________________
java.lang.NullPointerException is thrown - this is not allowed
____________________________________________________________________
- relates to
-
JDK-4012133 java.io.FilterInputStream constructor does not catch null parameter
-
- Closed
-