JsonParser.smali 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. .class public final Lcom/google/gson/JsonParser;
  2. .super Ljava/lang/Object;
  3. .source ""
  4. # direct methods
  5. .method public constructor <init>()V
  6. .locals 0
  7. invoke-direct {p0}, Ljava/lang/Object;-><init>()V
  8. return-void
  9. .end method
  10. # virtual methods
  11. .method public parse(Lcom/google/gson/stream/JsonReader;)Lcom/google/gson/JsonElement;
  12. .locals 6
  13. .annotation system Ldalvik/annotation/Throws;
  14. value = {
  15. Lcom/google/gson/JsonIOException;,
  16. Lcom/google/gson/JsonSyntaxException;
  17. }
  18. .end annotation
  19. const-string v0, " to Json"
  20. const-string v1, "Failed parsing JSON source: "
  21. invoke-virtual {p1}, Lcom/google/gson/stream/JsonReader;->isLenient()Z
  22. move-result v2
  23. const/4 v3, 0x1
  24. invoke-virtual {p1, v3}, Lcom/google/gson/stream/JsonReader;->setLenient(Z)V
  25. :try_start_0
  26. invoke-static {p1}, Lcom/google/gson/internal/Streams;->parse(Lcom/google/gson/stream/JsonReader;)Lcom/google/gson/JsonElement;
  27. move-result-object v0
  28. :try_end_0
  29. .catch Ljava/lang/StackOverflowError; {:try_start_0 .. :try_end_0} :catch_1
  30. .catch Ljava/lang/OutOfMemoryError; {:try_start_0 .. :try_end_0} :catch_0
  31. .catchall {:try_start_0 .. :try_end_0} :catchall_0
  32. invoke-virtual {p1, v2}, Lcom/google/gson/stream/JsonReader;->setLenient(Z)V
  33. return-object v0
  34. :catchall_0
  35. move-exception v0
  36. goto :goto_0
  37. :catch_0
  38. move-exception v3
  39. :try_start_1
  40. new-instance v4, Lcom/google/gson/JsonParseException;
  41. new-instance v5, Ljava/lang/StringBuilder;
  42. invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
  43. invoke-virtual {v5, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  44. invoke-virtual {v5, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  45. invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  46. invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  47. move-result-object v0
  48. invoke-direct {v4, v0, v3}, Lcom/google/gson/JsonParseException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
  49. throw v4
  50. :catch_1
  51. move-exception v3
  52. new-instance v4, Lcom/google/gson/JsonParseException;
  53. new-instance v5, Ljava/lang/StringBuilder;
  54. invoke-direct {v5}, Ljava/lang/StringBuilder;-><init>()V
  55. invoke-virtual {v5, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  56. invoke-virtual {v5, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
  57. invoke-virtual {v5, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
  58. invoke-virtual {v5}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
  59. move-result-object v0
  60. invoke-direct {v4, v0, v3}, Lcom/google/gson/JsonParseException;-><init>(Ljava/lang/String;Ljava/lang/Throwable;)V
  61. throw v4
  62. :try_end_1
  63. .catchall {:try_start_1 .. :try_end_1} :catchall_0
  64. :goto_0
  65. invoke-virtual {p1, v2}, Lcom/google/gson/stream/JsonReader;->setLenient(Z)V
  66. throw v0
  67. .end method
  68. .method public parse(Ljava/io/Reader;)Lcom/google/gson/JsonElement;
  69. .locals 2
  70. .annotation system Ldalvik/annotation/Throws;
  71. value = {
  72. Lcom/google/gson/JsonIOException;,
  73. Lcom/google/gson/JsonSyntaxException;
  74. }
  75. .end annotation
  76. :try_start_0
  77. new-instance v0, Lcom/google/gson/stream/JsonReader;
  78. invoke-direct {v0, p1}, Lcom/google/gson/stream/JsonReader;-><init>(Ljava/io/Reader;)V
  79. invoke-virtual {p0, v0}, Lcom/google/gson/JsonParser;->parse(Lcom/google/gson/stream/JsonReader;)Lcom/google/gson/JsonElement;
  80. move-result-object p1
  81. invoke-virtual {p1}, Lcom/google/gson/JsonElement;->isJsonNull()Z
  82. move-result v1
  83. if-nez v1, :cond_1
  84. invoke-virtual {v0}, Lcom/google/gson/stream/JsonReader;->peek()Lcom/google/gson/stream/JsonToken;
  85. move-result-object v0
  86. sget-object v1, Lcom/google/gson/stream/JsonToken;->END_DOCUMENT:Lcom/google/gson/stream/JsonToken;
  87. if-ne v0, v1, :cond_0
  88. goto :goto_0
  89. :cond_0
  90. new-instance p1, Lcom/google/gson/JsonSyntaxException;
  91. const-string v0, "Did not consume the entire document."
  92. invoke-direct {p1, v0}, Lcom/google/gson/JsonSyntaxException;-><init>(Ljava/lang/String;)V
  93. throw p1
  94. :try_end_0
  95. .catch Lcom/google/gson/stream/MalformedJsonException; {:try_start_0 .. :try_end_0} :catch_2
  96. .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_1
  97. .catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0
  98. :cond_1
  99. :goto_0
  100. return-object p1
  101. :catch_0
  102. move-exception p1
  103. new-instance v0, Lcom/google/gson/JsonSyntaxException;
  104. invoke-direct {v0, p1}, Lcom/google/gson/JsonSyntaxException;-><init>(Ljava/lang/Throwable;)V
  105. throw v0
  106. :catch_1
  107. move-exception p1
  108. new-instance v0, Lcom/google/gson/JsonIOException;
  109. invoke-direct {v0, p1}, Lcom/google/gson/JsonIOException;-><init>(Ljava/lang/Throwable;)V
  110. throw v0
  111. :catch_2
  112. move-exception p1
  113. new-instance v0, Lcom/google/gson/JsonSyntaxException;
  114. invoke-direct {v0, p1}, Lcom/google/gson/JsonSyntaxException;-><init>(Ljava/lang/Throwable;)V
  115. throw v0
  116. .end method
  117. .method public parse(Ljava/lang/String;)Lcom/google/gson/JsonElement;
  118. .locals 1
  119. .annotation system Ldalvik/annotation/Throws;
  120. value = {
  121. Lcom/google/gson/JsonSyntaxException;
  122. }
  123. .end annotation
  124. new-instance v0, Ljava/io/StringReader;
  125. invoke-direct {v0, p1}, Ljava/io/StringReader;-><init>(Ljava/lang/String;)V
  126. invoke-virtual {p0, v0}, Lcom/google/gson/JsonParser;->parse(Ljava/io/Reader;)Lcom/google/gson/JsonElement;
  127. move-result-object p1
  128. return-object p1
  129. .end method