Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions jdk/src/share/classes/com/sun/media/sound/WaveFloatFileReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,23 @@ public AudioFileFormat getAudioFileFormat(File file)

public AudioInputStream getAudioInputStream(URL url)
throws UnsupportedAudioFileException, IOException {
return getAudioInputStream(new BufferedInputStream(url.openStream()));
InputStream stream = url.openStream();
try {
return getAudioInputStream(new BufferedInputStream(stream));
} catch (Exception e) {
stream.close();
throw e;
}
}

public AudioInputStream getAudioInputStream(File file)
throws UnsupportedAudioFileException, IOException {
return getAudioInputStream(new BufferedInputStream(new FileInputStream(
file)));
InputStream stream = new FileInputStream(file);
try {
return getAudioInputStream(new BufferedInputStream(stream));
} catch (Exception e) {
stream.close();
throw e;
}
}
}