You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/01/15 04:34:23 UTC

[Bug 56010] New: JspFactory.getPageContext with JspWriter.DEFAULT_BUFFER throws IllegalArgumentException

https://issues.apache.org/bugzilla/show_bug.cgi?id=56010

            Bug ID: 56010
           Summary: JspFactory.getPageContext with
                    JspWriter.DEFAULT_BUFFER throws
                    IllegalArgumentException
           Product: Tomcat 7
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
          Assignee: dev@tomcat.apache.org
          Reporter: bluewolf.chung@gmail.com

When a servlet calls JspFactory.getPageContext() with JspWriter.DEFAULT_BUFFER,
Tomcat Japser throws IllegalArgumentException.

PageContext pageContext = JspFactory.getDefaultFactory().getPageContext(this,
req, resp, null, false, JspWriter.DEFAULT_BUFFER, true);


java.lang.IllegalArgumentException: Buffer size <= 0
    org.apache.jasper.runtime.JspWriterImpl.<init>(JspWriterImpl.java:81)
   
org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:154)
   
org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:125)
   
org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:112)
   
org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:65)
   
dvt.jsp.jaspertest.JspFactoryTestServlet.doGet(JspFactoryTestServlet.java:21)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:728)



Based on the description of JspFactory.getPageContext(), if buffer size is
JspWriter.DEFAULT_BUFFER(-1), PageContext must treat it as implementation
default, which in case is
org.apache.jasper.Constants#DEFAULT_BUFFER_SIZE(8192).


buffer - size of buffer in bytes, JspWriter.NO_BUFFER if no buffer,
JspWriter.DEFAULT_BUFFER if implementation default.

from
http://docs.oracle.com/javaee/7/api/javax/servlet/jsp/JspFactory.html#getPageContext(javax.servlet.Servlet,
javax.servlet.ServletRequest, javax.servlet.ServletResponse, java.lang.String,
boolean, int, boolean)


Note that -Dorg.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false should be
specified.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 56010] JspFactory.getPageContext with JspWriter.DEFAULT_BUFFER throws IllegalArgumentException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56010

--- Comment #3 from Konstantin Kolinko <kn...@gmail.com> ---
As far as I am reading, such value can only be used when calling the
JspFactory.getPageContext() API directly. The buffer size that can be used in
JSP configurations (in a page directive or in jsp-property-group) is either
"none" (0) or is measured in kilobytes. (ch. JSP.1.10.1, JSP.3.3.10)

But I agree that this feature is a part of the API.

Proposed for 6.0.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 56010] JspFactory.getPageContext with JspWriter.DEFAULT_BUFFER throws IllegalArgumentException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56010

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Mark Thomas <ma...@apache.org> ---
Thanks for the report and the suggested fix.

I have committed the fix to 8.0.x along with a test case and it will be
included in 8.0.0 onwards.

The same change has been applied to 7.0.x and it will be included in 7.0.51
onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 56010] JspFactory.getPageContext with JspWriter.DEFAULT_BUFFER throws IllegalArgumentException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56010

--- Comment #1 from Eugene Chung (TmaxSoft) <bl...@gmail.com> ---
Created attachment 31206
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31206&action=edit
Test Source

I suggest that org.apache.jasper.runtime.PageContextImpl needs to check if
buffer size is JspWriter.DEFAULT_BUFFER and adjust it to default.

org.apache.jasper.runtime.PageContextImpl#initialize(..)


        if (bufferSize == JspWriter.DEFAULT_BUFFER) {
            bufferSize = Constants.DEFAULT_BUFFER_SIZE;
        }
        if (this.baseOut == null) {
            this.baseOut = new JspWriterImpl(response, bufferSize, autoFlush);
        } else {
            this.baseOut.init(response, bufferSize, autoFlush);
        }

-- 
You are receiving this mail because:
You are the assignee for the bug.

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


[Bug 56010] JspFactory.getPageContext with JspWriter.DEFAULT_BUFFER throws IllegalArgumentException

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=56010

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
Fixed in 6.0.x for 6.0.40 onwards.

-- 
You are receiving this mail because:
You are the assignee for the bug.

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