hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jxi...@apache.org
Subject svn commit: r1471755 - in /hbase/branches/0.95: hbase-common/src/main/java/org/apache/hadoop/hbase/util/ hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/
Date Wed, 24 Apr 2013 22:50:50 GMT
Author: jxiang
Date: Wed Apr 24 22:50:50 2013
New Revision: 1471755

URL: http://svn.apache.org/r1471755
Log:
HBASE-8383 Support lib/*jar inside coprocessor jar

Modified:
    hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ClassLoaderBase.java
    hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java
    hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java

Modified: hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ClassLoaderBase.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ClassLoaderBase.java?rev=1471755&r1=1471754&r2=1471755&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ClassLoaderBase.java
(original)
+++ hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ClassLoaderBase.java
Wed Apr 24 22:50:50 2013
@@ -51,7 +51,6 @@ public class ClassLoaderBase extends URL
    * Creates a DynamicClassLoader that can load classes dynamically
    * from jar files under a specific folder.
    *
-   * @param conf the configuration for the cluster.
    * @param parent the parent ClassLoader to set.
    */
   public ClassLoaderBase(final ClassLoader parent) {

Modified: hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java?rev=1471755&r1=1471754&r2=1471755&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java
(original)
+++ hbase/branches/0.95/hbase-common/src/main/java/org/apache/hadoop/hbase/util/CoprocessorClassLoader.java
Wed Apr 24 22:50:50 2013
@@ -158,7 +158,7 @@ public class CoprocessorClassLoader exte
       Enumeration<JarEntry> entries = jarFile.entries();
       while (entries.hasMoreElements()) {
         JarEntry entry = entries.nextElement();
-        if (entry.getName().matches("/lib/[^/]+\\.jar")) {
+        if (entry.getName().matches("[/]?lib/[^/]+\\.jar")) {
           File file = new File(parentDir, "." + pathPrefix + "." + path.getName()
             + "." + System.currentTimeMillis() + "." + entry.getName().substring(5));
           IOUtils.copyBytes(jarFile.getInputStream(entry), new FileOutputStream(file), conf,
true);

Modified: hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java?rev=1471755&r1=1471754&r2=1471755&view=diff
==============================================================================
--- hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
(original)
+++ hbase/branches/0.95/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestClassLoading.java
Wed Apr 24 22:50:50 2013
@@ -382,6 +382,15 @@ public class TestClassLoading {
 
   @Test
   public void testClassLoadingFromLibDirInJar() throws Exception {
+    loadingClassFromLibDirInJar("/lib/");
+  }
+
+  @Test
+  public void testClassLoadingFromRelativeLibDirInJar() throws Exception {
+    loadingClassFromLibDirInJar("lib/");
+  }
+
+  void loadingClassFromLibDirInJar(String libPrefix) throws Exception {
     FileSystem fs = cluster.getFileSystem();
 
     File innerJarFile1 = buildCoprocessorJar(cpName1);
@@ -397,7 +406,7 @@ public class TestClassLoading {
 
     for (File jarFile: new File[] { innerJarFile1, innerJarFile2 }) {
       // Add archive entry
-      JarEntry jarAdd = new JarEntry("/lib/" + jarFile.getName());
+      JarEntry jarAdd = new JarEntry(libPrefix + jarFile.getName());
       jarAdd.setTime(jarFile.lastModified());
       out.putNextEntry(jarAdd);
 



Mime
View raw message