Re: cvs commit:jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtimePageContextImpl.java
I'll go ahead and give watchdog a run with this change to verify if you haven't already. 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 ChangesPath 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.java6 Nov 2002 18:47:14 - 1.30 +++ PageContextImpl.java7 Nov 2002 00:49:53 - 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.
Re: cvs commit:jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtimePageContextImpl.java
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 ChangesPath 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.java6 Nov 2002 18:47:14 - 1.30 +++ PageContextImpl.java7 Nov 2002 00:49:53 - 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
Re: cvs commit:jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtimePageContextImpl.java
Jan, Think it would make more sense if the message was soemthing like Name or attribute value was null? On Mon, 2002-09-30 at 19:58, [EMAIL PROTECTED] wrote: luehe 2002/09/30 16:58:58 Modified:jasper2/src/share/org/apache/jasper/runtime PageContextImpl.java Log: Fixed 13140: Compliance issue - PageContext.setAttribute, under certain circumstances, fails to throw an NPE when the value provided is null Revision ChangesPath 1.23 +16 -3 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.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- PageContextImpl.java30 Sep 2002 23:45:03 - 1.22 +++ PageContextImpl.java30 Sep 2002 23:58:58 - 1.23 @@ -232,11 +232,16 @@ } public Object getAttribute(String name) { + + if (name == null) throw new NullPointerException(Null name); return attributes.get(name); } public Object getAttribute(String name, int scope) { + + if (name == null) throw new NullPointerException(Null name); + switch (scope) { case PAGE_SCOPE: return attributes.get(name); @@ -261,11 +266,19 @@ public void setAttribute(String name, Object attribute) { + + if (name == null || attribute == null) + throw new NullPointerException(Null name or attribute value); + attributes.put(name, attribute); } public void setAttribute(String name, Object o, int scope) { + + if (name == null || o == null) + throw new NullPointerException(Null name or attribute value); + switch (scope) { case PAGE_SCOPE: attributes.put(name, o); -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: cvs commit:jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtimePageContextImpl.java
Remy, I like this much better! No private API used, and cleaner generated codes! Some nitpicks! :-) See below. There seems to be no need for a JspxState object anymore. Jspx.State.tagCount is really not used, and JspxState.out can be make local. I should just comment that out for now. remm2002/06/10 20:35:35 Modified:jasper2/src/share/org/apache/jasper/compiler Generator.java jasper2/src/share/org/apache/jasper/runtime PageContextImpl.java Log: - Take advantage of the fact that the PageContext is pooled. - Modify the way the buffer reuse is done to conform with the PageContext contract (basically, the code moves from the generated servlet to PageContext). Index: Generator.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Gen erator.java,v +out.printil(javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();); +out.printil(_bc.clear();); +out.printil(out = _bc;); Can call to clear() be moved to pushBody()? Index: PageContextImpl.java === RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/Page ContextImpl.java,v +protected BodyContent[] outs = new BodyContentImpl[0]; Why not start the array with a small fixed size, say 5, to avoid all these copying. +protected int depth = -1; public BodyContent pushBody() { -JspWriter previous = out; -writerStack.push(out); -out = new BodyContentImpl(previous); -return (BodyContent) out; +depth++; +if (depth = outs.length) { +BodyContent[] newOuts = new BodyContentImpl[depth + 1]; +for (int i = 0; i outs.length; i++) { +newOuts[i] = outs[i]; +} +newOuts[depth] = new BodyContentImpl(out); +outs = newOuts; +} +out = outs[depth]; +return outs[depth]; } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]