Anuj PB created IO-728:
--------------------------
Summary: IOUtils.copy throws NPE while setting MimeHeaders
Key: IO-728
URL: https://issues.apache.org/jira/browse/IO-728
Project: Commons IO
Issue Type: Bug
Components: Utilities
Affects Versions: 2.5
Environment: Java Version: 1.8
Spring version: 4.3.11.RELEASE
Spring boot version: 2.0.5.RELEASE
Jersey version: 2.16
Reporter: Anuj PB
Attachments: StackTrace
I have a Spring Boot Microservice and I am using IOUtils.copy(InputStream,
OutputStream) which sporadically throws NPE while setting MimeHeaders as shown
below:
2021-03-18 18:14:05.081 ERROR [http-nio-80-exec-8]
o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet
[dispatcherServlet] threw exception2021-03-18 18:14:05.081 ERROR
[http-nio-80-exec-8] o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service()
for servlet [dispatcherServlet] threw exception
java.lang.NullPointerException: null at
org.apache.tomcat.util.http.MimeHeaders.setValue(MimeHeaders.java:318) at
org.apache.coyote.http11.Http11Processor.prepareResponse(Http11Processor.java:1285)
at org.apache.coyote.AbstractProcessor.action(AbstractProcessor.java:374) at
org.apache.coyote.Response.action(Response.java:206) at
org.apache.coyote.http11.Http11OutputBuffer.doWrite(Http11OutputBuffer.java:219)
at org.apache.coyote.Response.doWrite(Response.java:602) at
org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:352)
at
org.apache.catalina.connector.OutputBuffer.flushByteBuffer(OutputBuffer.java:833)
at org.apache.catalina.connector.OutputBuffer.append(OutputBuffer.java:738) at
org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:399) at
org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:377) at
org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:96)
at
org.springframework.security.web.util.OnCommittedResponseWrapper$SaveContextServletOutputStream.write(OnCommittedResponseWrapper.java:639)
at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2147) at
org.apache.commons.io.IOUtils.copy(IOUtils.java:2102) at
org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2123) at
org.apache.commons.io.IOUtils.copy(IOUtils.java:2078)
I have attached the complete stack trace in the attachment and also provided
the environment where this appears.
I feel that there is some issue with the Commons IO lib and would like to know
if this can be fixed.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)