kelemen / netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.
172 stars 57 forks source link

java.nio.file.InvalidPathException: UNC path is missing sharename: #327

Closed georgecz closed 7 years ago

georgecz commented 7 years ago

Unable to open Gradle project after installing plugin version 1.4.0. Gradle version 3.4.1 Netbeans IDE version 8.1

Possibly relevant code snippet:

ext.softwareBase = System.getProperty("software.home") ?: 'file://ALBERT/software.nsc' softwareBase = file(softwareBase)

NetBeans IDE exception report http://statistics.netbeans.org/analytics/exception.do?id=846051

Stacktrace: java.nio.file.InvalidPathException: UNC path is missing sharename: \ALBERT at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:118) at sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) at sun.nio.fs.WindowsPath.parse(WindowsPath.java:94) at sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:255) at java.io.File.toPath(File.java:2234) at org.netbeans.gradle.project.NbGradleProjectFactory.hasBuildFile(NbGradleProjectFactory.java:172) at org.netbeans.gradle.project.NbGradleProjectFactory.isProject(NbGradleProjectFactory.java:206) at org.netbeans.gradle.project.NbGradleProjectFactory.loadProject(NbGradleProjectFactory.java:228) at org.netbeans.modules.projectapi.nb.NbProjectManager.createProject(NbProjectManager.java:401) at org.netbeans.modules.projectapi.nb.NbProjectManager.access$300(NbProjectManager.java:94) at org.netbeans.modules.projectapi.nb.NbProjectManager$2.run(NbProjectManager.java:314) at org.netbeans.modules.projectapi.nb.NbProjectManager$2.run(NbProjectManager.java:243) at org.netbeans.modules.openide.util.DefaultMutexImplementation.readAccess(DefaultMutexImplementation.java:252) at org.openide.util.Mutex.readAccess(Mutex.java:250) at org.netbeans.modules.projectapi.nb.NbProjectManager.findProject(NbProjectManager.java:243) at org.netbeans.api.project.ProjectManager.findProject(ProjectManager.java:167) at org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation.getOwner(SimpleFileOwnerQueryImplementation.java:161) at org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation.getOwner(SimpleFileOwnerQueryImplementation.java:113) at org.netbeans.api.project.FileOwnerQuery.getOwner(FileOwnerQuery.java:147) at org.netbeans.modules.java.project.ProjectSourceForBinaryQuery.findSourceRoots2(ProjectSourceForBinaryQuery.java:79) at org.netbeans.api.java.queries.SourceForBinaryQuery.findSourceRoots2(SourceForBinaryQuery.java:126) at org.netbeans.modules.parsing.impl.indexing.PathRegistry.createResources(PathRegistry.java:750) at org.netbeans.modules.parsing.impl.indexing.PathRegistry.getSources(PathRegistry.java:297) at org.netbeans.modules.parsing.impl.indexing.errors.Utilities.findIndexedRootsUnderDirectory(Utilities.java:106) at org.netbeans.modules.parsing.ui.indexing.errors.ErrorAnnotator$1.run(ErrorAnnotator.java:320) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1443) at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:68) at org.openide.util.lookup.Lookups.executeWith(Lookups.java:303) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2058)

kelemen commented 7 years ago

I don't think this issue has anything to do with your build scripts (as at this point the build scripts were not touched yet). Rather, the cause probably lies in where your project is located (or how you open it). Can you tell where your project is located and how do you try open it?

Also, I assume it worked with the previous version of this plugin.

kelemen commented 7 years ago

I couldn't reproduce this issue but did a review and have a guess what could have happened. Can you try building the plugin from the sources (it should build out-of-the-box but you can refer to the Wiki page as well).

georgecz commented 7 years ago

I feel that the snippet I showed could be relevant, as when I replaced the UNC location with a simple ‘X:/’ drive assignment everything worked fine – for me that is an acceptable workaround.

Yes, the previous version did work OK with the UNC location.

The project is located at ‘C:\ABC\Project_gradle’, and I simply open the project folder in NetBeans.

kelemen commented 7 years ago

I guess then what happens is that url is somehow reaches NB and NB is very eager to check if a directory is a project directory. Did/Can you try if building this plugin from the sources fixes your problem (without the workaround)?

georgecz commented 7 years ago

Not yet. Will do when I can. I can confirm the same symptoms appear with NetBeans IDE version 8.2, though.

georgecz commented 7 years ago

OK. I've built the plugin from master source, my projects now seem to load correctly. Thx.