SLING-11298 : NullPointerException when processing exceptions
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 6ce4601..616c545 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
@@ -204,7 +204,7 @@
     }
 
     public Compiler getCompiler() {
-        return jspCompiler;
+        return createCompiler();
     }
 
     /** ---------- Access resources in the webapp ---------- */
@@ -524,15 +524,20 @@
 
     // ==================== Manipulating the class ====================
 
+    public String getClassName() {
+        String name;
+        if (isTagFile()) {
+            name = tagInfo.getTagClassName();
+        } else {
+            name = getServletPackageName() + "." + getServletClassName();
+        }
+        return name;
+    }
+
     public Class<?> load()
     throws JasperException {
         try {
-            String name;
-            if (isTagFile()) {
-                name = tagInfo.getTagClassName();
-            } else {
-                name = getServletPackageName() + "." + getServletClassName();
-            }
+            final String name = this.getClassName();
             final Class<?> servletClass = getClassLoader().loadClass(name);
             return servletClass;
         } catch (ClassNotFoundException cex) {
diff --git a/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java b/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
index 67f2268..2dc7480 100644
--- a/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
+++ b/src/main/java/org/apache/sling/scripting/jsp/jasper/servlet/JspServletWrapper.java
@@ -515,14 +515,14 @@
                 (HttpServletResponse.SC_SERVICE_UNAVAILABLE,
                  ex.getMessage());
             return;
+        } catch (final SlingException ex) {
+        	throw ex;
         } catch (final ServletException ex) {
             handleJspException(ex);
         } catch (final IOException ex) {
             handleJspException(ex);
         } catch (final IllegalStateException ex) {
             handleJspException(ex);
-        } catch (final SlingPageException ex) {
-        	throw ex;
         }catch (final Exception ex) {
             handleJspException(ex);
         }
@@ -635,7 +635,7 @@
             StackTraceElement jspFrame = null;
 
             for (int i=0; i<frames.length; ++i) {
-                if ( frames[i].getClassName().equals(this.theServlet.getClass().getName()) ) {
+                if ( frames[i].getClassName().equals(this.ctxt.getClassName()) ) {
                     jspFrame = frames[i];
                     break;
                 }
@@ -647,7 +647,7 @@
                 if ( ex instanceof ServletException ) {
                     return ex;
                 }
-                return new SlingException(ex) {};
+                return new SlingException(ex.getMessage(), ex);
             }
             int javaLineNumber = jspFrame.getLineNumber();
             JavacErrorDetail detail = ErrorDispatcher.createJavacError(