harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Ellison <t.p.elli...@gmail.com>
Subject Re: [classlib][archive] JarFile#getInputStream()
Date Mon, 30 Nov 2009 17:11:07 GMT
On 30/Nov/2009 16:54, Jesse Wilson wrote:
> On Mon, Nov 30, 2009 at 2:08 AM, Tim Ellison <t.p.ellison@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


Mime
View raw message