jdb throws a NPE on Windows when dealing with breakpoints. The issue can be reproduced
a) on 6u14, but not on 6u13.
b) on Windows, but not on Solaris and not on Linux
E:\jdb>type Test.java
import java.util.ArrayList;
import java.util.List;
public class Test {
public static List<Object> objList = new ArrayList<Object>();
private static void init(int numObjs) {
for (int i = 0; i < numObjs; i++) {
objList.add(new Object());
}
}
public static void main(String[] args) {
for (int i = 0; i < 10; i++) {
System.out.println("start");
init(1000000);
System.out.println("end");
objList.clear();
}
}
}
E:\jdb>javac Test.java
E:\jdb>"C:\Program Files\Java\jdk1.6.0_14\bin\jdb.exe" -J-showversion -classpath . Test
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Client VM (build 14.0-b16, mixed mode, sharing)
Initializing jdb ...
> stop at Test:17
Deferring breakpoint Test:17.
It will be set after the class is loaded.
> stop at Test:19
Deferring breakpoint Test:19.
It will be set after the class is loaded.
> stop
Breakpoints set:
breakpoint Test:17
breakpoint Test:19
> run
run Test
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started: Set deferred breakpoint Test:19
Set deferred breakpoint Test:17
Breakpoint hit: "thread=main", Test.main(), line=17 bci=8
17 System.out.println("start");
main[1] list
13
14 public static void main(String[] args) {
15
16 for (int i = 0; i < 10; i++) {
17 => System.out.println("start");
18 init(1000000);
19 System.out.println("end");
20 objList.clear();
21 }
22 }
main[1] cont
> start
Breakpoint hit: Exception in thread "event-handler" java.lang.NullPointerException
at com.sun.tools.example.debug.tty.TTY.printCurrentLocation(TTY.java:212)
at com.sun.tools.example.debug.tty.TTY.vmInterrupted(TTY.java:189)
at com.sun.tools.example.debug.tty.EventHandler.run(EventHandler.java:86)
at java.lang.Thread.run(Thread.java:619)