java.nio.file.AccessDeniedException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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.
    via by Webbug Group,
  • TestDynamicLayers fails
    via GitHub by babak4
    ,
  • search for service does not work
    via GitHub by SylviaDehn
    ,
  • This test started to fail recently with the following error: {noformat} masterElection(org.hibernate.search.test.jgroups.common.JGroupsDynamicMasterElectionTest) Time elapsed: 1.857 sec <<< ERROR! java.nio.file.AccessDeniedException: C:\DOCUME~1\hudson.MSDOMAIN\LOCALS~1\Temp\hsearch-tests-3365087708292725535\indextemp-JGroupsDynamicMasterElectionTest\b4506653\org.hibernate.search.test.jgroups.master.TShirt\_0.cfs 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 org.hibernate.search.util.impl.FileHelper.deleteOrFail(FileHelper.java:251) at org.hibernate.search.util.impl.FileHelper.delete(FileHelper.java:237) at org.hibernate.search.util.impl.FileHelper.access$000(FileHelper.java:33) at org.hibernate.search.util.impl.FileHelper$1.visitFile(FileHelper.java:220) at org.hibernate.search.util.impl.FileHelper$1.visitFile(FileHelper.java:217) at java.nio.file.Files.walkFileTree(Files.java:2670) at java.nio.file.Files.walkFileTree(Files.java:2742) at org.hibernate.search.util.impl.FileHelper.deleteRecursive(FileHelper.java:217) at org.hibernate.search.util.impl.FileHelper.delete(FileHelper.java:193) at org.hibernate.search.test.DefaultTestResourceManager.ensureIndexesAreEmpty(DefaultTestResourceManager.java:162) at org.hibernate.search.test.DefaultTestResourceManager.defaultTearDown(DefaultTestResourceManager.java:190) at org.hibernate.search.test.jgroups.common.DynamicMasterSlaveSearchTestCase.tearDown(DynamicMasterSlaveSearchTestCase.java:70) {noformat} I believe it's possible that some resources have not been closed correctly, we need to investigate that. This happened in the internal QA lab: - https://jenkins.hosts.mwqe.eng.bos.redhat.com/hudson/job/hibernate-search-master-windows/602
    via by Sanne Grinovero,
  • Errors installing SonarQube
    via Stack Overflow by John Miller
    ,
  • Not launching
    via GitHub by Masyaka22
    ,
    • 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)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    osvzsosvzs
    2 times, last one,
    10 more bugmates