You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:21:17 UTC

[sling-org-apache-sling-commons-compiler] 06/08: SLING-2677 : Compilation should work with no provided class loader

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

rombert pushed a commit to annotated tag org.apache.sling.commons.compiler-2.1.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-compiler.git

commit cd7556b04e2b675cb183e610c00465e03f75b19a
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Mon Nov 26 12:10:26 2012 +0000

    SLING-2677 :  Compilation should work with no provided class loader
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/commons/compiler@1413570 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/sling/commons/compiler/impl/EclipseJavaCompiler.java  | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java b/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
index 76dda71..8e7f0f7 100644
--- a/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
+++ b/src/main/java/org/apache/sling/commons/compiler/impl/EclipseJavaCompiler.java
@@ -83,17 +83,24 @@ public class EclipseJavaCompiler implements JavaCompiler {
         } else if ( options.get(Options.KEY_ADDITIONAL_CLASS_LOADER) != null ) {
             final ClassLoader additionalClassLoader = (ClassLoader)options.get(Options.KEY_ADDITIONAL_CLASS_LOADER);
             loader = new ClassLoader(classLoaderWriter.getClassLoader()) {
+                @Override
                 protected Class<?> findClass(String name)
                 throws ClassNotFoundException {
                     return additionalClassLoader.loadClass(name);
                 }
 
+                @Override
                 protected URL findResource(String name) {
                     return additionalClassLoader.getResource(name);
                 }
             };
         } else {
-            loader = classLoaderWriter.getClassLoader();
+            final ClassLoader cl = classLoaderWriter.getClassLoader();
+            if ( cl == null ) {
+                loader = this.classLoaderWriter.getClassLoader();
+            } else {
+                loader = cl;
+            }
         }
         return loader;
     }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.