-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
int[] cannot be cast to java.lang.Object[] in setResourceDecoderBucketPriorityList #3296
Comments
it's ok in Glide 4.1.1 |
There's a note in the Android API 27 code for ArrayList that indicates that calling toArray() might erroneously return an array of an incorrect type: public ArrayList(Collection<? extends E> c) {
elementData = c.toArray();
if ((size = elementData.length) != 0) {
// c.toArray might (incorrectly) not return Object[] (see 6260652)
if (elementData.getClass() != Object[].class)
elementData = Arrays.copyOf(elementData, size, Object[].class);
} else {
// replace with empty array.
this.elementData = EMPTY_ELEMENTDATA;
}
} |
And how to solve this bug?@sjudd |
MeiZu M1 crash too... |
MeiZu M1 crash too... +1 |
See the associated commit. If you're able to reproduce this on 4.9.0+ let me know. |
java.lang.ClassCastException: int[] cannot be cast to java.lang.Object[]
at java.util.Arrays$ArrayList.toArray(Arrays.java:120)
at java.util.ArrayList.addAll(ArrayList.java:188)
at com.bumptech.glide.Registry.setResourceDecoderBucketPriorityList(Registry.java:270)
at com.bumptech.glide.Registry.<init>(Registry.java:67)
at com.bumptech.glide.Glide.<init>(Glide.java:339)
at com.bumptech.glide.GlideBuilder.build(GlideBuilder.java:509)
at com.bumptech.glide.Glide.initializeGlide(Glide.java:268)
at com.bumptech.glide.Glide.initializeGlide(Glide.java:223)
at com.bumptech.glide.Glide.checkAndInitializeGlide(Glide.java:184)
at com.bumptech.glide.Glide.get(Glide.java:168)
at com.bumptech.glide.Glide.getRetriever(Glide.java:689)
at com.bumptech.glide.Glide.with(Glide.java:716) |
setResourceDecoderBucketPriorityList(
Arrays.asList(BUCKET_GIF, BUCKET_BITMAP, BUCKET_BITMAP_DRAWABLE)); public synchronized void setBucketPriorityList(@NonNull List<String> buckets) {
List<String> previousBuckets = new ArrayList<>(bucketPriorityList);
bucketPriorityList.clear();
bucketPriorityList.addAll(buckets);
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
// end.
bucketPriorityList.add(previousBucket);
}
}
} @NonNull
public final Registry setResourceDecoderBucketPriorityList(@NonNull List<String> buckets) {
// See #3296 and https://bugs.openjdk.java.net/browse/JDK-6260652.
List<String> modifiedBuckets = new ArrayList<>(buckets.size());
modifiedBuckets.addAll(buckets);
modifiedBuckets.add(0, BUCKET_PREPEND_ALL);
modifiedBuckets.add(BUCKET_APPEND_ALL);
decoderRegistry.setBucketPriorityList(modifiedBuckets);
return this;
} new ArrayList<>() maybe the crash reason @sjudd |
Fixes #3296 PiperOrigin-RevId: 276290565
Fixes #3296 PiperOrigin-RevId: 276290565
Fixes #3296 PiperOrigin-RevId: 276290565
Using Glide 4.9.0, I have the same issue, with android devices show as below: VKY-AL00 9.1.0.228(C00E80R1P12) crash log is
Before, using Glide 3.5.2, didn`t have the issue. |
We are also using facing following issue in multiple devices and multiple OS:
|
Glide Version: 4.7.1
Integration libraries: com.squareup.okhttp3:okhttp:3.11.0
Device/Android Version: MeiZu M1 flymeos 4.2.1 (android4.4 API19)
Issue details / Repro steps / Use case background:
Glide load line /
GlideModule
(if any) / list Adapter code (if any):Layout XML:
Stack trace / LogCat:
The text was updated successfully, but these errors were encountered: