Ran into what? The original Sun bug or the issue with the workaround?
I didn't have a "hasData" equivalent. I tried adding that (to my portable/cross-servlet-engine request filter) and it didn't help.
99.999% of the time the workaround noted works just fine, but /someimes, /when it is invoked at the tail end of the output it adds that extra null byte and wreaks havoc. If you ran into this latter problem and your changes resolved the problem, then I'll have to look at your patch more closely.
-- Jess Holle On 4/26/2010 7:51 PM, James Ward wrote:
I just ran into this a few weeks ago. Here is the associated Tomcat bug with a patch: https://issues.apache.org/bugzilla/show_bug.cgi?id=48738 -James -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Jess Holle Sent: Monday, April 26, 2010 6:12 PM To: [email protected] Subject: [The Java Posse] Forcing gzip flush in Java Sun/Oracle Java has a longstanding, silly, but horrific bug (yes, not just one, but that's another story). The bug I'm talking about is http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4813885 and in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4255743 -- 2 reports, but really just one bug. The issue here is that a real flush() is really necessary for a lot of use cases, but applying the workaround noted: def.setInput(EMPTYBYTEARRAY, 0, 0); def.setLevel(Deflater.NO_COMPRESSION); deflate(); def.setLevel(Deflater.DEFAULT_COMPRESSION); deflate(); out.flush(); does not actually work in all cases. If this is done after all bytes have been sent to the stream (even before finish() is called), in very rare cases an extra null byte will appear in the (uncompressed) output. Does anyone have a solution for this (without resorting to a 3rd-party library)? -- Jess Holle
-- You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
