hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ha...@apache.org
Subject hadoop git commit: HADOOP-11512. Use getTrimmedStrings when reading serialization keys. Contributed by Ryan P.
Date Tue, 10 Feb 2015 07:22:58 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 2b722b904 -> 442bc776d


HADOOP-11512. Use getTrimmedStrings when reading serialization keys. Contributed by Ryan P.


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

Branch: refs/heads/branch-2
Commit: 442bc776db7642eae02ee83231ecdbec78d3cb78
Parents: 2b722b9
Author: Harsh J <harsh@cloudera.com>
Authored: Mon Feb 9 11:10:45 2015 +0530
Committer: Harsh J <harsh@cloudera.com>
Committed: Tue Feb 10 12:52:41 2015 +0530

----------------------------------------------------------------------
 hadoop-common-project/hadoop-common/CHANGES.txt          |  3 +++
 .../hadoop/io/serializer/SerializationFactory.java       |  2 +-
 .../hadoop/io/serializer/TestSerializationFactory.java   | 11 +++++++++++
 3 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/442bc776/hadoop-common-project/hadoop-common/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index a61c349..fec5613 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -202,6 +202,9 @@ Release 2.7.0 - UNRELEASED
 
   BUG FIXES
 
+    HADOOP-11512. Use getTrimmedStrings when reading serialization keys
+    (Ryan P via harsh)
+
     HADOOP-11488. Difference in default connection timeout for S3A FS
     (Daisuke Kobayashi via harsh)
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/442bc776/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/SerializationFactory.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/SerializationFactory.java
b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/SerializationFactory.java
index 52a0a25..aa3c86a 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/SerializationFactory.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/serializer/SerializationFactory.java
@@ -55,7 +55,7 @@ public class SerializationFactory extends Configured {
    */
   public SerializationFactory(Configuration conf) {
     super(conf);
-    for (String serializerName : conf.getStrings(
+    for (String serializerName : conf.getTrimmedStrings(
       CommonConfigurationKeys.IO_SERIALIZATIONS_KEY,
       new String[]{WritableSerialization.class.getName(),
         AvroSpecificSerialization.class.getName(),

http://git-wip-us.apache.org/repos/asf/hadoop/blob/442bc776/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/TestSerializationFactory.java
----------------------------------------------------------------------
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/TestSerializationFactory.java
b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/TestSerializationFactory.java
index 18c2637..b3c8bee 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/TestSerializationFactory.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/serializer/TestSerializationFactory.java
@@ -17,6 +17,8 @@
  */
 package org.apache.hadoop.io.serializer;
 
+import org.apache.hadoop.io.LongWritable;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
 import org.junit.Test;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertNotNull;
@@ -41,4 +43,13 @@ public class TestSerializationFactory {
     assertNull("A null should be returned if there are no deserializers found",
         factory.getDeserializer(TestSerializationFactory.class));
   }
+
+  @Test
+  public void testSerializationKeyIsTrimmed() {
+    Configuration conf = new Configuration();
+    conf.set(CommonConfigurationKeys.IO_SERIALIZATIONS_KEY, " org.apache.hadoop.io.serializer.WritableSerialization
");
+    SerializationFactory factory = new SerializationFactory(conf);
+    assertNotNull("Valid class must be returned",
+      factory.getSerializer(LongWritable.class));
+   }
 }


Mime
View raw message