287 lines
		
	
	
		
			8.1 KiB
		
	
	
	
		
			Smali
		
	
	
	
	
	
			
		
		
	
	
			287 lines
		
	
	
		
			8.1 KiB
		
	
	
	
		
			Smali
		
	
	
	
	
	
| .class public Lcom/amazonaws/http/StaxResponseHandler;
 | |
| .super Ljava/lang/Object;
 | |
| .source "StaxResponseHandler.java"
 | |
| 
 | |
| # interfaces
 | |
| .implements Lcom/amazonaws/http/HttpResponseHandler;
 | |
| 
 | |
| 
 | |
| # annotations
 | |
| .annotation system Ldalvik/annotation/Signature;
 | |
|     value = {
 | |
|         "<T:",
 | |
|         "Ljava/lang/Object;",
 | |
|         ">",
 | |
|         "Ljava/lang/Object;",
 | |
|         "Lcom/amazonaws/http/HttpResponseHandler<",
 | |
|         "Lcom/amazonaws/AmazonWebServiceResponse<",
 | |
|         "TT;>;>;"
 | |
|     }
 | |
| .end annotation
 | |
| 
 | |
| 
 | |
| # static fields
 | |
| .field private static final XML_PULL_PARSER_FACTORY:Lorg/xmlpull/v1/XmlPullParserFactory;
 | |
| 
 | |
| .field private static final log:Lcom/amazonaws/logging/Log;
 | |
| 
 | |
| 
 | |
| # instance fields
 | |
| .field private responseUnmarshaller:Lcom/amazonaws/transform/Unmarshaller;
 | |
|     .annotation system Ldalvik/annotation/Signature;
 | |
|         value = {
 | |
|             "Lcom/amazonaws/transform/Unmarshaller<",
 | |
|             "TT;",
 | |
|             "Lcom/amazonaws/transform/StaxUnmarshallerContext;",
 | |
|             ">;"
 | |
|         }
 | |
|     .end annotation
 | |
| .end field
 | |
| 
 | |
| 
 | |
| # direct methods
 | |
| .method public static constructor <clinit>()V
 | |
|     .locals 3
 | |
| 
 | |
|     const-string v0, "com.amazonaws.request"
 | |
| 
 | |
|     .line 1
 | |
|     invoke-static {v0}, Lcom/amazonaws/logging/LogFactory;->getLog(Ljava/lang/String;)Lcom/amazonaws/logging/Log;
 | |
| 
 | |
|     move-result-object v0
 | |
| 
 | |
|     sput-object v0, Lcom/amazonaws/http/StaxResponseHandler;->log:Lcom/amazonaws/logging/Log;
 | |
| 
 | |
|     .line 2
 | |
|     :try_start_0
 | |
|     invoke-static {}, Lorg/xmlpull/v1/XmlPullParserFactory;->newInstance()Lorg/xmlpull/v1/XmlPullParserFactory;
 | |
| 
 | |
|     move-result-object v0
 | |
| 
 | |
|     sput-object v0, Lcom/amazonaws/http/StaxResponseHandler;->XML_PULL_PARSER_FACTORY:Lorg/xmlpull/v1/XmlPullParserFactory;
 | |
|     :try_end_0
 | |
|     .catch Lorg/xmlpull/v1/XmlPullParserException; {:try_start_0 .. :try_end_0} :catch_0
 | |
| 
 | |
|     return-void
 | |
| 
 | |
|     :catch_0
 | |
|     move-exception v0
 | |
| 
 | |
|     .line 3
 | |
|     new-instance v1, Lcom/amazonaws/AmazonClientException;
 | |
| 
 | |
|     const-string v2, "Couldn\'t initialize XmlPullParserFactory"
 | |
| 
 | |
|     invoke-direct {v1, v2, v0}, Lcom/amazonaws/AmazonClientException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
 | |
| 
 | |
|     throw v1
 | |
| .end method
 | |
| 
 | |
| .method public constructor <init>(Lcom/amazonaws/transform/Unmarshaller;)V
 | |
|     .locals 0
 | |
|     .annotation system Ldalvik/annotation/Signature;
 | |
|         value = {
 | |
|             "(",
 | |
|             "Lcom/amazonaws/transform/Unmarshaller<",
 | |
|             "TT;",
 | |
|             "Lcom/amazonaws/transform/StaxUnmarshallerContext;",
 | |
|             ">;)V"
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 1
 | |
|     invoke-direct {p0}, Ljava/lang/Object;-><init>()V
 | |
| 
 | |
|     .line 2
 | |
|     iput-object p1, p0, Lcom/amazonaws/http/StaxResponseHandler;->responseUnmarshaller:Lcom/amazonaws/transform/Unmarshaller;
 | |
| 
 | |
|     if-nez p1, :cond_0
 | |
| 
 | |
|     .line 3
 | |
|     new-instance p1, Lcom/amazonaws/transform/VoidStaxUnmarshaller;
 | |
| 
 | |
|     invoke-direct {p1}, Lcom/amazonaws/transform/VoidStaxUnmarshaller;-><init>()V
 | |
| 
 | |
|     iput-object p1, p0, Lcom/amazonaws/http/StaxResponseHandler;->responseUnmarshaller:Lcom/amazonaws/transform/Unmarshaller;
 | |
| 
 | |
|     :cond_0
 | |
|     return-void
 | |
| .end method
 | |
| 
 | |
| 
 | |
| # virtual methods
 | |
| .method public handle(Lcom/amazonaws/http/HttpResponse;)Lcom/amazonaws/AmazonWebServiceResponse;
 | |
|     .locals 6
 | |
|     .annotation system Ldalvik/annotation/Signature;
 | |
|         value = {
 | |
|             "(",
 | |
|             "Lcom/amazonaws/http/HttpResponse;",
 | |
|             ")",
 | |
|             "Lcom/amazonaws/AmazonWebServiceResponse<",
 | |
|             "TT;>;"
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Ljava/lang/Exception;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 2
 | |
|     sget-object v0, Lcom/amazonaws/http/StaxResponseHandler;->log:Lcom/amazonaws/logging/Log;
 | |
| 
 | |
|     const-string v1, "Parsing service response XML"
 | |
| 
 | |
|     invoke-interface {v0, v1}, Lcom/amazonaws/logging/Log;->trace(Ljava/lang/Object;)V
 | |
| 
 | |
|     .line 3
 | |
|     invoke-virtual {p1}, Lcom/amazonaws/http/HttpResponse;->getContent()Ljava/io/InputStream;
 | |
| 
 | |
|     move-result-object v1
 | |
| 
 | |
|     if-nez v1, :cond_0
 | |
| 
 | |
|     .line 4
 | |
|     new-instance v1, Ljava/io/ByteArrayInputStream;
 | |
| 
 | |
|     sget-object v2, Lcom/amazonaws/util/StringUtils;->UTF8:Ljava/nio/charset/Charset;
 | |
| 
 | |
|     const-string v3, "<eof/>"
 | |
| 
 | |
|     invoke-virtual {v3, v2}, Ljava/lang/String;->getBytes(Ljava/nio/charset/Charset;)[B
 | |
| 
 | |
|     move-result-object v2
 | |
| 
 | |
|     invoke-direct {v1, v2}, Ljava/io/ByteArrayInputStream;-><init>([B)V
 | |
| 
 | |
|     .line 5
 | |
|     :cond_0
 | |
|     sget-object v2, Lcom/amazonaws/http/StaxResponseHandler;->XML_PULL_PARSER_FACTORY:Lorg/xmlpull/v1/XmlPullParserFactory;
 | |
| 
 | |
|     invoke-virtual {v2}, Lorg/xmlpull/v1/XmlPullParserFactory;->newPullParser()Lorg/xmlpull/v1/XmlPullParser;
 | |
| 
 | |
|     move-result-object v2
 | |
| 
 | |
|     const/4 v3, 0x0
 | |
| 
 | |
|     .line 6
 | |
|     invoke-interface {v2, v1, v3}, Lorg/xmlpull/v1/XmlPullParser;->setInput(Ljava/io/InputStream;Ljava/lang/String;)V
 | |
| 
 | |
|     .line 7
 | |
|     new-instance v1, Lcom/amazonaws/AmazonWebServiceResponse;
 | |
| 
 | |
|     invoke-direct {v1}, Lcom/amazonaws/AmazonWebServiceResponse;-><init>()V
 | |
| 
 | |
|     .line 8
 | |
|     new-instance v3, Lcom/amazonaws/transform/StaxUnmarshallerContext;
 | |
| 
 | |
|     .line 9
 | |
|     invoke-virtual {p1}, Lcom/amazonaws/http/HttpResponse;->getHeaders()Ljava/util/Map;
 | |
| 
 | |
|     move-result-object v4
 | |
| 
 | |
|     invoke-direct {v3, v2, v4}, Lcom/amazonaws/transform/StaxUnmarshallerContext;-><init>(Lorg/xmlpull/v1/XmlPullParser;Ljava/util/Map;)V
 | |
| 
 | |
|     const-string v2, "ResponseMetadata/RequestId"
 | |
| 
 | |
|     const/4 v4, 0x2
 | |
| 
 | |
|     const-string v5, "AWS_REQUEST_ID"
 | |
| 
 | |
|     .line 10
 | |
|     invoke-virtual {v3, v2, v4, v5}, Lcom/amazonaws/transform/StaxUnmarshallerContext;->registerMetadataExpression(Ljava/lang/String;ILjava/lang/String;)V
 | |
| 
 | |
|     const-string v2, "requestId"
 | |
| 
 | |
|     .line 11
 | |
|     invoke-virtual {v3, v2, v4, v5}, Lcom/amazonaws/transform/StaxUnmarshallerContext;->registerMetadataExpression(Ljava/lang/String;ILjava/lang/String;)V
 | |
| 
 | |
|     .line 12
 | |
|     invoke-virtual {p0, v3}, Lcom/amazonaws/http/StaxResponseHandler;->registerAdditionalMetadataExpressions(Lcom/amazonaws/transform/StaxUnmarshallerContext;)V
 | |
| 
 | |
|     .line 13
 | |
|     iget-object v2, p0, Lcom/amazonaws/http/StaxResponseHandler;->responseUnmarshaller:Lcom/amazonaws/transform/Unmarshaller;
 | |
| 
 | |
|     invoke-interface {v2, v3}, Lcom/amazonaws/transform/Unmarshaller;->unmarshall(Ljava/lang/Object;)Ljava/lang/Object;
 | |
| 
 | |
|     move-result-object v2
 | |
| 
 | |
|     .line 14
 | |
|     invoke-virtual {v1, v2}, Lcom/amazonaws/AmazonWebServiceResponse;->setResult(Ljava/lang/Object;)V
 | |
| 
 | |
|     .line 15
 | |
|     invoke-virtual {v3}, Lcom/amazonaws/transform/StaxUnmarshallerContext;->getMetadata()Ljava/util/Map;
 | |
| 
 | |
|     move-result-object v2
 | |
| 
 | |
|     .line 16
 | |
|     invoke-virtual {p1}, Lcom/amazonaws/http/HttpResponse;->getHeaders()Ljava/util/Map;
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     if-eqz p1, :cond_1
 | |
| 
 | |
|     const-string v3, "x-amzn-RequestId"
 | |
| 
 | |
|     .line 17
 | |
|     invoke-interface {p1, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
 | |
| 
 | |
|     move-result-object v4
 | |
| 
 | |
|     if-eqz v4, :cond_1
 | |
| 
 | |
|     .line 18
 | |
|     invoke-interface {p1, v3}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     .line 19
 | |
|     invoke-interface {v2, v5, p1}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
 | |
| 
 | |
|     .line 20
 | |
|     :cond_1
 | |
|     new-instance p1, Lcom/amazonaws/ResponseMetadata;
 | |
| 
 | |
|     invoke-direct {p1, v2}, Lcom/amazonaws/ResponseMetadata;-><init>(Ljava/util/Map;)V
 | |
| 
 | |
|     invoke-virtual {v1, p1}, Lcom/amazonaws/AmazonWebServiceResponse;->setResponseMetadata(Lcom/amazonaws/ResponseMetadata;)V
 | |
| 
 | |
|     const-string p1, "Done parsing service response"
 | |
| 
 | |
|     .line 21
 | |
|     invoke-interface {v0, p1}, Lcom/amazonaws/logging/Log;->trace(Ljava/lang/Object;)V
 | |
| 
 | |
|     return-object v1
 | |
| .end method
 | |
| 
 | |
| .method public bridge synthetic handle(Lcom/amazonaws/http/HttpResponse;)Ljava/lang/Object;
 | |
|     .locals 0
 | |
|     .annotation system Ldalvik/annotation/Throws;
 | |
|         value = {
 | |
|             Ljava/lang/Exception;
 | |
|         }
 | |
|     .end annotation
 | |
| 
 | |
|     .line 1
 | |
|     invoke-virtual {p0, p1}, Lcom/amazonaws/http/StaxResponseHandler;->handle(Lcom/amazonaws/http/HttpResponse;)Lcom/amazonaws/AmazonWebServiceResponse;
 | |
| 
 | |
|     move-result-object p1
 | |
| 
 | |
|     return-object p1
 | |
| .end method
 | |
| 
 | |
| .method public needsConnectionLeftOpen()Z
 | |
|     .locals 1
 | |
| 
 | |
|     const/4 v0, 0x0
 | |
| 
 | |
|     return v0
 | |
| .end method
 | |
| 
 | |
| .method public registerAdditionalMetadataExpressions(Lcom/amazonaws/transform/StaxUnmarshallerContext;)V
 | |
|     .locals 0
 | |
| 
 | |
|     return-void
 | |
| .end method
 |