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

(fs) Files.find issue when IOException thrown

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86_64
    • OS:
      windows_7

      Description

      ADDITIONAL SYSTEM INFORMATION :
      OS: WIN 7 PRO 64bit sp1
      CPU: inter core 2 dua P9500
      RAM: 8gb

      A DESCRIPTION OF THE PROBLEM :
      Files.find's stream pickup it's own result which comes from my body code which is the following:

      ===================LOG=====================
      The filename, directory name, or volume label syntax is incorrect
              at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
              at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
              at java.base/sun.nio.fs.WindowsFileCopy.move(WindowsFileCopy.java:395)
              at java.base/sun.nio.fs.WindowsFileSystemProvider.move(WindowsFileSystemProvider.java:292)
              at java.base/java.nio.file.Files.move(Files.java:1426)
              at NameFlatter.lambda$main$1(NameFlatter.java:15)
              at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
              at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
              at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
              at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
              at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
              at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
              at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
              at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
              at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
              at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
              at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      I have 30 files each having size of less than 2 mb. if you can not recreate the bug, please increase count of file (not size of them)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      indifinte loop of exception until it broke with the following ex:

      sun.nio.fs.WindowsException
      ACTUAL -
      No exception

      ---------- BEGIN SOURCE ----------
      try(Stream<Path> paths = Files.find(startPath, Integer.MAX_VALUE, (path, attributes) -> attributes.isRegularFile())) {
      paths.forEach((path) -> {
      System.out.println(path);
      NameFormatter formatter = new NameFormatter();
      String newName = formatter.formatNewName(path, prependFlag);
      try {Files.move(path, path.resolveSibling(newName));}
      catch(Exception ex) {ex.printStackTrace();}

      });
      }
      catch(Exception ex) {ex.printStackTrace();
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: