You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2020/09/25 17:17:30 UTC

[sling-org-apache-sling-scripting-core] branch master updated: SLING-9768 - The org.apache.sling.api.scripting.SlingScript#getScriptResource implementations should not leak the scripting resolver

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 714cc2d  SLING-9768 - The org.apache.sling.api.scripting.SlingScript#getScriptResource implementations should not leak the scripting resolver
714cc2d is described below

commit 714cc2dbf18670cb13ed6a5c9b1ac12800c73598
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Fri Sep 25 19:16:33 2020 +0200

    SLING-9768 - The org.apache.sling.api.scripting.SlingScript#getScriptResource implementations should not leak the scripting resolver
    
    * switched to the request resource resolver for the script resource
---
 .../sling/scripting/core/impl/bundled/ScriptContextProvider.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/scripting/core/impl/bundled/ScriptContextProvider.java b/src/main/java/org/apache/sling/scripting/core/impl/bundled/ScriptContextProvider.java
index 11428a6..79fbeb1 100644
--- a/src/main/java/org/apache/sling/scripting/core/impl/bundled/ScriptContextProvider.java
+++ b/src/main/java/org/apache/sling/scripting/core/impl/bundled/ScriptContextProvider.java
@@ -96,7 +96,8 @@ public class ScriptContextProvider {
         bindings.put(SlingBindings.OUT, response.getWriter());
         Logger scriptLogger = LoggerFactory.getLogger(executable.getName());
         bindings.put(SlingBindings.LOG, scriptLogger);
-        bindings.put(SlingBindings.SLING, new ScriptHelper(executable.getBundleContext(), new SlingScriptAdapter(scriptingResourceResolverProvider.getRequestScopedResourceResolver(), executable.getPath(), "sling/bundle/resource"), request, response));
+        bindings.put(SlingBindings.SLING, new ScriptHelper(executable.getBundleContext(), new SlingScriptAdapter(request.getResourceResolver(),
+                executable.getPath(), "sling/bundle/resource"), request, response));
         bindings.put(BundledRenderUnit.VARIABLE, executable);
         bindings.put(ScriptEngine.FILENAME, executable.getPath());
         bindings.put(ScriptEngine.FILENAME.replaceAll("\\.", "_"), executable.getPath());