use ArrayList instead of ImmutableList for searchresult, because the result must be mutable for decorators

This commit is contained in:
Sebastian Sdorra
2013-03-04 20:37:09 +01:00
parent fd0e5bca45
commit 412e495a21

View File

@@ -37,7 +37,7 @@ package sonia.scm.search;
import com.google.common.base.Function;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Lists;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
@@ -140,8 +140,11 @@ public class SearchHandler<T>
Collections2.transform(users, function);
result.setSuccess(true);
// create a copy of the result collection to reduce memory
result.setResults(ImmutableList.copyOf(resultCollection));
// use ArrayList instead of ImmutableList for copy,
// because the list must be mutable for decorators
result.setResults(Lists.newArrayList(resultCollection));
cache.put(queryString, result);
}
}