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

(fs) Potential for NPE in Files.walkFileTree if closing directory fails

XMLWordPrintable

    • b151
    • x86
    • windows_8

      FULL PRODUCT VERSION :
      java version "1.8.0_11"
      Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
      Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.3.9600]

      A DESCRIPTION OF THE PROBLEM :
      The code in FileTreeWalker,next() should be changed:
                          if (ioe != null) {
                              ioe = e;
                          } else {
                              ioe.addSuppressed(e); // NPE here
                          }


      REGRESSION. Last worked in version 7u65

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.7.0_65"
      Java(TM) SE Runtime Environment (build 1.7.0_65-b19)
      Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Look at the code of the FileTreeWalker.next() method.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      ioe.addSuppressed(e) should be called in the (ioe != null) branch.
      ACTUAL -
      ioe.addSuppressed(e) is called in when ioe is null.

      REPRODUCIBILITY :
      This bug can be reproduced always.

            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: