Jesse Wilson wrote: > On Tue, Nov 24, 2009 at 9:12 AM, Tim Ellison wrote: > >> Seems to be caused by a change in the implementation of available() for >> InputStreams on Zip entries. >> >> The failing code is in >> org.apache.harmony.sound.utils.ProviderService#getProviders(String) when >> it tries to read the whole content using available()... >> >> >> InputStream in = urls.nextElement() >> .openStream(); >> bytes = new byte[in.available()]; >> in.read(bytes); >> in.close(); >> >> > > Aahhhh.. gotcha. > > > >> Of course, this is bad form, and when I switch to use the old favourite >> getAllBytesFromStreamAndClose(InputStream) things start working again. >> > > Sweet. > > >> We can debate whether we should try to improve the available() impl or not. >> > > If we want to be true to the > spec, > we can't change it. > > > public int *available*() > throws IOException <../../../java/io/IOException.html> > > Returns 0 after EOF has been reached, otherwise always return 1. > > Programs should not count on this method to return the actual number of > bytes that could be read without blocking. Agree. Changing to use loop to read data, all sound tests can pass. > > *Overrides:*available <../../../java/io/FilterInputStream.html#available()> in > class FilterInputStream <../../../java/io/FilterInputStream.html> *Returns:*1 > before EOF and 0 after > EOF.*Throws:*IOException<../../../java/io/IOException.html> - > if an I/O error occurs. > -- Best Regards, Regis.