avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [avro] branch master updated: AVRO-2348: Remove use of Deprecated createJsonParser
Date Tue, 12 Mar 2019 18:43:11 GMT
This is an automated email from the ASF dual-hosted git repository.

dkulp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/avro.git


The following commit(s) were added to refs/heads/master by this push:
     new fb3c25f  AVRO-2348: Remove use of Deprecated createJsonParser
fb3c25f is described below

commit fb3c25f92baa17249219e263e0fe17568c67eadc
Author: Beluga Behr <dam6923@gmail.com>
AuthorDate: Mon Mar 11 16:42:30 2019 -0400

    AVRO-2348: Remove use of Deprecated createJsonParser
---
 lang/java/avro/src/main/java/org/apache/avro/Schema.java    | 7 ++-----
 lang/java/avro/src/main/java/org/apache/avro/data/Json.java | 6 +-----
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/lang/java/avro/src/main/java/org/apache/avro/Schema.java b/lang/java/avro/src/main/java/org/apache/avro/Schema.java
index b058c2a..06e5fca 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/Schema.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/Schema.java
@@ -20,7 +20,6 @@ package org.apache.avro;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.StringReader;
 import java.io.StringWriter;
 import java.util.Collection;
 import java.util.Collections;
@@ -1104,7 +1103,7 @@ public abstract class Schema extends JsonProperties {
      * If named, the schema is added to the names known to this parser. */
     public Schema parse(String s) {
       try {
-        return parse(FACTORY.createParser(new StringReader(s)));
+        return parse(FACTORY.createParser(s));
       } catch (IOException e) {
         throw new SchemaParseException(e);
       }
@@ -1489,9 +1488,7 @@ public abstract class Schema extends JsonProperties {
 
   static JsonNode parseJson(String s) {
     try {
-      return MAPPER.readTree(FACTORY.createParser(new StringReader(s)));
-    } catch (JsonParseException e) {
-      throw new RuntimeException(e);
+      return MAPPER.readTree(FACTORY.createParser(s));
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
diff --git a/lang/java/avro/src/main/java/org/apache/avro/data/Json.java b/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
index 0270e03..029a59b 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/data/Json.java
@@ -19,7 +19,6 @@ package org.apache.avro.data;
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.StringReader;
 import java.util.Iterator;
 
 import org.apache.avro.util.internal.JacksonUtils;
@@ -113,10 +112,7 @@ public class Json {
    */
   public static Object parseJson(String s) {
     try {
-      return JacksonUtils.toObject(MAPPER.readTree(FACTORY.createParser(
-          new StringReader(s))));
-    } catch (JsonParseException e) {
-      throw new RuntimeException(e);
+      return JacksonUtils.toObject(MAPPER.readTree(FACTORY.createParser(s)));
     } catch (IOException e) {
       throw new RuntimeException(e);
     }


Mime
View raw message