.class public final Lcom/google/gson/JsonParser; .super Ljava/lang/Object; .source "JsonParser.java" # direct methods .method public constructor ()V .locals 0 .prologue invoke-direct {p0}, Ljava/lang/Object;->()V return-void .end method # virtual methods .method public parse(Lcom/google/gson/stream/JsonReader;)Lcom/google/gson/JsonElement; .locals 5 .param p1, "json" # Lcom/google/gson/stream/JsonReader; .annotation system Ldalvik/annotation/Throws; value = { Lcom/google/gson/JsonIOException;, Lcom/google/gson/JsonSyntaxException; } .end annotation .prologue invoke-virtual {p1}, Lcom/google/gson/stream/JsonReader;->isLenient()Z move-result v1 .local v1, "lenient":Z const/4 v2, 0x1 invoke-virtual {p1, v2}, Lcom/google/gson/stream/JsonReader;->setLenient(Z)V :try_start_0 invoke-static {p1}, Lcom/google/gson/internal/Streams;->parse(Lcom/google/gson/stream/JsonReader;)Lcom/google/gson/JsonElement; :try_end_0 .catch Ljava/lang/StackOverflowError; {:try_start_0 .. :try_end_0} :catch_0 .catch Ljava/lang/OutOfMemoryError; {:try_start_0 .. :try_end_0} :catch_1 .catchall {:try_start_0 .. :try_end_0} :catchall_0 move-result-object v2 invoke-virtual {p1, v1}, Lcom/google/gson/stream/JsonReader;->setLenient(Z)V return-object v2 :catch_0 move-exception v0 .local v0, "e":Ljava/lang/StackOverflowError; :try_start_1 new-instance v2, Lcom/google/gson/JsonParseException; new-instance v3, Ljava/lang/StringBuilder; invoke-direct {v3}, Ljava/lang/StringBuilder;->()V const-string v4, "Failed parsing JSON source: " invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v3 invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v3 const-string v4, " to Json" invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v3 invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v3 invoke-direct {v2, v3, v0}, Lcom/google/gson/JsonParseException;->(Ljava/lang/String;Ljava/lang/Throwable;)V throw v2 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .end local v0 # "e":Ljava/lang/StackOverflowError; :catchall_0 move-exception v2 invoke-virtual {p1, v1}, Lcom/google/gson/stream/JsonReader;->setLenient(Z)V throw v2 :catch_1 move-exception v0 .local v0, "e":Ljava/lang/OutOfMemoryError; :try_start_2 new-instance v2, Lcom/google/gson/JsonParseException; new-instance v3, Ljava/lang/StringBuilder; invoke-direct {v3}, Ljava/lang/StringBuilder;->()V const-string v4, "Failed parsing JSON source: " invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v3 invoke-virtual {v3, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; move-result-object v3 const-string v4, " to Json" invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; move-result-object v3 invoke-virtual {v3}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; move-result-object v3 invoke-direct {v2, v3, v0}, Lcom/google/gson/JsonParseException;->(Ljava/lang/String;Ljava/lang/Throwable;)V throw v2 :try_end_2 .catchall {:try_start_2 .. :try_end_2} :catchall_0 .end method .method public parse(Ljava/io/Reader;)Lcom/google/gson/JsonElement; .locals 5 .param p1, "json" # Ljava/io/Reader; .annotation system Ldalvik/annotation/Throws; value = { Lcom/google/gson/JsonIOException;, Lcom/google/gson/JsonSyntaxException; } .end annotation .prologue :try_start_0 new-instance v2, Lcom/google/gson/stream/JsonReader; invoke-direct {v2, p1}, Lcom/google/gson/stream/JsonReader;->(Ljava/io/Reader;)V .local v2, "jsonReader":Lcom/google/gson/stream/JsonReader; invoke-virtual {p0, v2}, Lcom/google/gson/JsonParser;->parse(Lcom/google/gson/stream/JsonReader;)Lcom/google/gson/JsonElement; move-result-object v1 .local v1, "element":Lcom/google/gson/JsonElement; invoke-virtual {v1}, Lcom/google/gson/JsonElement;->isJsonNull()Z move-result v3 if-nez v3, :cond_0 invoke-virtual {v2}, Lcom/google/gson/stream/JsonReader;->peek()Lcom/google/gson/stream/JsonToken; move-result-object v3 sget-object v4, Lcom/google/gson/stream/JsonToken;->END_DOCUMENT:Lcom/google/gson/stream/JsonToken; if-eq v3, v4, :cond_0 new-instance v3, Lcom/google/gson/JsonSyntaxException; const-string v4, "Did not consume the entire document." invoke-direct {v3, v4}, Lcom/google/gson/JsonSyntaxException;->(Ljava/lang/String;)V throw v3 :try_end_0 .catch Lcom/google/gson/stream/MalformedJsonException; {:try_start_0 .. :try_end_0} :catch_0 .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1 .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_2 .end local v1 # "element":Lcom/google/gson/JsonElement; .end local v2 # "jsonReader":Lcom/google/gson/stream/JsonReader; :catch_0 move-exception v0 .local v0, "e":Lcom/google/gson/stream/MalformedJsonException; new-instance v3, Lcom/google/gson/JsonSyntaxException; invoke-direct {v3, v0}, Lcom/google/gson/JsonSyntaxException;->(Ljava/lang/Throwable;)V throw v3 .end local v0 # "e":Lcom/google/gson/stream/MalformedJsonException; :catch_1 move-exception v0 .local v0, "e":Ljava/io/IOException; new-instance v3, Lcom/google/gson/JsonIOException; invoke-direct {v3, v0}, Lcom/google/gson/JsonIOException;->(Ljava/lang/Throwable;)V throw v3 .end local v0 # "e":Ljava/io/IOException; :catch_2 move-exception v0 .local v0, "e":Ljava/lang/NumberFormatException; new-instance v3, Lcom/google/gson/JsonSyntaxException; invoke-direct {v3, v0}, Lcom/google/gson/JsonSyntaxException;->(Ljava/lang/Throwable;)V throw v3 .end local v0 # "e":Ljava/lang/NumberFormatException; .restart local v1 # "element":Lcom/google/gson/JsonElement; .restart local v2 # "jsonReader":Lcom/google/gson/stream/JsonReader; :cond_0 return-object v1 .end method .method public parse(Ljava/lang/String;)Lcom/google/gson/JsonElement; .locals 1 .param p1, "json" # Ljava/lang/String; .annotation system Ldalvik/annotation/Throws; value = { Lcom/google/gson/JsonSyntaxException; } .end annotation .prologue new-instance v0, Ljava/io/StringReader; invoke-direct {v0, p1}, Ljava/io/StringReader;->(Ljava/lang/String;)V invoke-virtual {p0, v0}, Lcom/google/gson/JsonParser;->parse(Ljava/io/Reader;)Lcom/google/gson/JsonElement; move-result-object v0 return-object v0 .end method