提交 36e77587 编写于 作者: J Jesse Glick

Run.getResult may be null, so check for that.

Observed in 1.509.2:
Parsing POMs
Failed to transfer Could not find artifact … in central (http://repo.maven.apache.org/maven2)
Archiving artifacts
ERROR: Processing failed due to a bug in the code. Please report this to jenkinsci-users@googlegroups.com
java.lang.NullPointerException
	at hudson.tasks.ArtifactArchiver.perform(ArtifactArchiver.java:138)
	at org.zeroturnaround.jenkins.LiveRebelDeployBuilder.getArtificatOrMetadata(LiveRebelDeployBuilder.java:194)
	at org.zeroturnaround.jenkins.LiveRebelDeployBuilder.uploadConfiguration(LiveRebelDeployBuilder.java:171)
	at org.zeroturnaround.jenkins.LiveRebelDeployBuilder.perform(LiveRebelDeployBuilder.java:108)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:812)
	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.build(MavenModuleSetBuild.java:828)
	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:779)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:594)
	at hudson.model.Run.execute(Run.java:1575)
	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:485)
上级 d9f3af5f
......@@ -400,9 +400,10 @@ public abstract class Run <JobT extends Job<JobT,RunT>,RunT extends Run<JobT,Run
* <p>
* When a build is {@link #isBuilding() in progress}, this method
* returns an intermediate result.
* @return The status of the build, if it has completed or some build step has set a status; may be null if the build is ongoing.
*/
@Exported
public Result getResult() {
public @CheckForNull Result getResult() {
return result;
}
......
......@@ -135,7 +135,8 @@ public class ArtifactArchiver extends Recorder {
String artifacts = build.getEnvironment(listener).expand(this.artifacts);
if(ws.copyRecursiveTo(artifacts,excludes,new FilePath(dir))==0) {
if(build.getResult().isBetterOrEqualTo(Result.UNSTABLE)) {
Result result = build.getResult();
if (result != null && result.isBetterOrEqualTo(Result.UNSTABLE)) {
// If the build failed, don't complain that there was no matching artifact.
// The build probably didn't even get to the point where it produces artifacts.
listenerWarnOrError(listener, Messages.ArtifactArchiver_NoMatchFound(artifacts));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册