tyrus
                                
                                 tyrus copied to clipboard
                                
                                    tyrus copied to clipboard
                            
                            
                            
                        java.nio.BufferUnderflowException when receiving gzipped Inputstream
Hello,
We have an application that connects to Tomcat for receiving and sending request. I have moved from receiving and sending to InputStream from ByteBuffer. I discovered that Tyrus have problem receiving Gzipped Inputstream. I find it also strange that the exception is generated in ByteBuffer class when im working with streams. I can receive gzipped streams in Tomcat without problem and it works without gzip.
java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Unknown Source)
at java.nio.HeapByteBuffer.get(Unknown Source)
at org.glassfish.tyrus.core.InputStreamBuffer.getNextByte(InputStreamBuffer.java:130)
at org.glassfish.tyrus.core.BufferedInputStream.read(BufferedInputStream.java:66)
at java.io.InputStream.read(Unknown Source)
at java.util.zip.InflaterInputStream.fill(Unknown Source)
at java.util.zip.InflaterInputStream.read(Unknown Source)
at java.util.zip.GZIPInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.read(Unknown Source)
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.
----------------------------For sending from Tomcat:
WsPayLoad payl = new WsPayLoad();
try (ObjectOutputStream ous = new ObjectOutputStream(new GZIPOutputStream(sess.getBasicRemote().getSendStream()))
{ ous.writeObject(payl); ous.flush(); }
----------------------For receiving on Tyrus client: @Override public void handleMessage(InputStream ins)
{ ObjectInputStream in = new ObjectInputStream( new GZIPInputStream(ins);); WsPayLoad obj = in.readObject();//Exception thrown here }
Environment
Windows
Affected Versions
[1.12]
- Issue Imported From: https://github.com/tyrus-project/tyrus/issues/600
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @pavelbucek
@glassfishrobot Commented Reported by hugolarson
@glassfishrobot Commented This issue was imported from java.net JIRA TYRUS-423