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

Files.createTempDirectory throws NoSuchFileException when directory has spaces in name

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 7u11
    • core-libs

      FULL PRODUCT VERSION :
      java version " 1.7.0_11 "
      Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
      Java HotSpot(TM) Client VM (build 23.6-b04, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows Server 2003 R2
      Standard Edition
      Service Pack 2

      A DESCRIPTION OF THE PROBLEM :
      Using java.nio.file.Files from within a web application hosted by a Tomcat where the absolute path of the temp folder contains blank characters throws exception.

      File tempFolder = Files.createTempDirectory( " vqk_exclexp_ " ).toFile();



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      execute Files.createTempDirecotry from a context where the absolute path of the temp folder contains black characters

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      a temporary folder with absolute path

      C:\Tomcat 6.0\temp\vqk_exclexp_7371957796662697588
      ACTUAL -
      [29.04.2013 17:05:56,859] [ERROR] [ExcelExportServlet.java] java.nio.file.NoSuchFileException: C:\Tomcat 6.0\temp\vqk_exclexp_7371957796662697588
      java.nio.file.NoSuchFileException: C:\Tomcat 6.0\temp\vqk_exclexp_7371957796662697588
      at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
      at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
      at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
      at sun.nio.fs.WindowsFileSystemProvider.createDirectory(Unknown Source)
      at java.nio.file.Files.createDirectory(Unknown Source)
      at java.nio.file.TempFileHelper.create(Unknown Source)
      at java.nio.file.TempFileHelper.createTempDirectory(Unknown Source)
      at java.nio.file.Files.createTempDirectory(Unknown Source)
      ...


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      [29.04.2013 17:05:56,859] [ERROR] [ExcelExportServlet.java] java.nio.file.NoSuchFileException: C:\Tomcat 6.0\temp\vqk_exclexp_7371957796662697588
      java.nio.file.NoSuchFileException: C:\Tomcat 6.0\temp\vqk_exclexp_7371957796662697588
      at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
      at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
      at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
      at sun.nio.fs.WindowsFileSystemProvider.createDirectory(Unknown Source)
      at java.nio.file.Files.createDirectory(Unknown Source)
      at java.nio.file.TempFileHelper.create(Unknown Source)
      at java.nio.file.TempFileHelper.createTempDirectory(Unknown Source)
      at java.nio.file.Files.createTempDirectory(Unknown Source)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Execute from a web application hosted by a Tomcat:

      File tempFolder = Files.createTempDirectory("vqk_exclexp_").toFile();
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      not found

            coffeys Sean Coffey
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: