J
John English
I'm getting a very weird NullPointerException from deep in the bowels
of BufferedReader.readLine(), and having looked at the 1.5 source for
the library I'm not the wiser how this can happen -- the library code
for BufferedInputStream.read() (the actual source of the exception)
only seems to manipulate two ints (pos & count) and call two other
methods.
What I'm doing is: I'm using exec() to create a new Process, then using
getInputStream() to get the input stream from the Process. So far so
good -- the process is created, I get the input stream. I wrap it in
a BufferedReader:
BufferedReader in = new BufferedReader(new InputStreamReader(stream));
This also seems fine.
I then call in.readLine() and the following happens:
java.lang.NullPointerException
at java.io.BufferedInputStream.read(BufferedInputStream.java:279)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at foo.TestNode.runTest(TestNode.java:125)
(... and so on ...)
TestNode.java line 125 is the call to in.readLine(), btw.
I've tried this with 1.5 and 1.4.2 (both on a RedHat Linux system) and
it fails identically on both.
Any got *any* ideas at all what's happening here?
-----------------------------------------------------------------
John English | mailto:[email protected]
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
School of Computing & MIS | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------
of BufferedReader.readLine(), and having looked at the 1.5 source for
the library I'm not the wiser how this can happen -- the library code
for BufferedInputStream.read() (the actual source of the exception)
only seems to manipulate two ints (pos & count) and call two other
methods.
What I'm doing is: I'm using exec() to create a new Process, then using
getInputStream() to get the input stream from the Process. So far so
good -- the process is created, I get the input stream. I wrap it in
a BufferedReader:
BufferedReader in = new BufferedReader(new InputStreamReader(stream));
This also seems fine.
I then call in.readLine() and the following happens:
java.lang.NullPointerException
at java.io.BufferedInputStream.read(BufferedInputStream.java:279)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:408)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:450)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:182)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at foo.TestNode.runTest(TestNode.java:125)
(... and so on ...)
TestNode.java line 125 is the call to in.readLine(), btw.
I've tried this with 1.5 and 1.4.2 (both on a RedHat Linux system) and
it fails identically on both.
Any got *any* ideas at all what's happening here?
-----------------------------------------------------------------
John English | mailto:[email protected]
Senior Lecturer | http://www.it.bton.ac.uk/staff/je
School of Computing & MIS | ** NON-PROFIT CD FOR CS STUDENTS **
University of Brighton | -- see http://burks.bton.ac.uk
-----------------------------------------------------------------