avro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bus...@apache.org
Subject [1/3] avro git commit: Revert "[fix] get/set defaults for fixed."
Date Tue, 28 Feb 2017 14:51:07 GMT
Repository: avro
Updated Branches:
  refs/heads/branch-1.8 9ae13913c -> bd457af36
  refs/heads/master 43297652d -> 37ce7f724


Revert "[fix] get/set defaults for fixed."

This reverts commit db6bb9d7a9f404e907d12a1380b65caac776b8a3.

Bad commit message.


Project: http://git-wip-us.apache.org/repos/asf/avro/repo
Commit: http://git-wip-us.apache.org/repos/asf/avro/commit/e06b4016
Tree: http://git-wip-us.apache.org/repos/asf/avro/tree/e06b4016
Diff: http://git-wip-us.apache.org/repos/asf/avro/diff/e06b4016

Branch: refs/heads/master
Commit: e06b40163584f46cb77ddf4a85002a5f1b45b9d5
Parents: 4329765
Author: Sean Busbey <busbey@apache.org>
Authored: Tue Feb 28 08:42:51 2017 -0600
Committer: Sean Busbey <busbey@apache.org>
Committed: Tue Feb 28 08:42:51 2017 -0600

----------------------------------------------------------------------
 .../main/java/org/apache/avro/SchemaBuilder.java |  4 ----
 .../apache/avro/util/internal/JacksonUtils.java  |  3 +--
 .../src/test/java/org/apache/avro/TestFixed.java | 19 -------------------
 3 files changed, 1 insertion(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/avro/blob/e06b4016/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java b/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java
index ce038d4..f1a1faa 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/SchemaBuilder.java
@@ -2587,10 +2587,6 @@ public class SchemaBuilder {
         s = new String(data, "ISO-8859-1");
         char[] quoted = JsonStringEncoder.getInstance().quoteAsString(s);
         s = "\"" + new String(quoted) + "\"";
-      } else if (o instanceof byte[]) {
-        s = new String((byte[]) o, "ISO-8859-1");
-        char[] quoted = JsonStringEncoder.getInstance().quoteAsString(s);
-        s = '\"' + new String(quoted) + '\"';
       } else {
         s = GenericData.get().toString(o);
       }

http://git-wip-us.apache.org/repos/asf/avro/blob/e06b4016/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java
b/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java
index 49b939e..ca98e4c 100644
--- a/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java
+++ b/lang/java/avro/src/main/java/org/apache/avro/util/internal/JacksonUtils.java
@@ -120,8 +120,7 @@ public class JacksonUtils {
       if (schema == null || schema.getType().equals(Schema.Type.STRING) ||
           schema.getType().equals(Schema.Type.ENUM)) {
         return jsonNode.asText();
-      } else if (schema.getType().equals(Schema.Type.BYTES)
-              || schema.getType().equals(Schema.Type.FIXED)) {
+      } else if (schema.getType().equals(Schema.Type.BYTES)) {
         try {
           return jsonNode.getTextValue().getBytes(BYTES_CHARSET);
         } catch (UnsupportedEncodingException e) {

http://git-wip-us.apache.org/repos/asf/avro/blob/e06b4016/lang/java/avro/src/test/java/org/apache/avro/TestFixed.java
----------------------------------------------------------------------
diff --git a/lang/java/avro/src/test/java/org/apache/avro/TestFixed.java b/lang/java/avro/src/test/java/org/apache/avro/TestFixed.java
deleted file mode 100644
index da0ab5f..0000000
--- a/lang/java/avro/src/test/java/org/apache/avro/TestFixed.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.apache.avro;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TestFixed {
-
-
-  @Test
-  public void testFixedDefaultValueDrop() {
-    Schema md5 = SchemaBuilder.builder().fixed("MD5").size(16);
-    Schema frec = SchemaBuilder.builder().record("test")
-            .fields().name("hash").type(md5).withDefault(new byte[16]).endRecord();
-    Schema.Field field = frec.getField("hash");
-    Assert.assertNotNull(field.defaultVal());
-    Assert.assertArrayEquals(new byte[16], (byte[]) field.defaultVal());
-  }
-
-}


Mime
View raw message