Bug 52384 - URL parameter without value should be parsed successfully when logging level = DEBUG
URL parameter without value should be parsed successfully when logging level ...
Product: Tomcat 6
Classification: Unclassified
Component: Catalina
PC Linux
: P2 normal (vote)
: default
Assigned To: Tomcat Developers Mailing List
Depends on:
  Show dependency tree
Reported: 2011-12-24 18:16 UTC by KDV
Modified: 2014-02-17 13:50 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description KDV 2011-12-24 18:16:23 UTC
Create a simple servlet with 

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

Start Tomcat under Eclipse, or force logging level for class org.apache.tomcat.util.http.Parameters to be "DEBUG"
Call the servlet with parameter which has no value set, e.g.


(so only the "parameterWithotValue" should be in the result of request.getParameterMap())

enjoy exception:

	at java.lang.System.arraycopy(Native Method)
	at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:334)
	at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:347)
	at org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:425)
	at org.apache.tomcat.util.http.Parameters.handleQueryParameters(Parameters.java:189)
	at org.apache.catalina.connector.Request.parseParameters(Request.java:2993)
	at org.apache.catalina.connector.Request.getParameterNames(Request.java:1185)
	at org.apache.catalina.connector.Request.getParameterMap(Request.java:1164)
	at org.apache.catalina.connector.RequestFacade.getParameterMap(RequestFacade.java:444)
	at ru.agapemoda.servlet.ImageServlet.doGet(ImageServlet.java:47)
	at java.lang.Thread.run(Thread.java:662)

Note: when logging level is "SEVERE", the troublesome code in org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:347) 

            if (log.isDebugEnabled()) {
                try {
                    origName.append(bytes, nameStart, nameEnd - nameStart);
                    origValue.append(bytes, valueStart, valueEnd - valueStart);
                } catch (IOException ioe) {
                    // Should never happen...
                    log.error(sm.getString("parameters.copyFail"), ioe);

is not executed and parameter is being parsed successfully. Should be parsed successfully with log level = "DEBUG" as well.
Comment 1 Konstantin Kolinko 2011-12-25 23:40:17 UTC
Fixed in 7.0 and will be in 7.0.24.

The issue also affects 6.0.35 and not yet released code in 5.5.x branch.
Proposed for 6.0 and 5.5.
Comment 2 Konstantin Kolinko 2012-01-06 14:15:27 UTC
Fixed in 5.5 with r1228191 and will be in 5.5.35.
Just noting that the issue was in not-yet-released code. It does not affect any released 5.5 versions.
Comment 3 Konstantin Kolinko 2012-01-09 04:54:29 UTC
Fixed in 6.0 with r1229027 and will be in 6.0.36.