Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
SF #3487904: Avoid NPE in case of new and empty launch configurations.
Browse files Browse the repository at this point in the history
  • Loading branch information
marchof committed Feb 15, 2012
1 parent 194686b commit bc9321c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@ public void teardown() throws Exception {
javaProject2.destroy();
}

@Test
public void testNoProject() throws Exception {
JavaProjectKit.waitForBuild();

ILaunchConfigurationWorkingCopy configuration = getJavaApplicationType()
.newInstance(javaProject1.project, "test.launch");

final Collection<IPackageFragmentRoot> scope = launcher
.getOverallScope(configuration);

assertEquals(set(), set(scope));
}

@Test
public void testProjectWithSourceFolders() throws Exception {
IPackageFragmentRoot rootSrc1 = javaProject1.createSourceFolder("src");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
package com.mountainminds.eclemma.core.launching;

import java.util.Arrays;
import java.util.Collections;
import java.util.Set;

import org.eclipse.core.runtime.CoreException;
Expand All @@ -30,8 +31,12 @@ public class JavaApplicationLauncher extends CoverageLauncher {
public Set<IPackageFragmentRoot> getOverallScope(
ILaunchConfiguration configuration) throws CoreException {
final IJavaProject project = JavaRuntime.getJavaProject(configuration);
return ScopeUtils.filterJREEntries(Arrays.asList(project
.getAllPackageFragmentRoots()));
if (project == null) {
return Collections.emptySet();
} else {
return ScopeUtils.filterJREEntries(Arrays.asList(project
.getAllPackageFragmentRoots()));
}
}

}
1 change: 1 addition & 0 deletions com.mountainminds.eclemma.doc/pages/changes.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ <h2>Trunk</h2>
<li>For long-running processes intermediate coverage data dumps can now be
collected without terminating the application under test.</li>
<li>Trac #168: New editor for JaCoCo execution data files.</li>
<li>SF #3487904: Avoid NPE in case of new and empty launch configurations.</li>
<li>SF #3477725: Java agent must not be added multiple times to plug-in
launch configurations.</li>
</ul>
Expand Down

0 comments on commit bc9321c

Please sign in to comment.