package defpackage;

import android.util.Log;
import defpackage.vc7;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/* JADX INFO: loaded from: classes.dex */
public class gx1<DataType, ResourceType, Transcode> {
    public final Class a;
    public final List b;
    public final s28 c;
    public final vc7.a d;
    public final String e;

    public interface a<ResourceType> {
    }

    public gx1(Class cls, Class cls2, Class cls3, List list, s28 s28Var, vc7.a aVar) {
        this.a = cls;
        this.b = list;
        this.c = s28Var;
        this.d = aVar;
        this.e = "Failed DecodePath{" + cls.getSimpleName() + "->" + cls2.getSimpleName() + "->" + cls3.getSimpleName() + "}";
    }

    public final b28 a(com.bumptech.glide.load.data.a aVar, int i, int i2, my6 my6Var, List list) throws jv3 {
        List list2 = this.b;
        int size = list2.size();
        b28 b28VarB = null;
        for (int i3 = 0; i3 < size; i3++) {
            h28 h28Var = (h28) list2.get(i3);
            try {
                if (h28Var.a(aVar.a(), my6Var)) {
                    b28VarB = h28Var.b(aVar.a(), i, i2, my6Var);
                }
            } catch (IOException | OutOfMemoryError | RuntimeException e) {
                if (Log.isLoggable("DecodePath", 2)) {
                    Objects.toString(h28Var);
                }
                list.add(e);
            }
            if (b28VarB != null) {
                break;
            }
        }
        if (b28VarB != null) {
            return b28VarB;
        }
        throw new jv3(this.e, new ArrayList(list));
    }

    public final String toString() {
        return "DecodePath{ dataClass=" + this.a + ", decoders=" + this.b + ", transcoder=" + this.c + '}';
    }
}
