Fix possible threading issue in JSP compilation when development mode is enabled

git-svn-id: https://svn.apache.org/repos/asf/tomcat/tc5.5.x/trunk@1158242 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/STATUS.txt b/STATUS.txt
index c3226cf..bb8cd96 100644
--- a/STATUS.txt
+++ b/STATUS.txt
@@ -31,12 +31,6 @@
   +1: kkolinko, markt
   -1:
 
-* Fix possible threading issue in JSP compilation when development mode is
-  enabled
-  http://svn.apache.org/viewvc?rev=1078409&view=rev
-  +1: markt, kfujino, kkolinko
-  -1:
-
 * Add additional configuration options to the DIGEST authenticator
   http://people.apache.org/~markt/patches/2011-04-01-digest-tc5.patch
   +1: markt
diff --git a/container/webapps/docs/changelog.xml b/container/webapps/docs/changelog.xml
index fbfa3ee..c6e24fe 100644
--- a/container/webapps/docs/changelog.xml
+++ b/container/webapps/docs/changelog.xml
@@ -83,6 +83,10 @@
         use any valid XML name) have a name which is not a Java identifier.
         (markt)
       </fix>
+      <fix>
+        Fix possible threading issue in JSP compilation when development mode is
+        enabled. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">
diff --git a/jasper/src/share/org/apache/jasper/servlet/JspServletWrapper.java b/jasper/src/share/org/apache/jasper/servlet/JspServletWrapper.java
index 816e119..5647364 100644
--- a/jasper/src/share/org/apache/jasper/servlet/JspServletWrapper.java
+++ b/jasper/src/share/org/apache/jasper/servlet/JspServletWrapper.java
@@ -279,6 +279,8 @@
                         boolean precompile)
 	    throws ServletException, IOException, FileNotFoundException {
         
+        Servlet servlet;
+
         try {
 
             if (ctxt.isRemoved()) {
@@ -318,7 +320,7 @@
             /*
              * (2) (Re)load servlet class file
              */
-            getServlet();
+            servlet = getServlet();
 
             // If a page is to be precompiled only, return.
             if (precompile) {
@@ -359,14 +361,14 @@
             /*
              * (3) Service request
              */
-            if (theServlet instanceof SingleThreadModel) {
+            if (servlet instanceof SingleThreadModel) {
                // sync on the wrapper so that the freshness
                // of the page is determined right before servicing
                synchronized (this) {
-                   theServlet.service(request, response);
+                   servlet.service(request, response);
                 }
             } else {
-                theServlet.service(request, response);
+                servlet.service(request, response);
             }
 
         } catch (UnavailableException ex) {