From: markt Date: Mon, 9 Apr 2007 23:31:09 +0000 (+0000) Subject: Fix bug 42072. Don't call destroy() if init() fails. Patch provided by Kawasima Kazuh. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=b74683d389161818fff9b00506c0af1f25d2de33;p=tomcat7.0 Fix bug 42072. Don't call destroy() if init() fails. Patch provided by Kawasima Kazuh. Ported from TC5.5 git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk@526953 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/jasper/servlet/JspServletWrapper.java b/java/org/apache/jasper/servlet/JspServletWrapper.java index 9055be368..feb02b5e3 100644 --- a/java/org/apache/jasper/servlet/JspServletWrapper.java +++ b/java/org/apache/jasper/servlet/JspServletWrapper.java @@ -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; } } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 45d80750a..ce4a5e091 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -190,6 +190,10 @@ Skip BOM when reading a JSP file. (remm) + + 42072 Don't call destroy() if the associated init() fails. + Patch provided by Kawasima Kazuh. (markt) +