Files
rr3-apk/decompiled/sources/com/amazonaws/http/DefaultErrorResponseHandler.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

65 lines
2.8 KiB
Java

package com.amazonaws.http;
import com.amazonaws.AmazonClientException;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.logging.Log;
import com.amazonaws.logging.LogFactory;
import com.amazonaws.transform.Unmarshaller;
import com.amazonaws.util.IOUtils;
import com.amazonaws.util.XpathUtils;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import org.w3c.dom.Document;
/* loaded from: classes.dex */
public class DefaultErrorResponseHandler implements HttpResponseHandler<AmazonServiceException> {
public static final Log log = LogFactory.getLog(DefaultErrorResponseHandler.class);
public List unmarshallerList;
@Override // com.amazonaws.http.HttpResponseHandler
public boolean needsConnectionLeftOpen() {
return false;
}
public DefaultErrorResponseHandler(List list) {
this.unmarshallerList = list;
}
@Override // com.amazonaws.http.HttpResponseHandler
public AmazonServiceException handle(HttpResponse httpResponse) {
try {
String iOUtils = IOUtils.toString(httpResponse.getContent());
try {
Document documentFrom = XpathUtils.documentFrom(iOUtils);
Iterator it = this.unmarshallerList.iterator();
while (it.hasNext()) {
AmazonServiceException amazonServiceException = (AmazonServiceException) ((Unmarshaller) it.next()).unmarshall(documentFrom);
if (amazonServiceException != null) {
amazonServiceException.setStatusCode(httpResponse.getStatusCode());
return amazonServiceException;
}
}
throw new AmazonClientException("Unable to unmarshall error response from service");
} catch (Exception e) {
return newAmazonServiceException(String.format("Unable to unmarshall error response (%s)", iOUtils), httpResponse, e);
}
} catch (IOException e2) {
Log log2 = log;
if (log2.isDebugEnabled()) {
log2.debug("Failed in reading the error response", e2);
}
return newAmazonServiceException("Unable to unmarshall error response", httpResponse, e2);
}
}
public final AmazonServiceException newAmazonServiceException(String str, HttpResponse httpResponse, Exception exc) {
AmazonServiceException amazonServiceException = new AmazonServiceException(str, exc);
int statusCode = httpResponse.getStatusCode();
amazonServiceException.setErrorCode(statusCode + " " + httpResponse.getStatusText());
amazonServiceException.setErrorType(AmazonServiceException.ErrorType.Unknown);
amazonServiceException.setStatusCode(statusCode);
return amazonServiceException;
}
}