The NPE is a result of AbstractProject.getActions() calling the java.unil.Vector.addAll() method with a null parameter.
It comes from a method implemented in the Jenkins Core:
public synchronized List<Action> getActions() {
List<Action> actions = new Vector<Action>(super.getActions());
NPE => actions.addAll(transientActions);
return Collections.unmodifiableList(actions);
}
maybe there should be a check if transientActions is not null.
The problem also exists in other plugins using the Abstractproject.getActions() method in their ActionFactory classes, for example JobConfighistory and JSWidgets.
We could catch the exception and treat it as if there were no actions for the current project (see code below). That would solve the problem, but maybe it would be better if the method getAction() in AbstractProject is changed to return null or and empty list if there are no actions for a certain project.
Workaround:
Old code of JobConfigHistoryActionFactory.createFor(AbstractProject project)(with NPE)
public Collection<? extends Action> createFor(@SuppressWarnings("unchecked") AbstractProject target) {
final ArrayList<Action> actions = new ArrayList<Action>();
final List<JobConfigHistoryProjectAction> historyJobActions = target.getActions(JobConfigHistoryProjectAction.class);
LOG.fine(target + " already had " + historyJobActions);
final JobConfigHistoryProjectAction newAction = new JobConfigHistoryProjectAction(target);
actions.add(newAction);
LOG.fine(this + " adds " + newAction + " for " + target);
return actions;
}
New code of JobConfigHistoryActionFactory.createFor(AbstractProject project)(catching the NPE)
public Collection<? extends Action> createFor(@SuppressWarnings("rawtypes") AbstractProject target) {
List<JobConfigHistoryProjectAction> historyJobActions;
try {
historyJobActions = target.getActions(JobConfigHistoryProjectAction.class);
} catch (NullPointerException e) {
historyJobActions = null;
}
if (historyJobActions != null && !historyJobActions.isEmpty()) {
return historyJobActions;
}
final ArrayList<Action> actions = new ArrayList<Action>();
final JobConfigHistoryProjectAction newAction = new JobConfigHistoryProjectAction(target);
actions.add(newAction);
return actions;
}
This problem happens on a clean 1.500 install too, steps to produce: