The method Channels.newChannel() does not throw NullPointerException on null input.
public class ChannelsNewChannelTest {
public static void main(String[] args) throws Exception {
ReadableByteChannel channel = Channels.newChannel((InputStream)null);
ByteBuffer buffer = ByteBuffer.allocate(100);
channel.read(buffer);
}
}
OUTPUT:
Exception in thread "main" java.lang.NullPointerException
at
java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:196)
at ChannelsNewChannelTest.main(ChannelsNewChannelTest.java:16)
The exception should be thrown by Channels.newChannel((InputStream)null), not read().
A similar problem exists for Channels.newChannel((OutputStream)null).
###@###.### 2005-03-31 20:41:56 GMT
public class ChannelsNewChannelTest {
public static void main(String[] args) throws Exception {
ReadableByteChannel channel = Channels.newChannel((InputStream)null);
ByteBuffer buffer = ByteBuffer.allocate(100);
channel.read(buffer);
}
}
OUTPUT:
Exception in thread "main" java.lang.NullPointerException
at
java.nio.channels.Channels$ReadableByteChannelImpl.read(Channels.java:196)
at ChannelsNewChannelTest.main(ChannelsNewChannelTest.java:16)
The exception should be thrown by Channels.newChannel((InputStream)null), not read().
A similar problem exists for Channels.newChannel((OutputStream)null).
###@###.### 2005-03-31 20:41:56 GMT
- relates to
-
JDK-6248924 (ch spec) java.nio.channels{.spi}? package.html missing spec for null input
-
- Resolved
-