Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » NPE when launching test with Line Coverage enabled
NPE when launching test with Line Coverage enabled [message #81012] Thu, 17 August 2006 17:08 Go to next message
Michael Giroux is currently offline Michael GirouxFriend
Messages: 287
Registered: July 2009
Senior Member
I've installed the Line coverage plugin. When the test is launched, I'm
getting an exception shortly after the new workbench window is displayed. I
don't see any of my code on the stack trace, so I'm not sure what is going
wrong.

Environment:
Eclipse 3.2
WTP 1.5

Shown below:
1. stack trace
2. java code that launches the test (sorry about the lack of indents)

Is this supposed to work?
Any suggestions?
Does this need a bug report?

Michael Giroux



Exception in thread "WorkbenchTestable" org.eclipse.swt.SWTException: Failed
to execute runnable (java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:3374)
at org.eclipse.swt.SWT.error(SWT.java:3297)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.j ava:178)
at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchroniz er.java:28)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:3763)
at
org.eclipse.ui.internal.testing.WorkbenchTestable.runTest(Wo rkbenchTestable.java:109)
at
org.eclipse.pde.internal.junit.runtime.UITestApplication.run Tests(UITestApplication.java:103)
at
org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.NullPointerException
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence. <init>(JUnit3TestReference.java:57)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoade r.loadTests(JUnit3TestLoader.java:61)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:445)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
at
org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:58)
at
org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:105)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3325)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2971)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
at
org.eclipse.pde.internal.junit.runtime.UITestApplication.run (UITestApplication.java:45)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)



void launchTest(IFile selection) {
String method = me + ".launchTest";
tp.ctrace(method);
tp.atrace(method, "selection path: " + selection.getFullPath());
tp.atrace(method, "selection project: " + selection.getProject().getName());
BSOATestReportPlugin plugin = BSOATestReportPlugin.getDefault();
String state = plugin.getStateLocation().toFile().getPath();
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType configType =
manager.getLaunchConfigurationType("org.eclipse.pde.ui.JunitLaunchConfig ");
String pkg = id.substring(0, id.lastIndexOf('.'));
String launchConfigName = pkg + ".JUnitLaunchConfig";
String projectName = selection.getProject().getName();
String projectRoot = selection.getProject().getLocation().toString();
tp.atrace(method, "Project Root: " + projectRoot);
try {
ILaunchConfigurationWorkingCopy wc = configType.newInstance(null,
launchConfigName );
wc.setAttribute("org.eclipse.jdt.launching.MAIN_TYPE",
"com.bull.eclipse.junit.TestDriver");
wc.setAttribute("location0",getLaunchWorkspace());
wc.setAttribute("clearws", true);
wc.setAttribute("askclear", true);
wc.setAttribute("includeOptional", true);
wc.setAttribute("default", true);
wc.setAttribute("useDefaultConfig", true);
wc.setAttribute("org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER ",
"org.eclipse.pde.ui.workbenchClasspathProvider");
// TestDriver obtains configuration from our <statelocation>/TestSuite.xml
String vmargs = "\"-Dcom.bull.eclipse.junit.CONFIG=" + state + "\"";
// and the test cases need to know the root folder for the Level 2 Test
project.
vmargs = vmargs + " \"-Dcom.bull.eclipse.junit.PROJECT_ROOT=" + projectRoot
+ "\"";
wc.setAttribute("vmargs", vmargs);
// TODO create project in target workspace
wc.setAttribute("org.eclipse.jdt.launching.PROJECT_ATTR", projectName);
ILaunchConfiguration config = wc.doSave();
ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
tp.atrace(method, "test launched");
} catch (CoreException e) {
tp.atrace(method, "Launch Failed: " + e.toString());
BSOATestReportPlugin.logError("Launch Failed", e);
MessageDialog.openError(null, "BSOA JUnit Plug-in Test", "Launch Failed: " +
e);
e.printStackTrace();
}
tp.etrace(1,method);
}
Re: NPE when launching test with Line Coverage enabled [message #81177 is a reply to message #81012] Fri, 18 August 2006 14:52 Go to previous messageGo to next message
Valentina Popescu is currently offline Valentina PopescuFriend
Messages: 23
Registered: July 2009
Junior Member
What java version are you using ?

"Michael Giroux" <michael.giroux@bull.com> wrote in message
news:ec27q3$k35$1@utils.eclipse.org...
> I've installed the Line coverage plugin. When the test is launched, I'm
> getting an exception shortly after the new workbench window is displayed.
> I don't see any of my code on the stack trace, so I'm not sure what is
> going wrong.
>
> Environment:
> Eclipse 3.2
> WTP 1.5
>
> Shown below:
> 1. stack trace
> 2. java code that launches the test (sorry about the lack of indents)
>
> Is this supposed to work?
> Any suggestions?
> Does this need a bug report?
>
> Michael Giroux
>
>
>
> Exception in thread "WorkbenchTestable" org.eclipse.swt.SWTException:
> Failed to execute runnable (java.lang.NullPointerException)
> at org.eclipse.swt.SWT.error(SWT.java:3374)
> at org.eclipse.swt.SWT.error(SWT.java:3297)
> at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.j ava:178)
> at org.eclipse.ui.internal.UISynchronizer.syncExec(UISynchroniz er.java:28)
> at org.eclipse.swt.widgets.Display.syncExec(Display.java:3763)
> at
> org.eclipse.ui.internal.testing.WorkbenchTestable.runTest(Wo rkbenchTestable.java:109)
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication.run Tests(UITestApplication.java:103)
> at
> org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:68)
> at java.lang.Thread.run(Thread.java:595)
> Caused by: java.lang.NullPointerException
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestRefer ence. <init>(JUnit3TestReference.java:57)
> at
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoade r.loadTests(JUnit3TestLoader.java:61)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:445)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:673)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:386)
> at
> org.eclipse.pde.internal.junit.runtime.RemotePluginTestRunne r.main(RemotePluginTestRunner.java:58)
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication$1.r un(UITestApplication.java:105)
> at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
> at
> org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
> at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3325)
> at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2971)
> at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
> at
> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
> at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
> at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
> at
> org.eclipse.pde.internal.junit.runtime.UITestApplication.run (UITestApplication.java:45)
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
>
>
> void launchTest(IFile selection) {
> String method = me + ".launchTest";
> tp.ctrace(method);
> tp.atrace(method, "selection path: " + selection.getFullPath());
> tp.atrace(method, "selection project: " +
> selection.getProject().getName());
> BSOATestReportPlugin plugin = BSOATestReportPlugin.getDefault();
> String state = plugin.getStateLocation().toFile().getPath();
> ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
> ILaunchConfigurationType configType =
> manager.getLaunchConfigurationType("org.eclipse.pde.ui.JunitLaunchConfig ");
> String pkg = id.substring(0, id.lastIndexOf('.'));
> String launchConfigName = pkg + ".JUnitLaunchConfig";
> String projectName = selection.getProject().getName();
> String projectRoot = selection.getProject().getLocation().toString();
> tp.atrace(method, "Project Root: " + projectRoot);
> try {
> ILaunchConfigurationWorkingCopy wc = configType.newInstance(null,
> launchConfigName );
> wc.setAttribute("org.eclipse.jdt.launching.MAIN_TYPE",
> "com.bull.eclipse.junit.TestDriver");
> wc.setAttribute("location0",getLaunchWorkspace());
> wc.setAttribute("clearws", true);
> wc.setAttribute("askclear", true);
> wc.setAttribute("includeOptional", true);
> wc.setAttribute("default", true);
> wc.setAttribute("useDefaultConfig", true);
> wc.setAttribute("org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER ",
> "org.eclipse.pde.ui.workbenchClasspathProvider");
> // TestDriver obtains configuration from our <statelocation>/TestSuite.xml
> String vmargs = "\"-Dcom.bull.eclipse.junit.CONFIG=" + state + "\"";
> // and the test cases need to know the root folder for the Level 2 Test
> project.
> vmargs = vmargs + " \"-Dcom.bull.eclipse.junit.PROJECT_ROOT=" +
> projectRoot + "\"";
> wc.setAttribute("vmargs", vmargs);
> // TODO create project in target workspace
> wc.setAttribute("org.eclipse.jdt.launching.PROJECT_ATTR", projectName);
> ILaunchConfiguration config = wc.doSave();
> ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
> tp.atrace(method, "test launched");
> } catch (CoreException e) {
> tp.atrace(method, "Launch Failed: " + e.toString());
> BSOATestReportPlugin.logError("Launch Failed", e);
> MessageDialog.openError(null, "BSOA JUnit Plug-in Test", "Launch Failed: "
> + e);
> e.printStackTrace();
> }
> tp.etrace(1,method);
> }
>
Re: NPE when launching test with Line Coverage enabled [message #81190 is a reply to message #81177] Fri, 18 August 2006 20:09 Go to previous messageGo to next message
Michael Giroux is currently offline Michael GirouxFriend
Messages: 287
Registered: July 2009
Senior Member
"Valentina Popescu" <popescu@ca.ibm.com> wrote in message
news:ec4k7t$t26$1@utils.eclipse.org...
> What java version are you using ?

java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)
Re: NPE when launching test with Line Coverage enabled [message #81205 is a reply to message #81190] Fri, 18 August 2006 20:12 Go to previous messageGo to next message
Michael Giroux is currently offline Michael GirouxFriend
Messages: 287
Registered: July 2009
Senior Member
> java version "1.5.0_08"

BTW, I saw some other messages that mentioned issues w/ JDK 5.0, but I'm
developing plugins that target and take advantage of JDK 5.0 features, so it
wont be easy (if at all possible) to try w/ JDK 1.4.

Michael
Re: NPE when launching test with Line Coverage enabled [message #81250 is a reply to message #81205] Mon, 21 August 2006 14:04 Go to previous message
Valentina Popescu is currently offline Valentina PopescuFriend
Messages: 23
Registered: July 2009
Junior Member
I opened defect https://bugs.eclipse.org/bugs/show_bug.cgi?id=154535 to
track down this problem

"Michael Giroux" <michael.giroux@bull.com> wrote in message
news:ec56us$507$1@utils.eclipse.org...
>> java version "1.5.0_08"
>
> BTW, I saw some other messages that mentioned issues w/ JDK 5.0, but I'm
> developing plugins that target and take advantage of JDK 5.0 features, so
> it wont be easy (if at all possible) to try w/ JDK 1.4.
>
> Michael
>
Previous Topic:Question about analysis rules: J2SE Best Practices
Next Topic:Automated GUI Recroder Eclipse Version
Goto Forum:
  


Current Time: Mon Sep 23 19:10:12 GMT 2024

Powered by FUDForum. Page generated in 0.02627 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top