HADOOP-9216. CompressionCodecFactory#getCodecClasses should trim the result of parsing by Configuration. Contributed by Tsuyoshi Ozawa.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1434569 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2013-01-17 07:19:41 +00:00
parent e322e0a05f
commit db17fadd38
3 changed files with 16 additions and 1 deletions

View File

@ -444,6 +444,9 @@ Release 2.0.3-alpha - Unreleased
HADOOP-9106. Allow configuration of IPC connect timeout.
(Rober Parker via suresh)
HADOOP-9216. CompressionCodecFactory#getCodecClasses should trim the
result of parsing by Configuration. (Tsuyoshi Ozawa via todd)
OPTIMIZATIONS
HADOOP-8866. SampleQuantiles#query is O(N^2) instead of O(N). (Andrew Wang

View File

@ -122,7 +122,7 @@ public class CompressionCodecFactory {
if (codecsString != null) {
StringTokenizer codecSplit = new StringTokenizer(codecsString, ",");
while (codecSplit.hasMoreElements()) {
String codecSubstring = codecSplit.nextToken();
String codecSubstring = codecSplit.nextToken().trim();
if (codecSubstring.length() != 0) {
try {
Class<?> cls = conf.getClassByName(codecSubstring);

View File

@ -256,5 +256,17 @@ public class TestCodecFactory extends TestCase {
checkCodec("overridden factory for .gz", NewGzipCodec.class, codec);
codec = factory.getCodecByClassName(NewGzipCodec.class.getCanonicalName());
checkCodec("overridden factory for gzip codec", NewGzipCodec.class, codec);
Configuration conf = new Configuration();
conf.set("io.compression.codecs",
" org.apache.hadoop.io.compress.GzipCodec , " +
" org.apache.hadoop.io.compress.DefaultCodec , " +
" org.apache.hadoop.io.compress.BZip2Codec ");
try {
CompressionCodecFactory.getCodecClasses(conf);
} catch (IllegalArgumentException e) {
fail("IllegalArgumentException is unexpected");
}
}
}