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

This commit is contained in:
Harsh J 2015-02-09 10:41:25 +05:30
parent b73956fdad
commit e0ec0718d0
3 changed files with 14 additions and 1 deletions

View File

@ -588,6 +588,9 @@ Release 2.7.0 - UNRELEASED
BUG FIXES BUG FIXES
HADOOP-11512. Use getTrimmedStrings when reading serialization keys
(Ryan P via harsh)
HADOOP-11488. Difference in default connection timeout for S3A FS HADOOP-11488. Difference in default connection timeout for S3A FS
(Daisuke Kobayashi via harsh) (Daisuke Kobayashi via harsh)

View File

@ -60,7 +60,7 @@ public SerializationFactory(Configuration conf) {
+ CommonConfigurationKeys.IO_SERIALIZATIONS_KEY + CommonConfigurationKeys.IO_SERIALIZATIONS_KEY
+ " properly to have serialization support (it is currently not set)."); + " properly to have serialization support (it is currently not set).");
} else { } else {
for (String serializerName : conf.getStrings( for (String serializerName : conf.getTrimmedStrings(
CommonConfigurationKeys.IO_SERIALIZATIONS_KEY, new String[] { CommonConfigurationKeys.IO_SERIALIZATIONS_KEY, new String[] {
WritableSerialization.class.getName(), WritableSerialization.class.getName(),
AvroSpecificSerialization.class.getName(), AvroSpecificSerialization.class.getName(),

View File

@ -17,6 +17,7 @@
*/ */
package org.apache.hadoop.io.serializer; package org.apache.hadoop.io.serializer;
import org.apache.hadoop.io.LongWritable;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
import static org.junit.Assert.assertNull; import static org.junit.Assert.assertNull;
@ -76,4 +77,13 @@ public void testGetDeserializer() {
assertNull("A null should be returned if there are no deserializers found", assertNull("A null should be returned if there are no deserializers found",
factory.getDeserializer(TestSerializationFactory.class)); 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));
}
} }