Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-14507] NPE from JUnitParser.parse.
  • Loading branch information
jglick committed Jul 19, 2012
1 parent ecd5b7d commit 931fa17
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
4 changes: 3 additions & 1 deletion changelog.html
Expand Up @@ -55,7 +55,9 @@
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image>
<li class=>
<li class=bug>
<code>NullPointerException</code> from <code>JUnitParser.parse</code>.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-14507">issue 14507</a>)
</ul>
</div><!--=TRUNK-END=-->

Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/model/AbstractBuild.java
Expand Up @@ -88,6 +88,7 @@
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.CheckForNull;

/**
* Base implementation of {@link Run}s that build software.
Expand Down Expand Up @@ -249,7 +250,7 @@ public String getUpUrl() {
* no longer show a workspace as it was used for this build.
* @since 1.319
*/
public final FilePath getWorkspace() {
public final @CheckForNull FilePath getWorkspace() {
if (workspace==null) return null;
Node n = getBuiltOn();
if (n==null) return null;
Expand Down
7 changes: 5 additions & 2 deletions core/src/main/java/hudson/tasks/junit/JUnitParser.java
Expand Up @@ -80,8 +80,11 @@ public TestResult parse(String testResultLocations,
// [BUG 3123310] TODO - Test Result Refactor: review and fix TestDataPublisher/TestAction subsystem]
// also get code that deals with testDataPublishers from JUnitResultArchiver.perform

TestResult testResult = build.getWorkspace().act( new ParseResultCallable(testResultLocations, buildTime, timeOnMaster, keepLongStdio));
return testResult;
FilePath workspace = build.getWorkspace();
if (workspace == null) {
throw new AbortException(Messages.JUnitParser_no_workspace_found(build));
}
return workspace.act(new ParseResultCallable(testResultLocations, buildTime, timeOnMaster, keepLongStdio));
}

private static final class ParseResultCallable implements
Expand Down
Expand Up @@ -30,6 +30,7 @@ PackageResult.getChildTitle=Class
ClassResult.getTitle=Test Result : {0}
JUnitParser.DisplayName=JUnit Parser
JUnitParser.TestResultLocationMessage=JUnit xml files:
JUnitParser.no_workspace_found=No workspace found for {0}
JUnitResultArchiver.DisplayName=Publish JUnit test result report
JUnitResultArchiver.NoTestReportFound=No test report files were found. Configuration error?
JUnitResultArchiver.Recording=Recording test results
Expand Down

0 comments on commit 931fa17

Please sign in to comment.