Ok, JDK Bug  http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6519463

The workaround is to simply ignore (!) the EOFException...

WDYT ?

phil

---------- Forwarded message ----------
From: Philippe Van Dyck <pvdyck@gmail.com>
Date: Fri, Apr 16, 2010 at 10:52 AM
Subject: Fwd: Bug : read after end of stream @ AbstractMarshaller
To: infinispan -Dev List <infinispan-dev@lists.jboss.org>


Ok, I took a closer look.
Actually, it is related to HTTPCORE-199, and this bug is fixed.
What about using int len = inputStream.available(); in AbstractMarshaller again ?

phil


---------- Forwarded message ----------
From: Philippe Van Dyck <pvdyck@gmail.com>
Date: Fri, Apr 16, 2010 at 10:45 AM
Subject: Bug : read after end of stream @ AbstractMarshaller
To: infinispan -Dev List <infinispan-dev@lists.jboss.org>


Hi all,

since I use an InflaterInputStream to send objects to S3 using JClouds Blobstore, I need a very strict management of streams.
In AbstractMarshaller,  while ((bytesRead = inputStream.read(buf, 0, buf.length)) != -1) bytes.write(buf, 0, bytesRead) will read after the stream's end, waiting for '-1' to happen.
You cannot do that with a GZIPInputStream because you will get a "java.io.EOFException: Unexpected end of ZLIB input stream".
Should I file a bug or correct the code ?

phil