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

radu pushed a commit to branch experimental-scripting-resolver
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly.git


The following commit(s) were added to 
refs/heads/experimental-scripting-resolver by this push:
     new f491640  updated code regarding classloader use to load script 
dependencies
f491640 is described below

commit f49164058cf2c81e5569a4849d60747c87c91f21
Author: Radu Cotescu <[email protected]>
AuthorDate: Mon Sep 24 18:04:02 2018 +0200

    updated code regarding classloader use to load script dependencies
---
 .../scripting/sightly/impl/engine/runtime/RenderContextImpl.java  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java
 
b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java
index 648c339..adb7e06 100644
--- 
a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java
+++ 
b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/runtime/RenderContextImpl.java
@@ -30,6 +30,8 @@ import 
org.apache.sling.scripting.sightly.impl.utils.BindingsUtils;
 import org.apache.sling.scripting.sightly.render.AbstractRuntimeObjectModel;
 import org.apache.sling.scripting.sightly.render.RenderContext;
 import org.apache.sling.scripting.sightly.render.RuntimeObjectModel;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.wiring.BundleWiring;
 
 /**
  * Rendering context for HTL rendering units.
@@ -43,10 +45,10 @@ public class RenderContextImpl implements RenderContext {
 
     public RenderContextImpl(ScriptContext scriptContext) {
         bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
-        ClassLoader classLoader = (ClassLoader) 
scriptContext.getAttribute("precompiled.bundle.classloader",
+        Bundle scriptProvidingBundle = (Bundle) 
scriptContext.getAttribute("org.apache.sling.scripting.resolver.provider.bundle",
                 SlingScriptConstants.SLING_SCOPE);
-        if (classLoader != null) {
-            
bindings.put("org.apache.sling.scripting.sightly.render_unit.loader", 
classLoader);
+        if (scriptProvidingBundle != null) {
+            
bindings.put("org.apache.sling.scripting.sightly.render_unit.loader", 
scriptProvidingBundle.adapt(BundleWiring.class).getClassLoader());
         }
         extensionRegistryService = 
BindingsUtils.getHelper(bindings).getService(ExtensionRegistryService.class);
     }

Reply via email to