dlmarion commented on code in PR #3682:
URL: https://github.com/apache/accumulo/pull/3682#discussion_r1290552570


##########
core/src/main/java/org/apache/accumulo/core/classloader/ClassLoaderUtil.java:
##########
@@ -75,13 +75,9 @@ static synchronized void resetContextFactoryForTests() {
 
   @SuppressWarnings("deprecation")
   public static ClassLoader getClassLoader(String context) {
-    try {
-      if (FACTORY.isValid(context)) {
-        return FACTORY.getClassLoader(context);
-      } else {
-        return 
org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.getClassLoader();
-      }
-    } catch (RuntimeException e) {
+    if (FACTORY != null && FACTORY.isValid(context)) {

Review Comment:
   `initContextFactory` is called by AbstractServer and Shell, and that sets 
`FACTORY`. The unit tests do not call `initContextFactory` and that is why I 
had to add the null check. In the original code, the context is not set so it 
returned `return 
org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader.getClassLoader();`
 In the code that was added in #3678 , the RuntimeException caught the 
NullPointerException and returned the same.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to