Name: yyT116575 Date: 05/21/2001
$ ./java -version
java version "1.3.0_02"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_02)
Java HotSpot(TM) Client VM (build 1.3.0_02, mixed mode)
$
This may be a new bug ... or a duplicate of 4251318 ... it probably is a
duplicate if Robot.delay(int) spawns a child process.
The following program gets a null pointer exception when ran on a Solaris
machine via an X-Term on a PC:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Foo {
private class Bar extends Thread {
public void run() {
Robot r = null;
try {
r = new Robot();
} catch(Exception e) {
System.out.println("ERROR!!!");
}
for (int i=0; i<10; i++) {
System.out.println("Bar ["+i+"]");
System.out.flush();
r.delay(500);
}
System.exit(0);
}
}
public void runFoo() {
new Bar().start();
}
public static void main(String[] args) {
Foo f = new Foo();
f.runFoo();
}
}
The output is:
Bar [0]
java.lang.NullPointerException
at Foo$Bar.run(Foo.java:13)
(Review ID: 124648)
======================================================================