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:20:40 UTC
[sling-org-apache-sling-commons-compiler] 08/14: SLING-1459 : Make
references to class loader manager and class loader writer dynamic
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.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-compiler.git
commit fedaf7fccca6c2ef09af9ce3fba4afbd54079156
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Mar 24 08:01:33 2010 +0000
SLING-1459 : Make references to class loader manager and class loader writer dynamic
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/commons/compiler@926966 13f79535-47bb-0310-9956-ffa450edef68
---
.../sling/commons/compiler/impl/CompilationResultImpl.java | 7 +++++++
.../sling/commons/compiler/impl/EclipseJavaCompiler.java | 11 +++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/commons/compiler/impl/CompilationResultImpl.java b/src/main/java/org/apache/sling/commons/compiler/impl/CompilationResultImpl.java
index 83f2e58..83baef6 100644
--- a/src/main/java/org/apache/sling/commons/compiler/impl/CompilationResultImpl.java
+++ b/src/main/java/org/apache/sling/commons/compiler/impl/CompilationResultImpl.java
@@ -37,6 +37,13 @@ public class CompilationResultImpl implements CompilationResult {
private final ClassLoader classLoader;
+ public CompilationResultImpl(final String errorMessage) {
+ this.ignoreWarnings = true;
+ this.classLoader = null;
+ this.compilationRequired = false;
+ this.onError(errorMessage, "<General>", 0, 0);
+ }
+
public CompilationResultImpl(final ClassLoader classLoader) {
this.ignoreWarnings = true;
this.classLoader = classLoader;
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 641be1c..7893d9c 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
@@ -29,6 +29,7 @@ import java.util.Map;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.ReferencePolicy;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.commons.classloader.ClassLoaderWriter;
import org.apache.sling.commons.classloader.DynamicClassLoaderManager;
@@ -64,10 +65,10 @@ public class EclipseJavaCompiler implements JavaCompiler {
/** Logger instance */
private final Logger logger = LoggerFactory.getLogger(EclipseJavaCompiler.class);
- @Reference
+ @Reference(policy=ReferencePolicy.DYNAMIC)
private ClassLoaderWriter classLoaderWriter;
- @Reference
+ @Reference(policy=ReferencePolicy.DYNAMIC)
private DynamicClassLoaderManager dynamicClassLoaderManager;
private ClassLoader classLoader;
@@ -197,7 +198,13 @@ public class EclipseJavaCompiler implements JavaCompiler {
// get classloader and classloader writer
final ClassLoader loader = this.getClassLoader(options);
+ if ( loader == null ) {
+ return new CompilationResultImpl("Class loader for compilation is not available.");
+ }
final ClassLoaderWriter writer = this.getClassLoaderWriter(options);
+ if ( writer == null ) {
+ return new CompilationResultImpl("Class loader writer for compilation is not available.");
+ }
// check sources for compilation
boolean needsCompilation = isForceCompilation(options);
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.