Author: markt
Date: Tue Jun 26 20:26:39 2012
New Revision: 1354208

URL: http://svn.apache.org/viewvc?rev=1354208&view=rev
Log:
Revert r1354200. As much as I'd like to be able to unilaterally change the JSP 
API, I can't.

Modified:
    tomcat/trunk/java/javax/servlet/jsp/PageContext.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java
    tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java
    tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java

Modified: tomcat/trunk/java/javax/servlet/jsp/PageContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/javax/servlet/jsp/PageContext.java?rev=1354208&r1=1354207&r2=1354208&view=diff
==============================================================================
--- tomcat/trunk/java/javax/servlet/jsp/PageContext.java (original)
+++ tomcat/trunk/java/javax/servlet/jsp/PageContext.java Tue Jun 26 20:26:39 
2012
@@ -216,6 +216,7 @@ public abstract class PageContext
      * @param autoFlush The value of the autoflush attribute from the page
      *     directive
      *
+     * @throws IOException during creation of JspWriter
      * @throws IllegalStateException if out not correctly initialized
      * @throws IllegalArgumentException If one of the given parameters
      *     is invalid
@@ -224,7 +225,7 @@ public abstract class PageContext
     public abstract void initialize(Servlet servlet, ServletRequest request,
         ServletResponse response, String errorPageURL, boolean needsSession,
         int bufferSize, boolean autoFlush)
-        throws IllegalStateException, IllegalArgumentException;
+        throws IOException, IllegalStateException, IllegalArgumentException;
 
     /**
      * <p>

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java?rev=1354208&r1=1354207&r2=1354208&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java 
(original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspContextWrapper.java Tue Jun 
26 20:26:39 2012
@@ -97,7 +97,7 @@ public class JspContextWrapper extends P
     public void initialize(Servlet servlet, ServletRequest request,
             ServletResponse response, String errorPageURL,
             boolean needsSession, int bufferSize, boolean autoFlush)
-            throws IllegalStateException, IllegalArgumentException {
+            throws IOException, IllegalStateException, 
IllegalArgumentException {
     }
 
     @Override

Modified: tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java?rev=1354208&r1=1354207&r2=1354208&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/JspFactoryImpl.java Tue Jun 26 
20:26:39 2012
@@ -29,6 +29,7 @@ import javax.servlet.jsp.JspFactory;
 import javax.servlet.jsp.PageContext;
 
 import org.apache.jasper.Constants;
+import org.apache.jasper.util.ExceptionUtils;
 import org.apache.juli.logging.Log;
 import org.apache.juli.logging.LogFactory;
 
@@ -93,24 +94,32 @@ public class JspFactoryImpl extends JspF
     private PageContext internalGetPageContext(Servlet servlet, ServletRequest 
request,
             ServletResponse response, String errorPageURL, boolean 
needsSession,
             int bufferSize, boolean autoflush) {
-
-        PageContext pc;
-        if (USE_POOL) {
-            PageContextPool pool = localPool.get();
-            if (pool == null) {
-                pool = new PageContextPool();
-                localPool.set(pool);
-            }
-            pc = pool.get();
-            if (pc == null) {
+        try {
+            PageContext pc;
+            if (USE_POOL) {
+                PageContextPool pool = localPool.get();
+                if (pool == null) {
+                    pool = new PageContextPool();
+                    localPool.set(pool);
+                }
+                pc = pool.get();
+                if (pc == null) {
+                    pc = new PageContextImpl();
+                }
+            } else {
                 pc = new PageContextImpl();
             }
-        } else {
-            pc = new PageContextImpl();
+            pc.initialize(servlet, request, response, errorPageURL,
+                    needsSession, bufferSize, autoflush);
+            return pc;
+        } catch (Throwable ex) {
+            ExceptionUtils.handleThrowable(ex);
+            if (ex instanceof RuntimeException) {
+                throw (RuntimeException) ex;
+            }
+            log.fatal("Exception initializing page context", ex);
+            return null;
         }
-        pc.initialize(servlet, request, response, errorPageURL,
-                needsSession, bufferSize, autoflush);
-        return pc;
     }
 
     private void internalReleasePageContext(PageContext pc) {

Modified: tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java?rev=1354208&r1=1354207&r2=1354208&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/runtime/PageContextImpl.java Tue Jun 26 
20:26:39 2012
@@ -119,6 +119,15 @@ public class PageContextImpl extends Pag
     @Override
     public void initialize(Servlet servlet, ServletRequest request,
             ServletResponse response, String errorPageURL,
+            boolean needsSession, int bufferSize, boolean autoFlush)
+            throws IOException {
+
+        _initialize(servlet, request, response, errorPageURL, needsSession,
+                bufferSize, autoFlush);
+    }
+
+    private void _initialize(Servlet servlet, ServletRequest request,
+            ServletResponse response, String errorPageURL,
             boolean needsSession, int bufferSize, boolean autoFlush) {
 
         // initialize state



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to