package com.bumptech.glide.load.engine; import androidx.core.util.Pools$Pool; import com.bumptech.glide.load.Options; import com.bumptech.glide.load.data.DataRewinder; import com.bumptech.glide.load.engine.DecodePath; import com.bumptech.glide.util.Preconditions; import java.util.ArrayList; import java.util.Arrays; import java.util.List; /* loaded from: classes.dex */ public class LoadPath { private final Pools$Pool> a; private final List> b; private final String c; public LoadPath(Class cls, Class cls2, Class cls3, List> list, Pools$Pool> pools$Pool) { this.a = pools$Pool; Preconditions.a(list); this.b = list; this.c = "Failed LoadPath{" + cls.getSimpleName() + "->" + cls2.getSimpleName() + "->" + cls3.getSimpleName() + "}"; } public Resource a(DataRewinder dataRewinder, Options options, int i, int i2, DecodePath.DecodeCallback decodeCallback) throws GlideException { List a = this.a.a(); Preconditions.a(a); List list = a; try { return a(dataRewinder, options, i, i2, decodeCallback, list); } finally { this.a.a(list); } } public String toString() { return "LoadPath{decodePaths=" + Arrays.toString(this.b.toArray()) + '}'; } private Resource a(DataRewinder dataRewinder, Options options, int i, int i2, DecodePath.DecodeCallback decodeCallback, List list) throws GlideException { int size = this.b.size(); Resource resource = null; for (int i3 = 0; i3 < size; i3++) { try { resource = this.b.get(i3).a(dataRewinder, i, i2, options, decodeCallback); } catch (GlideException e) { list.add(e); } if (resource != null) { break; } } if (resource != null) { return resource; } throw new GlideException(this.c, new ArrayList(list)); } }