summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2009-06-07 18:36:54 -0700
committerShawn O. Pearce <sop@google.com>2009-06-07 18:36:54 -0700
commit78c2c57b9702bcea0e57eeac4a44a28efd42c8e5 (patch)
treeffe387b83ad49b5e222eb262094f2ae79844c5b7
parent4eebb97ace764b67a69c358f150a306f175e65a2 (diff)
Remove invalid usage of List.subList(int,int)
GWT's List emulation does not support subList(int,int). Instead we must copy the list to a new list data structure, one element at a time, as there is no other efficient means of obtaining a sublist. Signed-off-by: Shawn O. Pearce <sop@google.com>
-rw-r--r--src/main/java/com/google/gerrit/client/changes/ChangeListServiceImpl.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main/java/com/google/gerrit/client/changes/ChangeListServiceImpl.java b/src/main/java/com/google/gerrit/client/changes/ChangeListServiceImpl.java
index a252c78323..f39af1bb02 100644
--- a/src/main/java/com/google/gerrit/client/changes/ChangeListServiceImpl.java
+++ b/src/main/java/com/google/gerrit/client/changes/ChangeListServiceImpl.java
@@ -214,7 +214,13 @@ public class ChangeListServiceImpl extends BaseServiceImplementation implements
}
Collections.sort(result, cmp);
if (limit < result.size()) {
- result = result.subList(0, limit);
+ // GWT emulation unfortunately lacks subList(int,int).
+ //
+ final List<Change> r = new ArrayList<Change>(limit);
+ for (int i = 0; i < limit; i++) {
+ r.add(result.get(i));
+ }
+ result = r;
}
return new ListResultSet<Change>(result);
}