Skip to content

Commit

Permalink
[FIXED JENKINS-22720] Only call getAllItems in recursive ListView
Browse files Browse the repository at this point in the history
(cherry picked from commit df9adaf)
  • Loading branch information
daniel-beck authored and olivergondza committed Jun 8, 2014
1 parent 7f29954 commit 819c1f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion core/src/main/java/hudson/model/ListView.java
Expand Up @@ -170,7 +170,13 @@ public List<TopLevelItem> getItems() {
includeItems(parent, parentItems, names);

Boolean statusFilter = this.statusFilter; // capture the value to isolate us from concurrent update
for (TopLevelItem item : Items.getAllItems(getOwnerItemGroup(), TopLevelItem.class)) {
Iterable<? extends TopLevelItem> candidates;
if (recurse) {
candidates = Items.getAllItems(parent, TopLevelItem.class);
} else {
candidates = parent.getItems();
}
for (TopLevelItem item : candidates) {
if (!names.contains(item.getRelativeNameFrom(getOwnerItemGroup()))) continue;
// Add if no status filter or filter matches enabled/disabled status:
if(statusFilter == null || !(item instanceof AbstractProject)
Expand Down
1 change: 1 addition & 0 deletions test/src/test/java/hudson/model/ListViewTest.java
Expand Up @@ -119,6 +119,7 @@ private void checkLinkFromItemExistsAndIsValid(Item item, ItemGroup ig, Item top
FreeStyleProject p2 = sub.createProject(FreeStyleProject.class, "p2");
FreeStyleProject p3 = top.createProject(FreeStyleProject.class, "p3");
ListView v = new ListView("v");
v.setRecurse(true);
top.addView(v);
v.add(p1);
v.add(p2);
Expand Down

0 comments on commit 819c1f1

Please sign in to comment.