-
Notifications
You must be signed in to change notification settings - Fork 177
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
Fix Null pointer exceptions #161
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ | |
import hudson.model.Action; | ||
import hudson.model.BuildListener; | ||
import hudson.model.DependencyGraph; | ||
import hudson.model.Result; | ||
import hudson.model.TaskListener; | ||
import hudson.tasks.BuildStepDescriptor; | ||
import hudson.tasks.BuildStepMonitor; | ||
|
@@ -51,6 +52,7 @@ | |
import java.util.*; | ||
import java.util.concurrent.CancellationException; | ||
import java.util.concurrent.ExecutionException; | ||
import java.util.logging.Logger; | ||
|
||
/** | ||
* {@link Builder} that triggers other projects and optionally waits for their completion. | ||
|
@@ -59,6 +61,8 @@ | |
*/ | ||
public class TriggerBuilder extends Builder implements DependencyDeclarer { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(TriggerBuilder.class.getName()); | ||
|
||
private final ArrayList<BlockableBuildTriggerConfig> configs; | ||
|
||
@DataBoundConstructor | ||
|
@@ -133,9 +137,11 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, | |
for (Job p : projectList) { | ||
//handle non-buildable projects | ||
if(!config.canBeScheduled(p)){ | ||
User user = User.current(); | ||
String userName = user != null ? ModelHyperlinkNote.encodeTo(user) : "unknown"; | ||
listener.getLogger().println("Skipping " + HyperlinkNote.encodeTo('/'+ p.getUrl(), p.getFullDisplayName()) + | ||
". The project is either disabled," | ||
+ " or the authenticated user " + ModelHyperlinkNote.encodeTo(User.current()) + " has no Item.BUILD permissions," | ||
+ " or the authenticated user " + userName + " has no Item.BUILD permissions," | ||
+ " or the configuration has not been saved yet."); | ||
continue; | ||
} | ||
|
@@ -151,7 +157,12 @@ public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, | |
BuildInfoExporterAction.addBuildInfoExporterAction(build, completedRun.getParent().getFullName(), completedRun.getNumber(), completedRun.getResult()); | ||
|
||
if (buildStepResult && config.getBlock().mapBuildStepResult(completedRun.getResult())) { | ||
build.setResult(config.getBlock().mapBuildResult(completedRun.getResult())); | ||
Result r = config.getBlock().mapBuildResult(completedRun.getResult()); | ||
if (r != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure I can add it in case there is some underlying issue here |
||
build.setResult(r); | ||
} else { | ||
LOGGER.warning("Attempting to use the result of unfinished build " + completedRun.toString()); | ||
} | ||
} else { | ||
buildStepResult = false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"the authenticated user unknown has no ..." is a bit odd, but should be ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be
the authenticated user unknown has no Item.BUILD