You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by si...@apache.org on 2018/03/05 04:51:06 UTC

[bookkeeper] branch master updated: Fix AbstractLedgerManagerFactory on handling both shaded class and original class co-exists case

This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e51b81  Fix AbstractLedgerManagerFactory on handling both shaded class and original class co-exists case
3e51b81 is described below

commit 3e51b8116c363604f93bdd0c6b6b71ef3387c8a8
Author: Sijie Guo <si...@apache.org>
AuthorDate: Sun Mar 4 20:50:58 2018 -0800

    Fix AbstractLedgerManagerFactory on handling both shaded class and original class co-exists case
    
    Descriptions of the changes in this PR:
    
    *Problem*
    
    #1217 addresses the issue when using a shaded class accessing a bookkeeper cluster.  However the assumption was made when the classpath only has shaded classes. However, it didn't address the case when shaded class and original class can co-exist. because IOException is thrown instead of ClassNotFoundException at following code:
    
    ```
                    Class<?> theCls = Class.forName(layout.getManagerFactoryClass());
                    if (!LedgerManagerFactory.class.isAssignableFrom(theCls)) {
                        throw new IOException("Wrong ledger manager factory " + layout.getManagerFactoryClass());
                    }
    ```
    
    *Solution*
    
    This change fixes the issue.
    
    Author: Sijie Guo <si...@apache.org>
    
    Reviewers: Jia Zhai <None>, Matteo Merli <mm...@apache.org>
    
    This closes #1227 from sijie/debug_issue
---
 .../org/apache/bookkeeper/meta/AbstractZkLedgerManagerFactory.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManagerFactory.java b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManagerFactory.java
index 4fa2546..5600dfa 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManagerFactory.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/AbstractZkLedgerManagerFactory.java
@@ -199,11 +199,11 @@ public abstract class AbstractZkLedgerManagerFactory implements LedgerManagerFac
                     throw new IOException("Wrong ledger manager factory " + layout.getManagerFactoryClass());
                 }
                 factoryClass = theCls.asSubclass(LedgerManagerFactory.class);
-            } catch (ClassNotFoundException cnfe) {
+            } catch (ClassNotFoundException | IOException e) {
                 factoryClass = attemptToResolveShadedLedgerManagerFactory(
                     conf,
                     layout.getManagerFactoryClass(),
-                    cnfe);
+                    e);
             }
         }
         // instantiate a factory

-- 
To stop receiving notification emails like this one, please contact
sijie@apache.org.