java.nio.file.AccessDeniedException: C:\Users\markus\Google Drive\test\a

JDK Bug System | Webbug Group | 4 months ago
  1. 0

    FULL PRODUCT VERSION : java version "1.8.0_74" Java(TM) SE Runtime Environment (build 1.8.0_74-b02) Java HotSpot(TM) Client VM (build 25.74-b02, mixed mode) ADDITIONAL OS VERSION INFORMATION : Microsoft Windows [Version 6.1.7601] EXTRA RELEVANT SYSTEM CONFIGURATION : On the local machine exists a directory C:\Users\markus\Google Drive\test synced and shared with other users using GoogleDrive. In this directory exists the directory C:\Users\markus\Google Drive\test\a which is empty (ensure that it is empty after creation, Google Drive seems to create a desktop.ini file in there). A DESCRIPTION OF THE PROBLEM : A folder in a google drive synced directory which is shared (using google drive) with other users can not be deleted using Files.delete(Path) but can using File#delete. Although it is an option to use File#delete the behaviour of those two methods should be consistent in my option. In addtion File#delete does not provide an exception on failure and thus is not that useful. STEPS TO FOLLOW TO REPRODUCE THE PROBLEM : On the local machine exists a directory C:\Users\markus\Google Drive\test synced and shared with other users using GoogleDrive. In this directory exists the directory C:\Users\markus\Google Drive\test\a which is empty (ensure that it is empty after creation, Google Drive seems to create a desktop.ini file in there). Run the example program. NOTE: Sometimes deletion worked well on my system. Wait until full synchronization of the google drive folder before running the testcase to be sure that the problem occurs. EXPECTED VERSUS ACTUAL BEHAVIOR : EXPECTED - The file is deleted by the Files#delete invocation and no exception occurs. ACTUAL - Files#delete fails with an AccessDeniedException but the File#delete invocation succeeds. ERROR MESSAGES/STACK TRACES THAT OCCUR : Example testcase output: java.nio.file.AccessDeniedException: C:\Users\markus\Google Drive\test\a at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) at sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269) at sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103) at java.nio.file.Files.delete(Files.java:1126) at test.Delete.main(Delete.java:13) true REPRODUCIBILITY : This bug can be reproduced often. ---------- BEGIN SOURCE ---------- Path path = Paths.get("C:\\Users\\markus\\Google Drive\\test\\a"); try { Files.delete(path); } catch (IOException e) { e.printStackTrace(); System.out.println(path.toFile().delete()); } ---------- END SOURCE ---------- CUSTOMER SUBMITTED WORKAROUND : Invoke path.toFile().delete() if Files#delete fails with an AccessDeniedException.

    JDK Bug System | 4 months ago | Webbug Group
    java.nio.file.AccessDeniedException: C:\Users\markus\Google Drive\test\a
  2. 0

    AccessDeniedException - Jenkins SonarQube integration

    Stack Overflow | 8 months ago | Gaurav
    java.lang.IllegalStateException: Unable to load component class org.sonar.batch.scan.ProjectLock
  3. 0

    TestDynamicLayers fails

    GitHub | 7 months ago | babak4
    java.lang.RuntimeException: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, C:\Users\babak.tourani\neo4j\spatial\target\var\neo4j-db\1
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    org.apache.cassandra.io.FSWriteError: java.nio.file.AccessDeniedException

    GitHub | 1 year ago | dejwsz
    org.apache.cassandra.io.FSWriteError: java.nio.file.AccessDeniedException: /var/lib/cassandra/lucene
  6. 0

    Errors installing SonarQube

    Stack Overflow | 9 months ago | John Miller
    java.lang.RuntimeException: Failed to reset file system

    4 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.nio.file.AccessDeniedException

      C:\Users\markus\Google Drive\test\a

      at sun.nio.fs.WindowsException.translateToIOException()
    2. Java RT
      Files.delete
      1. sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83)
      2. sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
      3. sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
      4. sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:269)
      5. sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:103)
      6. java.nio.file.Files.delete(Files.java:1126)
      6 frames
    3. test
      Delete.main
      1. test.Delete.main(Delete.java:13)
      1 frame