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/branches/branch-2@1434570 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Todd Lipcon 2013-01-17 07:19:45 +00:00
parent f596c9b629
commit 7b5b90599f
3 changed files with 16 additions and 1 deletions

View File

@ -126,6 +126,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 static List<Class<? extends CompressionCodec>> getCodecClasses(Configurat
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 static void testFinding() {
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");
}
}
}