Hi,
I'm using Abbot SWT 1.0.0.rc1 and Eclipse 3.3.
We're encountering a NullPointerException when running Eclipse PDE tests from a non-UI thread, using the ActivePDETestSuite.
08-Apr-2008 09:40:10 [java] [java] Caused by: java.lang.NullPointerException
08-Apr-2008 09:40:10 [java] [java] at junit.extensions.ActivePDETestSuite$2.run(ActivePDETestSuite.java:148)
08-Apr-2008 09:40:10 [java] [java] at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
08-Apr-2008 09:40:10 [java] [java] at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)
08-Apr-2008 09:40:10 [java] [java] at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3296)
08-Apr-2008 09:40:10 [java] [java] at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2974)
08-Apr-2008 09:40:10 [java] [java] at junit.extensions.ActivePDETestSuite.waitUntilFinished(ActivePDETestSuite.java:129)
08-Apr-2008 09:40:10 [java] [java] at junit.extensions.ActivePDETestSuite.run(ActivePDETestSuite.java:112)
08-Apr-2008 09:40:10 [java] [java] at junit.framework.TestSuite.runTest(TestSuite.java:230)
08-Apr-2008 09:40:10 [java] [java] at junit.framework.TestSuite.run(TestSuite.java:225)
08-Apr-2008 09:40:10 [java] [java] at junit.extensions.TestDecorator.basicRun(TestDecorator.java:24)
The exception is caused by the line
if (!rootShell.isDisposed()) {
where rootShell is null.
The field rootShell is initialized by calling
this.rootShell = display.getActiveShell();
In our environment (a Linux system) we could produce a case where the active shell is null. This is a legal return value as the JavaDoc of the getActiveShell states:
"Returns the currently active <code>Shell</code>, or null if no shell belonging to the currently running application is active."
My proposal for a fix is to add a null check before the problematic call and exit the Runnable immediately if it is null. This should be no problem - if the rootShell is null, there is no cleanup required anyway.
Best regards
Tillmann
Logged In: YES
user_id=2062703
Originator: NO
Sorry, I wasn't logged in when creating this issue. Here's my email address if you need further information:
tseidel@innoopract.com