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

(fs) Files.getFileStore gets error when Path points to a direct I/O ramdisk(win)

XMLWordPrintable

    • x86_64
    • windows_10
    • Verified

      ADDITIONAL SYSTEM INFORMATION :
      os : windows 7/10 64-bit
      Java Runtime : jdk1.8.0_291

      A DESCRIPTION OF THE PROBLEM :
      The Files.getFileStore implementation on Windows get error when directory on a direct-io ramdisk drive ,
       WindowsNativeDispatcher.GetVolumePathName occur some error


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.download windows tool "Primo Ramdisk Multiple Editions" , you can find here https://www.romexsoftware.com/en-us/primo-ramdisk/download.html
      2.install Primo.Ramdisk.Setup , Free Trial
      3.after installed , click "Create a new disk" , set Disk Size =32/64 or 128 MB , driver Letter = X , type must be "Direct-IO Disk" , click "Create"
      4.run Code get error


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      no error ,System.out.println like below
      true
      148058927104

      ACTUAL -
      true
      java.nio.file.FileSystemException: x:: Incorrect function.
              at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:86)
              at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
              at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
              at sun.nio.fs.WindowsLinkSupport.getFinalPath(WindowsLinkSupport.java:82)
              at sun.nio.fs.WindowsFileStore.create(WindowsFileStore.java:94)
              at sun.nio.fs.WindowsFileSystemProvider.getFileStore(WindowsFileSystemProvider.java:482)
              at java.nio.file.Files.getFileStore(Files.java:1461)
              at test.Test.main(Test2.java:13)


      ---------- BEGIN SOURCE ----------
      import java.io.IOException;
      import java.nio.file.FileStore;
      import java.nio.file.Files;
      import java.nio.file.Paths;

      public class Test {
          public static void main(String[] args) {
              try {
                  String p="x:";
                  System.out.println(Files.exists(Paths.get(p)));
                  FileStore fileStore = Files.getFileStore(Paths.get(p));
                  System.out.println(fileStore.getTotalSpace());
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            tongwan Andrew Wang
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: