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

jsedding pushed a commit to branch 
jsedding/SLING-12420-avoid-unnecessary-JspRuntimeContext-renewal
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-jsp.git

commit f5832996229f2c5d40d980f867c93237fcbb626e
Author: Julian Sedding <(none)>
AuthorDate: Thu Sep 5 14:53:47 2024 +0200

    SLING-12420 - JSP scripts are falsely re-compiled on events from HTL engine
    
    - only handle changes under path /org/apache/jsp
---
 .../org/apache/sling/scripting/jsp/JspScriptEngineFactory.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java 
b/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
index 2b3fc8c..7aaa171 100644
--- a/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
+++ b/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
@@ -37,6 +37,7 @@ import 
org.apache.sling.api.resource.observation.ExternalResourceChangeListener;
 import org.apache.sling.api.resource.observation.ResourceChange;
 import org.apache.sling.api.resource.observation.ResourceChange.ChangeType;
 import org.apache.sling.api.resource.observation.ResourceChangeListener;
+import org.apache.sling.api.resource.path.Path;
 import org.apache.sling.api.scripting.SlingBindings;
 import org.apache.sling.api.scripting.SlingScriptHelper;
 import org.apache.sling.commons.classloader.ClassLoaderWriter;
@@ -658,8 +659,11 @@ public class JspScriptEngineFactory
        @Override
        public void onClassLoaderClear(String context) {
         final JspRuntimeContext rctxt = this.jspRuntimeContext;
-               if ( rctxt != null ) {
-            renewJspRuntimeContext();
+        if (rctxt != null && context != null) {
+            Path path = new Path(context);
+            if (path.matches("/org/apache/jsp")) {
+                renewJspRuntimeContext();
+            }
         }
        }
 }

Reply via email to