This bug occurs on Linux, RH 6.2. It might not occur on newer linuxes.
To see this bug, run the following script in the test/com/sun/jdi
directory of a j2se workpace:
#!/bin/sh
set -x
xx=`uname`
case $xx in
SunOS)
jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/solaris-sparc
;;
Linux)
jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/linux-i586
;;
*)
echo "--Error: this script doesn't yet run on uname = $xx"
exit 1
;;
esac
resultDir=./result
mkdir -p $resultDir
CLASSPATH=$jdk/classes:$jdk/lib/tools.jar:./scaffold:$resultDir
export CLASSPATH
$jdk/bin/javac -g -J-Xms40m -d $resultDir TestScaffold.java VMConnection.java \ TargetListener.java TargetAdapter.java ConnectedVMs.java InstTarg.java
$jdk/bin/java -Dtest.src=. -Dtest.classes=$resultDir ConnectedVMs
--------------------------------------------------------------------
This starts a JPDA debugger test. The debugger launches a 2nd VM
as the debuggee and grabs its stdout and stderr streams. The debugger has
threads that read the debuggee output and write it to the debugger's
output.
At one point in the test, the debugger does Process.destroy().
This causes the thread that is doing
while ((line = in.readLine()) != null) {
to get the NullPointerException.
Here is the stack trace:
java.lang.NullPointerException
at java.io.BufferedInputStream.read(BufferedInputStream.java:279)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:406)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:446)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:180)
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 VMConnection.dumpStream(VMConnection.java:261)
at VMConnection.access$000(VMConnection.java:12)
at VMConnection$1.run(VMConnection.java:275)
(In the actual output from the test, some other output will follow
this stack trace. Ignore it as it is bogus.)
To see this bug, run the following script in the test/com/sun/jdi
directory of a j2se workpace:
#!/bin/sh
set -x
xx=`uname`
case $xx in
SunOS)
jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/solaris-sparc
;;
Linux)
jdk=/java/re/jdk/1.4.1/promoted/latest/binaries/linux-i586
;;
*)
echo "--Error: this script doesn't yet run on uname = $xx"
exit 1
;;
esac
resultDir=./result
mkdir -p $resultDir
CLASSPATH=$jdk/classes:$jdk/lib/tools.jar:./scaffold:$resultDir
export CLASSPATH
$jdk/bin/javac -g -J-Xms40m -d $resultDir TestScaffold.java VMConnection.java \ TargetListener.java TargetAdapter.java ConnectedVMs.java InstTarg.java
$jdk/bin/java -Dtest.src=. -Dtest.classes=$resultDir ConnectedVMs
--------------------------------------------------------------------
This starts a JPDA debugger test. The debugger launches a 2nd VM
as the debuggee and grabs its stdout and stderr streams. The debugger has
threads that read the debuggee output and write it to the debugger's
output.
At one point in the test, the debugger does Process.destroy().
This causes the thread that is doing
while ((line = in.readLine()) != null) {
to get the NullPointerException.
Here is the stack trace:
java.lang.NullPointerException
at java.io.BufferedInputStream.read(BufferedInputStream.java:279)
at sun.nio.cs.StreamDecoder$CharsetSD.readBytes(StreamDecoder.java:406)
at sun.nio.cs.StreamDecoder$CharsetSD.implRead(StreamDecoder.java:446)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:180)
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 VMConnection.dumpStream(VMConnection.java:261)
at VMConnection.access$000(VMConnection.java:12)
at VMConnection$1.run(VMConnection.java:275)
(In the actual output from the test, some other output will follow
this stack trace. Ignore it as it is bogus.)
- duplicates
-
JDK-4728096 java.io.BufferedInputStream has no synchronization on close operation
- Resolved