Skip to content

Commit

Permalink
Check publishers null for JENKINS-16772
Browse files Browse the repository at this point in the history
  • Loading branch information
gboissinot committed Feb 15, 2013
1 parent 71a996a commit 735c660
Showing 1 changed file with 9 additions and 7 deletions.
Expand Up @@ -48,15 +48,17 @@ private void putLastListPostBuildPublisher(Class<? extends AbstractProject> jobC
publishersField = jobClass.getDeclaredField("publishers");
publishersField.setAccessible(true);
DescribableList<Publisher, Descriptor<Publisher>> publishers = (DescribableList<Publisher, Descriptor<Publisher>>) publishersField.get(project);
Iterator<Publisher> it = publishers.iterator();
while (it.hasNext()) {
Publisher curPublisher = it.next();
if (curPublisher instanceof PostBuildScript) {
publishers.remove(curPublisher.getClass());
publishers.add(curPublisher);
if (publishers != null) {
Iterator<Publisher> it = publishers.iterator();
while (it.hasNext()) {
Publisher curPublisher = it.next();
if (curPublisher instanceof PostBuildScript) {
publishers.remove(curPublisher.getClass());
publishers.add(curPublisher);
}
}
publishersField.set(project, publishers);
}
publishersField.set(project, publishers);

} catch (NoSuchFieldException nse) {
throw new PostBuildScriptException(nse);
Expand Down

0 comments on commit 735c660

Please sign in to comment.