Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8131974

AudioFileReader incorrectly handle EOFException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 9
    • 8, 9
    • client-libs
    • None
    • b105
    • generic
    • generic

    Description

      The code below should fails with UnsupportedAudioFileException but it fails with EOFException:

      import java.io.File;
      import java.io.FileOutputStream;
      import java.io.InputStream;
      import java.nio.file.Files;
      import java.nio.file.Paths;

      import javax.sound.sampled.AudioSystem;

      public final class AudioFileClose {

          public static void main(final String[] args) throws Exception {
              File f = Files.createTempFile("audio", "test").toFile();
              FileOutputStream fos = new FileOutputStream(f);
              fos.write(new byte[]{1, 2, 3});
              fos.close();
              InputStream audioInputStream = AudioSystem.getAudioInputStream(f);
              audioInputStream.close();
              audioInputStream = null;
              Files.delete(Paths.get(f.getAbsolutePath()));
          }
      }

      Attachments

        Activity

          People

            serb Sergey Bylokhov
            serb Sergey Bylokhov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: