Navigation Menu

Skip to content

Commit

Permalink
Merge pull request #1210 from daniel-beck/JENKINS-22720
Browse files Browse the repository at this point in the history
[FIXED JENKINS-22720] Only call getAllItems in recursive ListView
  • Loading branch information
daniel-beck committed May 10, 2014
2 parents 016f304 + df9adaf commit 137efcf
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 137efcf

Please sign in to comment.