Fix bug 42072. Don't call destroy() if init() fails. Patch provided by Kawasima Kazuh.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 9 Apr 2007 23:31:09 +0000 (23:31 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Mon, 9 Apr 2007 23:31:09 +0000 (23:31 +0000)
Ported from TC5.5

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@526953 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/jasper/servlet/JspServletWrapper.java
webapps/docs/changelog.xml

index 9055be3..feb02b5 100644 (file)
@@ -138,13 +138,15 @@ public class JspServletWrapper {
                     // 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 @@ public class JspServletWrapper {
                         throw new JasperException(e);
                     }
                     
-                    theServlet.init(config);
+                    servlet.init(config);
 
                     if (!firstTime) {
                         ctxt.getRuntimeContext().incrementJspReloadCount();
                     }
 
+                    theServlet = servlet;
                     reload = false;
                 }
             }    
index 45d8075..ce4a5e0 100644 (file)
       <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>