Navigation Menu

Skip to content

Commit

Permalink
[FIXED JENKINS-25655] Incorrect caching from entrySet sometimes cause…
Browse files Browse the repository at this point in the history
…d incorrect results.

Caused a failure in hudson.plugins.promoted_builds.conditions.ManualConditionTest.testManualPromotionProcessViaWebClient when run against 1.580.1.
(cherry picked from commit b76e7bf)
  • Loading branch information
jglick authored and olivergondza committed Dec 21, 2014
1 parent be34b67 commit bd0453f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
Expand Up @@ -585,6 +585,8 @@ public synchronized R put(Integer key, R r) {
numberOnDisk = a;
}

entrySet.clearCache();

return unwrap(old);
}

Expand Down Expand Up @@ -742,6 +744,8 @@ public synchronized boolean removeValue(R run) {
BuildReference<R> old = copy.byId.remove(getIdOf(run));
this.index = copy;

entrySet.clearCache();

return unwrap(old)!=null;
}

Expand Down
Expand Up @@ -32,6 +32,10 @@ private synchronized Set<Entry<Integer,R>> all() {
return all;
}

synchronized void clearCache() {
all = null;
}

@Override
public int size() {
return all().size();
Expand Down
Expand Up @@ -414,6 +414,13 @@ public void entrySetSize() {
assertEquals(0, b.entrySet().size());
}

@Issue("JENKINS-25655")
@Test public void entrySetChanges() {
assertEquals(3, a.entrySet().size());
a.put(new Build(7, "D"));
assertEquals(4, a.entrySet().size());
}

@Issue("JENKINS-18065")
@Test
public void entrySetContains() {
Expand Down

0 comments on commit bd0453f

Please sign in to comment.