package com.qianwen.core.http;
|
|
import java.io.IOException;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
import okhttp3.Call;
|
import okhttp3.Callback;
|
import okhttp3.Response;
|
|
@ParametersAreNonnullByDefault
|
/* loaded from: blade-starter-http-9.3.0.0-SNAPSHOT.jar:org/springblade/core/http/AsyncCallback.class */
|
public class AsyncCallback implements Callback {
|
private final AsyncCall asyncCall;
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
public AsyncCallback(AsyncCall asyncCall) {
|
this.asyncCall = asyncCall;
|
}
|
|
public void onFailure(Call call, IOException e) {
|
this.asyncCall.onFailure(call.request(), e);
|
}
|
|
public void onResponse(Call call, Response response) throws IOException {
|
HttpResponse httpResponse = new HttpResponse(response);
|
Throwable th = null;
|
try {
|
this.asyncCall.onResponse(httpResponse);
|
if (response.isSuccessful()) {
|
this.asyncCall.onSuccessful(httpResponse);
|
} else {
|
this.asyncCall.onFailure(call.request(), new IOException(httpResponse.message()));
|
}
|
if (httpResponse != null) {
|
if (0 != 0) {
|
try {
|
httpResponse.close();
|
return;
|
} catch (Throwable th2) {
|
th.addSuppressed(th2);
|
return;
|
}
|
}
|
httpResponse.close();
|
}
|
} catch (Throwable th3) {
|
try {
|
throw th3;
|
} catch (Throwable th4) {
|
if (httpResponse != null) {
|
if (th3 != null) {
|
try {
|
httpResponse.close();
|
} catch (Throwable th5) {
|
th3.addSuppressed(th5);
|
}
|
} else {
|
httpResponse.close();
|
}
|
}
|
throw th4;
|
}
|
}
|
}
|
}
|