Hi Costin,
I'm still seeing failures with Watchdog's positiveErrorPageTest test.
Is this working for you in your env. using a simple test case to make
sure the error page works?
-rl
On Wed, 2002-11-06 at 19:49, [EMAIL PROTECTED] wrote:
> costin 2002/11/06 16:49:53
>
> Modified: jasper2/src/share/org/apache/jasper/runtime
> PageContextImpl.java
> Log:
> Second attempt.
>
> Restore the flushBuffer and clean the error.
>
> I added a quick test for new exception - if they are different
> it most likely means an error in the error page - and servlet
> error handiling should take care of it.
>
> Whatever we set is cleaned up. Probably we should restore with what
> was before - but I'm not sure.
>
> Revision Changes Path
> 1.31 +46 -30
>jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java
>
> Index: PageContextImpl.java
> ===================================================================
> RCS file:
>/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/PageContextImpl.java,v
> retrieving revision 1.30
> retrieving revision 1.31
> diff -u -r1.30 -r1.31
> --- PageContextImpl.java 6 Nov 2002 18:47:14 -0000 1.30
> +++ PageContextImpl.java 7 Nov 2002 00:49:53 -0000 1.31
> @@ -105,31 +105,31 @@
> * @author Pierre Delisle
> * @author Mark Roth
> */
> -public class PageContextImpl
> - extends PageContext
> +public class PageContextImpl
> + extends PageContext
> implements VariableResolver
> {
>
> Logger.Helper loghelper = new Logger.Helper("JASPER_LOG", "PageContextImpl");
> -
> +
> /**
> * The expression evaluator, for evaluating EL expressions.
> */
> private ExpressionEvaluatorImpl expressionEvaluator = null;
> -
> +
> /**
> * The variable resolver, for evaluating EL expressions.
> */
> private static JSTLVariableResolver variableResolver =
> new JSTLVariableResolver();
> -
> +
> /**
> * Expression evaluator for proprietary EL evaluation.
> * XXX - This should be going away once the EL evaluator moves from
> * the JSTL implementation to its own project.
> */
> private static org.apache.jasper.runtime.el.jstl.Evaluator
> - proprietaryEvaluator = new
> + proprietaryEvaluator = new
> org.apache.jasper.runtime.el.jstl.Evaluator();
>
> PageContextImpl(JspFactory factory) {
> @@ -197,9 +197,9 @@
> setAttribute(CONFIG, config);
> setAttribute(PAGECONTEXT, this);
> setAttribute(APPLICATION, context);
> -
> +
> isIncluded = request.getAttribute(
> - "javax.servlet.include.servlet_path") != null;
> + "javax.servlet.include.servlet_path") != null;
> }
>
> public void release() {
> @@ -207,18 +207,19 @@
> try {
> if (isIncluded) {
> ((JspWriterImpl)out).flushBuffer();
> - // push it into the including jspWriter
> + // push it into the including jspWriter
> } else {
> // Old code:
> - out.flush();
> + //out.flush();
> // Do not flush the buffer even if we're not included (i.e.
> // we are the main page. The servlet will flush it and close
> // the stream.
> - //((JspWriterImpl)out).flushBuffer();
> - }
> + ((JspWriterImpl)out).flushBuffer();
> + }
> } catch (IOException ex) {
> loghelper.log("Internal error flushing the buffer in release()");
> }
> +
> servlet = null;
> config = null;
> context = null;
> @@ -231,7 +232,7 @@
> depth = -1;
> baseOut.recycle();
> session = null;
> -
> +
> attributes.clear();
> }
>
> @@ -451,7 +452,7 @@
> true);
> }
>
> - public void include(String relativeUrlPath, boolean flush)
> + public void include(String relativeUrlPath, boolean flush)
> throws ServletException, IOException {
>
> JspRuntimeLibrary.include((HttpServletRequest) request,
> @@ -482,7 +483,7 @@
> }
>
> String path = getAbsolutePathRelativeToContext(relativeUrlPath);
> - String includeUri
> + String includeUri
> = (String) request.getAttribute(Constants.INC_SERVLET_PATH);
> if (includeUri != null)
> request.removeAttribute(Constants.INC_SERVLET_PATH);
> @@ -537,15 +538,15 @@
> public ExpressionEvaluator getExpressionEvaluator() {
> if( this.expressionEvaluator == null ) {
> this.expressionEvaluator = new ExpressionEvaluatorImpl( this );
> - // no need to synchronize - not a big deal even if we create
> + // no need to synchronize - not a big deal even if we create
> // two of these.
> }
> -
> +
> return this.expressionEvaluator;
> }
>
> public void handlePageException(Exception ex)
> - throws IOException, ServletException
> + throws IOException, ServletException
> {
> // Should never be called since handleException() called with a
> // Throwable in the generated servlet.
> @@ -553,7 +554,7 @@
> }
>
> public void handlePageException(Throwable t)
> - throws IOException, ServletException
> + throws IOException, ServletException
> {
> if (t == null) throw new NullPointerException("null Throwable");
>
> @@ -563,9 +564,11 @@
> // Do not set the javax.servlet.error.exception attribute here
> // (instead, set in the generated servlet code for the error page)
> // in order to prevent the ErrorReportValve, which is invoked as
> - // part of forwarding the request to the error page, from
> + // part of forwarding the request to the error page, from
> // throwing it if the response has not been committed (the response
> // will have been committed if the error page is a JSP page).
> + Object
>origException=request.getAttribute("javax.servlet.error.exception");
> +
> request.setAttribute("javax.servlet.jsp.jspException", t);
> request.setAttribute("javax.servlet.error.status_code",
> new Integer(HttpServletResponse.SC_INTERNAL_SERVER_ERROR));
> @@ -578,6 +581,19 @@
> } catch (IllegalStateException ise) {
> include(errorPageURL);
> }
> + // The error page could be inside an include.
> +
> + Object
>newException=request.getAttribute("javax.servlet.error.exception");
> +
> + if( (newException!= null) && (newException==origException) ) {
> + request.removeAttribute("javax.servlet.error.exception");
> + }
> +
> + // now clear the error code - to prevent double handling.
> + request.removeAttribute("javax.servlet.error.status_code");
> + request.removeAttribute("javax.servlet.error.request_uri");
> + request.removeAttribute("javax.servlet.error.status_code");
> + request.removeAttribute("javax.servlet.jsp.jspException");
>
> } else {
> // Otherwise throw the exception wrapped inside a ServletException.
> @@ -601,19 +617,19 @@
> /**
> * VariableResolver interface
> */
> - public Object resolveVariable( String pName, Object pContext )
> + public Object resolveVariable( String pName, Object pContext )
> throws ELException
> {
> // Note: pContext will be going away.
> try {
> - return PageContextImpl.variableResolver.resolveVariable(
> + return PageContextImpl.variableResolver.resolveVariable(
> pName, this );
> }
> catch( org.apache.jasper.runtime.el.jstl.ELException e ) {
> throw new ELException( e );
> }
> }
> -
> +
> /**
> * Proprietary method to evaluate EL expressions.
> * XXX - This method should go away once the EL interpreter moves
> @@ -627,16 +643,16 @@
> * @param defaultPrefix Default prefix for this evaluation
> * @return The result of the evaluation
> */
> - public static Object proprietaryEvaluate( String expression,
> + public static Object proprietaryEvaluate( String expression,
> Class expectedType, PageContext pageContext,
> ProtectedFunctionMapper functionMap, String defaultPrefix )
> throws ELException
> {
> java.util.HashMap funcMap =
> (functionMap == null)? null: functionMap.getFnMap();
> -
> +
> try {
> - return PageContextImpl.proprietaryEvaluator.evaluate( "<unknown>",
> + return PageContextImpl.proprietaryEvaluator.evaluate( "<unknown>",
> expression, expectedType, null, pageContext,
> funcMap, defaultPrefix );
> }
> @@ -654,7 +670,7 @@
> return null;
> }
> }
> -
> +
> /*
> * fields
> */
>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>
--
Ryan Lubke <[EMAIL PROTECTED]>
Sun Microsystems, Inc.
--
To unsubscribe, e-mail: <mailto:tomcat-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@;jakarta.apache.org>