You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@harmony.apache.org by Jesse Wilson <je...@google.com> on 2009/11/30 17:54:16 UTC

Re: [classlib][archive] JarFile#getInputStream() (was: Re: [testing] M12 testing on Windows x86)

On Mon, Nov 30, 2009 at 2:08 AM, Tim Ellison <t....@gmail.com> wrote:

> The method JarFile#getInputStream(ZipEntry) is spec'd to return an
> InputStream, not a ZipInputStream.
>
> Furthermore, as I showed, the RI returns a stream that answers with
> available() > 1, i.e. it follows the InputStream spec.
>

Yup. And if we want to do likewise, we should change he *runtime* type of
the returned stream so that it isn't a subtype of ZipInputStream.



> We should follow the spec and RI behavior.  While we have only got
> examples of our own code making the assumption on available() [1] I
> expect that there will be third-party applications making the same
> assumptions.
>

You're right. Sadly this bogus pattern is quite common.
  http://www.google.com/codesearch?hl=en&start=10&sa=N&q=new
\+byte\[\w%2B\.available\(\)\]+file:\.java

Re: [classlib][archive] JarFile#getInputStream()

Posted by Tim Ellison <t....@gmail.com>.
On 30/Nov/2009 16:54, Jesse Wilson wrote:
> On Mon, Nov 30, 2009 at 2:08 AM, Tim Ellison <t....@gmail.com> wrote:
> 
>> The method JarFile#getInputStream(ZipEntry) is spec'd to return an
>> InputStream, not a ZipInputStream.
>>
>> Furthermore, as I showed, the RI returns a stream that answers with
>> available() > 1, i.e. it follows the InputStream spec.
> 
> Yup. And if we want to do likewise, we should change he *runtime* type of
> the returned stream so that it isn't a subtype of ZipInputStream.

Right, if you see my patch on HARMONY-6394 I have defined it as
ZipInflaterInputStream extends InflaterInputStream (extends
FilterInputStream extends InputStream extends Object).

>> We should follow the spec and RI behavior.  While we have only got
>> examples of our own code making the assumption on available() [1] I
>> expect that there will be third-party applications making the same
>> assumptions.
> 
> You're right. Sadly this bogus pattern is quite common.
>   http://www.google.com/codesearch?hl=en&start=10&sa=N&q=new
> \+byte\[\w%2B\.available\(\)\]+file:\.java

:-(

Regards,
Tim