Skip to content

Commit

Permalink
Avoid ArrayList#addAll when setting bucket priorities.
Browse files Browse the repository at this point in the history
Fixes #3296

PiperOrigin-RevId: 276299510
  • Loading branch information
sjudd authored and glide-copybara-robot committed Oct 23, 2019
1 parent c643255 commit 42d3f07
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ public class ResourceDecoderRegistry {
public synchronized void setBucketPriorityList(@NonNull List<String> buckets) {
List<String> previousBuckets = new ArrayList<>(bucketPriorityList);
bucketPriorityList.clear();
bucketPriorityList.addAll(buckets);
// new ArrayList(List) and ArrayList#addAll(List) are both broken on some verisons of Android,
// see #3296
for (String bucket : buckets) {
bucketPriorityList.add(bucket);
}
for (String previousBucket : previousBuckets) {
if (!buckets.contains(previousBucket)) {
// Keep any buckets from the previous list that aren't included here, but but them at the
Expand Down

0 comments on commit 42d3f07

Please sign in to comment.