You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/02/11 10:50:22 UTC

svn commit: r620446 - /incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java

Author: fmeschbe
Date: Mon Feb 11 01:50:20 2008
New Revision: 620446

URL: http://svn.apache.org/viewvc?rev=620446&view=rev
Log:
Remove JspApplicationContextImpl from the servlet context when the
JspScriptEngineFactory is deactivated. Otherwise a ClassCastException
may be caused after this factory is recreated because the class loader
of the JspApplicationContextImpl class object is different from the
one stored in the servlet context

Modified:
    incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java

Modified: incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java?rev=620446&r1=620445&r2=620446&view=diff
==============================================================================
--- incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java (original)
+++ incubator/sling/trunk/scripting/jsp/src/main/java/org/apache/sling/scripting/jsp/JspScriptEngineFactory.java Mon Feb 11 01:50:20 2008
@@ -40,13 +40,14 @@
 import org.apache.sling.scripting.jsp.jasper.JasperException;
 import org.apache.sling.scripting.jsp.jasper.Options;
 import org.apache.sling.scripting.jsp.jasper.compiler.JspRuntimeContext;
+import org.apache.sling.scripting.jsp.jasper.runtime.JspApplicationContextImpl;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 /**
  * The JSP engine (a.k.a Jasper).
- *
+ * 
  * @scr.component scr="no" label="%jsphandler.name"
  *                description="%jsphandler.description"
  * @scr.property name="service.description" value="JSP Script Handler"
@@ -231,6 +232,12 @@
 
         ioProvider = null;
         componentContext = null;
+
+        // remove JspApplicationContextImpl from the servlet context, otherwise
+        // a ClassCastException may be caused after this component is recreated
+        // because the class loader of the JspApplicationContextImpl class
+        // object is different from the one stored in the servlet context
+        slingServletContext.removeAttribute(JspApplicationContextImpl.class.getName());
     }
 
     protected void bindRepositoryClassLoaderProvider(