PC
2024-03-31 608f20e0d5d8f95d9bbb917e95e2913682deb77d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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;
            }
        }
    }
}