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

audioInputStream.close() does not release the resource

    Details

    • Subcomponent:
    • Resolved In Build:
      b78
    • CPU:
      generic
    • OS:
      windows

      Backports

        Description

        FULL PRODUCT VERSION :
        JDK7u9

        ADDITIONAL OS VERSION INFORMATION :
        Windows XP, Windows 7, Windows Server 2008

        A DESCRIPTION OF THE PROBLEM :
        try{
          File f = new File(main.getWavFileName(0, tab));
          AudioInputStream audioInputStream =AudioSystem.getAudioInputStream(f);
          audioInputStream.close();
          audioInputStream = null;
          f = null;
        }catch(Exception e) {
          e.printStackTrace();
        }

        try {
          Files.delete(Paths.get(f2.getAbsolutePath()));
        } catch (IOException e) {
          e.printStackTrace();
        }

        In the above code the file could not be deleted even after AudioInputStream was closed. The same code works well with Java 1.6.

        REGRESSION. Last worked in version 6u31

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Steps are given in the description

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        File should be deleted once AudioInputStream is closed.
        ACTUAL -
        Invoking .close() on AudioInputStream object does not release resource it is holding.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        CUSTOMER SUBMITTED WORKAROUND :
        The only workaround that I see is calling System.gc() explicitly but it might cause performance issues.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  serb Sergey Bylokhov
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  7 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: