Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-29470] - Prevent NPE in AbstractProject.checkout when agent disconnects during the build #3094

Merged
merged 4 commits into from Mar 4, 2018
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion core/src/main/java/hudson/model/AbstractProject.java
Expand Up @@ -1207,7 +1207,13 @@ public boolean checkout(AbstractBuild build, Launcher launcher, BuildListener li
return true; // no SCM

FilePath workspace = build.getWorkspace();
workspace.mkdirs();
if(workspace!=null){
workspace.mkdirs();
}
else{
throw new AbortException(); // workspace is undefined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason should be passed in the exception message. Otherwise the user will not see the root cause in the build log

}


boolean r = scm.checkout(build, launcher, workspace, listener, changelogFile);
if (r) {
Expand Down