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

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


The following commit(s) were added to refs/heads/master by this push:
     new 87797bf  SLING-11299 : JSP source/linenumber is not always shown when 
an exception occurs
87797bf is described below

commit 87797bffced40758926ab94df16e6b0148c526a2
Author: Carsten Ziegeler <[email protected]>
AuthorDate: Fri May 6 11:01:37 2022 +0200

    SLING-11299 : JSP source/linenumber is not always shown when an exception 
occurs
---
 .../jsp/jasper/JspCompilationContext.java          | 58 ++++++++++++----------
 1 file changed, 31 insertions(+), 27 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java
 
b/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java
index 437ecbf..1ac5dca 100644
--- 
a/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java
+++ 
b/src/main/java/org/apache/sling/scripting/jsp/jasper/JspCompilationContext.java
@@ -53,31 +53,31 @@ import 
org.apache.sling.scripting.jsp.jasper.compiler.ServletWriter;
  */
 public class JspCompilationContext {
 
-    private Map<String, URL> tagFileJarUrls;
-
-    private String className;
-    private String jspUri;
-    private boolean isErrPage;
-    private String basePackageName;
-    private String derivedPackageName;
-    private String servletJavaFileName;
-    private String javaPath;
-    private String classFileName;
-    private String contentType;
-    private ServletWriter writer;
-    private Options options;
-    private Compiler jspCompiler;
-
-    private String baseURI;
-    private String outputDir;
-    private ServletContext context;
-
-    private JspRuntimeContext rctxt;
-
-    private boolean isTagFile;
-    private boolean protoTypeMode;
-    private TagInfo tagInfo;
-    private URL tagFileJarUrl;
+    private final Map<String, URL> tagFileJarUrls;
+
+    private volatile String className;
+    private final String jspUri;
+    private volatile boolean isErrPage;
+    private final String basePackageName;
+    private volatile String derivedPackageName;
+    private volatile String servletJavaFileName;
+    private volatile String javaPath;
+    private volatile String classFileName;
+    private volatile String contentType;
+    private volatile ServletWriter writer;
+    private final Options options;
+    private volatile Compiler jspCompiler;
+
+    private volatile String baseURI;
+    private volatile String outputDir;
+    private final ServletContext context;
+
+    private final JspRuntimeContext rctxt;
+
+    private volatile boolean isTagFile;
+    private volatile boolean protoTypeMode;
+    private volatile TagInfo tagInfo;
+    private volatile URL tagFileJarUrl;
 
     private final boolean defaultIsSession;
 
@@ -209,8 +209,12 @@ public class JspCompilationContext {
 
     public Compiler activateCompiler() {
         if ( jspCompiler == null ) {
-            // create compile and compile
-            this.compile(); // we ignore the exception
+            synchronized ( this ) {
+                if ( jspCompiler == null ) {
+                    // create compile and compile
+                    this.compile(); // we ignore the exception
+                }
+            }
         }
         return jspCompiler;
     }

Reply via email to