HBASE-11259 Compression.java different compressions load system classpath differently causing errors (Enoch Hsu)

This commit is contained in:
Andrew Purtell 2014-05-29 18:39:44 -07:00
parent 8c7772488c
commit 8c14c7b5bb
1 changed files with 2 additions and 4 deletions

View File

@ -123,8 +123,7 @@ public final class Compression {
private CompressionCodec buildCodec(Configuration conf) { private CompressionCodec buildCodec(Configuration conf) {
try { try {
Class<?> externalCodec = Class<?> externalCodec =
ClassLoader.getSystemClassLoader() getClassLoaderForCodec().loadClass("com.hadoop.compression.lzo.LzoCodec");
.loadClass("com.hadoop.compression.lzo.LzoCodec");
return (CompressionCodec) ReflectionUtils.newInstance(externalCodec, return (CompressionCodec) ReflectionUtils.newInstance(externalCodec,
new Configuration(conf)); new Configuration(conf));
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
@ -208,8 +207,7 @@ public final class Compression {
private CompressionCodec buildCodec(Configuration conf) { private CompressionCodec buildCodec(Configuration conf) {
try { try {
Class<?> externalCodec = Class<?> externalCodec =
ClassLoader.getSystemClassLoader() getClassLoaderForCodec().loadClass("org.apache.hadoop.io.compress.SnappyCodec");
.loadClass("org.apache.hadoop.io.compress.SnappyCodec");
return (CompressionCodec) ReflectionUtils.newInstance(externalCodec, return (CompressionCodec) ReflectionUtils.newInstance(externalCodec,
conf); conf);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {