Author: markt
Date: Mon Apr  9 16:31:09 2007
New Revision: 526953

URL: http://svn.apache.org/viewvc?view=rev&rev=526953
Log:
Fix bug 42072. Don't call destroy() if init() fails. Patch provided by Kawasima 
Kazuh.
Ported from TC5.5
Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java?view=diff&rev=526953&r1=526952&r2=526953
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JspServletWrapper.java 
Mon Apr  9 16:31:09 2007
@@ -138,13 +138,15 @@
                     // This is to maintain the original protocol.
                     destroy();
                     
+                    Servlet servlet = null;
+                    
                     try {
                         servletClass = ctxt.load();
-                        theServlet = (Servlet) servletClass.newInstance();
+                        servlet = (Servlet) servletClass.newInstance();
                         AnnotationProcessor annotationProcessor = 
(AnnotationProcessor) 
config.getServletContext().getAttribute(AnnotationProcessor.class.getName());
                         if (annotationProcessor != null) {
-                           annotationProcessor.processAnnotations(theServlet);
-                           annotationProcessor.postConstruct(theServlet);
+                           annotationProcessor.processAnnotations(servlet);
+                           annotationProcessor.postConstruct(servlet);
                         }
                     } catch (IllegalAccessException e) {
                         throw new JasperException(e);
@@ -154,12 +156,13 @@
                         throw new JasperException(e);
                     }
                     
-                    theServlet.init(config);
+                    servlet.init(config);
 
                     if (!firstTime) {
                         ctxt.getRuntimeContext().incrementJspReloadCount();
                     }
 
+                    theServlet = servlet;
                     reload = false;
                 }
             }    

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?view=diff&rev=526953&r1=526952&r2=526953
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Mon Apr  9 16:31:09 2007
@@ -190,6 +190,10 @@
       <fix>
         Skip BOM when reading a JSP file. (remm)
       </fix>
+      <fix>
+        <bug>42072</bug> Don't call destroy() if the associated init() fails.
+        Patch provided by Kawasima Kazuh. (markt)
+      </fix>
     </changelog>
   </subsection>
 </section>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to