Skip to content
Permalink
Browse files
Merge pull request #278 from jenkinsci/JENKINS-33467
Don't crash because JENKINS-33467 has changed expected behaviour
  • Loading branch information
rsandell committed Mar 31, 2016
2 parents b7ab589 + 03d057f commit f1a6a398ba1cf1f1f1ce1fb48e84a437ec3fb3bb
Showing with 15 additions and 7 deletions.
  1. +15 −7 src/main/java/com/sonyericsson/hudson/plugins/gerrit/trigger/gerritnotifier/ToGerritRunListener.java
@@ -275,14 +275,22 @@ protected void setThisBuild(Run r) {
*/
protected void cleanUpGerritCauses(GerritCause firstFound, Run build) {
List<Cause> causes = build.getAction(CauseAction.class).getCauses();
int pos = causes.indexOf(firstFound) + 1;
while (pos < causes.size()) {
Cause c = causes.get(pos);
if (c.equals(firstFound)) {
causes.remove(pos);
} else {
pos++;
try {
int pos = causes.indexOf(firstFound) + 1;
while (pos < causes.size()) {
Cause c = causes.get(pos);
if (c.equals(firstFound)) {
causes.remove(pos);
} else {
pos++;
}
}
} catch (UnsupportedOperationException ignored) {
logger.debug("Got smashed by JENKINS-33467, but it shouldn't do any harm", ignored);
/*
TODO Something better should be done here, this is to prevent totally breaking when JENKINS-33467 hits.
But since JENKINS-33467 is aimed at preventing this case maybe it's no longer needed at all.
*/
}
}

0 comments on commit f1a6a39

Please sign in to comment.