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

StaX buffers do not really close underlying buffers

XMLWordPrintable

    • x86_64
    • windows

      FULL PRODUCT VERSION :
      java version "1.8.0_152"
      Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
      Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      A DESCRIPTION OF THE PROBLEM :
      StAX XMLEventReader, XMLEventWriter, XMLStreamReader, XMLStreamWriter API close() method does not close uderlying resources.

      This close() method should be propagated as in other java.io.* buffers!

      REGRESSION. Last worked in version 6u45

      ADDITIONAL REGRESSION INFORMATION:
      http://bugs.java.com/view_bug.do?bug_id=6539065
      http://bugs.java.com/view_bug.do?bug_id=6407860

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      xWriter = outputFactory.createXMLEventWriter(new BufferedOutputStream(new FileOutputStream(outputFile)), "UTF-8");

      // use the writer normally

      xWriter .close();

      Files.delete(outputFile);

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      File can be deleted!
      ACTUAL -
      File are not deleted!

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception will be thrown indicating that file cannot be moved or deleted as it's locked.

      REPRODUCIBILITY :
      This bug can be reproduced always.

            joehw Joe Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: