Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312166

Summary: [JUnit] NPE when launching any test
Product: [Eclipse Project] JDT Reporter: Mariana <potback>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: markus.kell.r, Olivier_Thomann
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Mariana CLA 2010-05-08 15:19:22 EDT
Build Identifier: M20100211-1343

eclipse.buildId=M20100211-1343
java.version=1.6.0_11
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=pt_BR
Command-line arguments:  -os linux -ws gtk -arch x86


Error
Sat May 08 16:16:26 BRT 2010
An internal error occurred during: "Launching MyTest (1)".

java.lang.NullPointerException
	at org.eclipse.osgi.baseadaptor.bundlefile.DirZipBundleEntry.getFileURL(DirZipBundleEntry.java:68)
	at org.eclipse.osgi.framework.internal.core.BundleURLConnection.getFileURL(BundleURLConnection.java:129)
	at org.eclipse.core.runtime.internal.adaptor.URLConverterImpl.toFileURL(URLConverterImpl.java:34)
	at org.eclipse.core.runtime.FileLocator.toFileURL(FileLocator.java:206)
	at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localURL(JUnitLaunchConfigurationDelegate.java:444)
	at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.entryString(JUnitLaunchConfigurationDelegate.java:428)
	at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.addEntry(JUnitLaunchConfigurationDelegate.java:415)
	at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate$ClasspathLocalizer.localizeClasspath(JUnitLaunchConfigurationDelegate.java:406)
	at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.getClasspath(JUnitLaunchConfigurationDelegate.java:383)
	at org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationDelegate.launch(JUnitLaunchConfigurationDelegate.java:151)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:853)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:703)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:866)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1069)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


(Does not occur in same eclipse with in similar machines of my coworkers).


Reproducible: Always

Steps to Reproduce:
1.Create a test:
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class MyTest {
	
	@Before
	public void setUp() throws Exception {
		
	}

	@After
	public void tearDown() throws Exception {
		
	}
	@Test
	public void test() {
		
	}	
}

2. Try to run as JUnit Test in Eclipse
Comment 1 Paul Slauenwhite CLA 2010-05-10 07:47:56 EDT
Note, this is an issue with the JDT JUnit runner.
Comment 2 Olivier Thomann CLA 2010-05-10 08:33:08 EDT
Moving to JDT/UI
Comment 3 Markus Keller CLA 2010-05-10 09:52:41 EDT
Works for me.

You've probably created a "JUnit Plug-in Test" launch configuration instead of a "JUnit" launch config. But if you launch that, you should get an error message that tells you that your project is not a plug-in project.
Comment 4 Mariana CLA 2010-05-13 08:54:04 EDT
I'm sorry guys, in my normal anxiety I just started with a new workspace (which solved the problem) AND deleted the old one, so I can't test if that was really the problem. Next time wont happen =$