Hello, Audio Guru.

Please review the fix for jdk10.
Bug: https://bugs.openjdk.java.net/browse/JDK-8191384
Webrev can be found at: http://cr.openjdk.java.net/~serb/8191384/webrev


The bug occurs in the next code in WaveFloatFileReader.java:
    final RIFFReader riffiterator = new RIFFReader(stream);
    while (riffiterator.hasNextChunk()) {
       RIFFReader chunk = riffiterator.nextChunk();
       if (chunk.getFormat().equals("data")) {
           return new AudioInputStream(chunk, af, length);
       }
    }
In the code below we create a RIFFReader for the file stream, then iterates over the chunks to find a data chunk and create an AudioInputStream.

The problem is that the chunk has noop close() method, so if the user will try to close AudioInputStream, the close() method of the file stream will not be called.

In the fix the close() method for the chunk was changed and now it always close the stream on top of which it was created. I also checked that this RIFFReader.close() method was never called in our code(except the tests), its probably a reason why the NPE when it is called twice was not found.

--
Best regards, Sergey.

Reply via email to