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

AudioFileReader incorrectly handle EOFException

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8, 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b105
    • CPU:
      generic
    • OS:
      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

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

              Dates

              Created:
              Updated:
              Resolved: