https://bz.apache.org/bugzilla/show_bug.cgi?id=58411

            Bug ID: 58411
           Summary: CoyoteWriter throws StringIndexOutOfBoundsException
                    when concurrently printing lines
           Product: Tomcat 8
           Version: 8.0.26
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: sdav...@gmail.com

I am currently opening multiple InputStreams and attempting to use println send
data through the Servlet's PrintWriter, unfortunately this sends back a
StringIndexOutOfBoundsException: String index out of range: -49
   at java.lang.String.getChars(String.java:812)
   at org.apache.tomcat.util.buf.CharChunk.append(CharChunk.java:333)
   at org.apache.catalina.connector.OuputBuffer.write(OuputBuffer.java:533)
   at org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:170)
   at org.apache.catalina.connector.CoyoteWriter.write(CoyoteWriter.java:180)
   at org.apache.catalina.connector.CoyoteWriter.print(CoyoteWriter.java:238)
   at org.apache.catalina.connector.CoyoteWriter.println(CoyoteWriter.java:305)

Using PrintWriter's printf or format methods work properly since the
CoyoteWriter doesn't override those methods and the appropriate synchronized
blocks are enforced, unlike the print overrides which specifically removed the
synchronized blocks. I would suggest removing the unnecessary overrides, it
looks like the PrintWriter handles everything the CoyoteWriter is doing. I
checked the history on the 8.x branch for the file and there isn't a reason why
the class was ever needed in the first place.

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

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

Reply via email to