xadisk
  1. xadisk
  2. XADISK-153

File.canWrite() returning wrong value, leading to invalid permission check by xadisk.

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: filesystem
    • Labels:
      None

      Description

      Thanks to Luc for bringing this up on the discussion thread: https://groups.google.com/forum/#!topic/xadisk/cuQAhyxMjyI

      XADisk does a permission check during the io operations, in an attempt to make sure that they succeed during commit. During create file, it check the parent directory write permission. As discussed on above thread, the check returns wrong value (on the given windows environment), leading to failure in commit.

      The following code, as provided by Luc, works as follows on his windows machine:

      ===============================

      File f = new File( "C:/");
      System.out.println("f canwrite " + f.canWrite());
      File newFile = new File( f.getAbsolutePath(), "zap.txt");
      boolean created = newFile.createNewFile();
      System.out.println( "created: " + created);

      The output:

      f canwrite true
      Exception in thread "main" java.io.IOException: A required privilege is not held by the client
      at java.io.WinNTFileSystem.createFileExclusively(Native Method)
      at java.io.File.createNewFile(File.java:1006)
      at zap.main(zap.java:16)

      ===============================

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Nitin Verma
            Reporter:
            Nitin Verma
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: