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 95a3f2f  SLING-9352 - Remove search patch restriction from the 
ScriptCacheImpl
95a3f2f is described below

commit 95a3f2f0dc7dd0322b7735d9589380ea65ded235
Author: Radu Cotescu <[email protected]>
AuthorDate: Thu Apr 9 18:36:39 2020 +0200

    SLING-9352 - Remove search patch restriction from the ScriptCacheImpl
    
    * removed search path filtering for the keys
    * made sure the script cache is now cleared also when detecting a
    ScriptEngineManager change
---
 .../sling/scripting/core/impl/ScriptCacheImpl.java | 23 ++++------------------
 1 file changed, 4 insertions(+), 19 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/scripting/core/impl/ScriptCacheImpl.java 
b/src/main/java/org/apache/sling/scripting/core/impl/ScriptCacheImpl.java
index 67f5882..c78cef9 100644
--- a/src/main/java/org/apache/sling/scripting/core/impl/ScriptCacheImpl.java
+++ b/src/main/java/org/apache/sling/scripting/core/impl/ScriptCacheImpl.java
@@ -129,14 +129,9 @@ public class ScriptCacheImpl implements ScriptCache, 
ResourceChangeListener, Ext
     public void putScript(CachedScript script) {
         writeLock.lock();
         try {
-            for (String searchPath : searchPaths) {
-                if (script.getScriptPath().startsWith(searchPath)) {
-                    SoftReference<CachedScript> reference = new 
SoftReference<>(script);
-                    internalMap.put(script.getScriptPath(), reference);
-                    LOGGER.debug("Added script {} to script cache.", 
script.getScriptPath());
-                    break;
-                }
-            }
+            SoftReference<CachedScript> reference = new 
SoftReference<>(script);
+            internalMap.put(script.getScriptPath(), reference);
+            LOGGER.debug("Added script {} to script cache.", 
script.getScriptPath());
         } finally {
             writeLock.unlock();
         }
@@ -222,17 +217,6 @@ public class ScriptCacheImpl implements ScriptCache, 
ResourceChangeListener, Ext
             newMap.putAll(internalMap);
             internalMap = newMap;
         }
-        ResourceResolver resolver = null;
-        try {
-            resolver = rrf.getServiceResourceResolver(null);
-            searchPaths = resolver.getSearchPath();
-        } catch (LoginException e) {
-            LOGGER.error("Unable to retrieve a ResourceResolver for 
determining the search paths.", e);
-        } finally {
-            if (resolver != null) {
-                resolver.close();
-            }
-        }
         active = true;
         configureCache();
     }
@@ -293,6 +277,7 @@ public class ScriptCacheImpl implements ScriptCache, 
ResourceChangeListener, Ext
 
     @Override
     public void handleEvent(Event event) {
+        clear();
         extensions.clear();
         for (ScriptEngineFactory factory :  
slingScriptEngineManager.getEngineFactories()) {
             ScriptEngine scriptEngine = factory.getScriptEngine();

Reply via email to