https://bz.apache.org/bugzilla/show_bug.cgi?id=65921
Bug ID: 65921
Summary: Null pointer exception if RewriteRule attempt to set
mime type
Product: Tomcat 9
Version: 9.0.55
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Catalina
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: -----
A rewrite rule like:
RewriteRule ^/path/.*$ - [T=text/xml]
fails with a NullPointerException because the contentTypeMB field in the
Request object has not initialized. Request.setContentType should initialize
contentTypeMB, or the rewrite valve should call getContentType first. The
former is preferable in case there is no content type in the request.
This always happens with the HTTP/1.1 connector. With the AJP connector the
exeception occurs if the request does not contain a Content-Type header.
Backtrace:
java.lang.NullPointerException: Cannot invoke
"org.apache.tomcat.util.buf.MessageBytes.setString(String)" because
"this.contentTypeMB" is null
at org.apache.coyote.Request.setContentType(Request.java:465)
at
org.apache.catalina.connector.Request.setContentType(Request.java:1057)
at
org.apache.catalina.valves.rewrite.RewriteValve.invoke(RewriteValve.java:448)
at
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:359)
at
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399)
at
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:889)
at
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1735)
at
org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at
org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
at
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:833)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]