2021-08-03 07:33:18 +00:00
|
|
|
package com.linecorp.apng.decoder;
|
|
|
|
|
|
|
|
import c.d.b.a.a;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.util.NoSuchElementException;
|
|
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
/* compiled from: ApngException.kt */
|
|
|
|
public final class ApngException extends Exception {
|
|
|
|
private final ErrorCode errorCode;
|
|
|
|
|
|
|
|
/* compiled from: ApngException.kt */
|
|
|
|
public enum ErrorCode {
|
|
|
|
ERR_STREAM_READ_FAIL(-100),
|
|
|
|
ERR_UNEXPECTED_EOF(-101),
|
|
|
|
ERR_INVALID_FILE_FORMAT(-102),
|
|
|
|
ERR_NOT_EXIST_IMAGE(-103),
|
|
|
|
ERR_FRAME_INDEX_OUT_OF_RANGE(-104),
|
|
|
|
ERR_OUT_OF_MEMORY(-105),
|
|
|
|
ERR_BITMAP_OPERATION(-106),
|
|
|
|
ERR_UNSUPPORTED_TYPE(-107),
|
|
|
|
ERR_WITH_CHILD_EXCEPTION(-200);
|
|
|
|
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private final int errorCode;
|
|
|
|
|
|
|
|
/* compiled from: ApngException.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
public Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ErrorCode fromErrorCode$apng_drawable_release(int i) {
|
|
|
|
ErrorCode[] values = ErrorCode.values();
|
|
|
|
for (int i2 = 0; i2 < 9; i2++) {
|
|
|
|
ErrorCode errorCode = values[i2];
|
|
|
|
if (errorCode.getErrorCode() == i) {
|
|
|
|
return errorCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throw new NoSuchElementException("Array contains no element matching the predicate.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public ErrorCode(int i2) {
|
|
|
|
this.errorCode = i2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public final int getErrorCode() {
|
|
|
|
return this.errorCode;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
|
|
|
|
static {
|
|
|
|
ErrorCode.values();
|
|
|
|
int[] iArr = new int[9];
|
|
|
|
$EnumSwitchMapping$0 = iArr;
|
|
|
|
iArr[ErrorCode.ERR_STREAM_READ_FAIL.ordinal()] = 1;
|
|
|
|
iArr[ErrorCode.ERR_UNEXPECTED_EOF.ordinal()] = 2;
|
|
|
|
iArr[ErrorCode.ERR_INVALID_FILE_FORMAT.ordinal()] = 3;
|
|
|
|
iArr[ErrorCode.ERR_NOT_EXIST_IMAGE.ordinal()] = 4;
|
|
|
|
iArr[ErrorCode.ERR_FRAME_INDEX_OUT_OF_RANGE.ordinal()] = 5;
|
|
|
|
iArr[ErrorCode.ERR_OUT_OF_MEMORY.ordinal()] = 6;
|
|
|
|
iArr[ErrorCode.ERR_BITMAP_OPERATION.ordinal()] = 7;
|
|
|
|
iArr[ErrorCode.ERR_UNSUPPORTED_TYPE.ordinal()] = 8;
|
|
|
|
iArr[ErrorCode.ERR_WITH_CHILD_EXCEPTION.ordinal()] = 9;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public ApngException(ErrorCode errorCode, Throwable th) {
|
|
|
|
super(th);
|
|
|
|
m.checkNotNullParameter(errorCode, "errorCode");
|
|
|
|
this.errorCode = errorCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public /* synthetic */ ApngException(ErrorCode errorCode, Throwable th, int i, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this(errorCode, (i & 2) != 0 ? null : th);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public ApngException(Throwable th) {
|
|
|
|
this(ErrorCode.ERR_WITH_CHILD_EXCEPTION, th);
|
|
|
|
m.checkNotNullParameter(th, "throwable");
|
|
|
|
}
|
|
|
|
|
|
|
|
public final ErrorCode getErrorCode() {
|
|
|
|
return this.errorCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // java.lang.Throwable
|
|
|
|
public String getMessage() {
|
|
|
|
switch (this.errorCode.ordinal()) {
|
|
|
|
case 0:
|
|
|
|
return "Can't read the stream.";
|
|
|
|
case 1:
|
|
|
|
return "Unexpected end of file.";
|
|
|
|
case 2:
|
|
|
|
return "Invalid file format.";
|
|
|
|
case 3:
|
|
|
|
return "Not exist native image.";
|
|
|
|
case 4:
|
|
|
|
return "Frame index is out of range.";
|
|
|
|
case 5:
|
|
|
|
return "Out of memory";
|
|
|
|
case 6:
|
|
|
|
return "Error in the native bitmap operation.";
|
|
|
|
case 7:
|
|
|
|
return "Unsupported image type.";
|
|
|
|
case 8:
|
2021-08-11 06:37:47 +00:00
|
|
|
StringBuilder L = a.L("Failed with sub exception : ");
|
2021-08-03 07:33:18 +00:00
|
|
|
Throwable cause = getCause();
|
2021-08-11 06:37:47 +00:00
|
|
|
L.append(cause != null ? cause.getMessage() : null);
|
|
|
|
return L.toString();
|
2021-08-03 07:33:18 +00:00
|
|
|
default:
|
|
|
|
throw new NoWhenBranchMatchedException();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|