Mantis - Resin
Viewing Issue Advanced Details
1874 crash always 07-13-07 02:47 07-27-07 09:35
Leos  
ferg  
normal  
closed 3.0.23  
fixed  
none    
none 3.1.3  
0001874: ServletRequest.getInputStream() throws java.io.UnsupportedEncodingException
I am trying to get the http request body by calling getInputStream() on HttpServletRequest. I want the raw binary data, as http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/ServletRequest.html#getInputStream() [^] promises. However, when the HTTP client sets the charset to some incorrect value (by sending the HTTP header Content-Type with ;charset=something), I get java.io.UnsupportedEncodingException. I believe that this is a violation of the above mentioned interface description from Sun. It says "Retrieves the body of the request as binary data" and does not allow throwing java.io.UnsupportedEncodingException. If I would like to handle the body as text (not as raw binary data) with the correct encoding, I would use getReader() instead.
java.io.UnsupportedEncodingException: CP-1250
        at sun.io.Converters.getConverterClass(Converters.java:218)
        at sun.io.Converters.newConverter(Converters.java:251)
        at sun.io.ByteToCharConverter.getConverter(ByteToCharConverter.java:68)
        at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:224)
        at sun.nio.cs.StreamDecoder$ConverterSD.<init>(StreamDecoder.java:210)
        at sun.nio.cs.StreamDecoder.forInputStreamReader(StreamDecoder.java:77)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:83)
        at com.caucho.vfs.i18n.JDKReader.create(JDKReader.java:68)
        at com.caucho.vfs.Encoding.getReadEncoding(Encoding.java:157)
        at com.caucho.vfs.ReadStream.setEncoding(ReadStream.java:456)
        at com.caucho.server.connection.AbstractHttpRequest.getStream(AbstractHttpRequest.java:1764)
        at com.caucho.server.connection.AbstractHttpRequest.getInputStream(AbstractHttpRequest.java:1823)

Notes
(0002114)
Leos   
07-13-07 06:22   
It might be important to note that this happens inside filter.
(0002151)
ferg   
07-27-07 09:35   
server/1b23