This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 268116 - org.openide.filesystems.FileStateInvalidException at org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObjWindows.createFolder
Summary: org.openide.filesystems.FileStateInvalidException at org.netbeans.modules.mas...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Filesystems (show other bugs)
Version: Dev
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Jaroslav Havlin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-09-20 11:43 UTC by soldatov
Modified: 2017-04-12 12:52 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 226310


Attachments
stacktrace (1.54 KB, text/plain)
2016-09-20 11:43 UTC, soldatov
Details
work around on CND side (2.14 KB, patch)
2016-09-20 13:51 UTC, Alexander Simon
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2016-09-20 11:43:12 UTC
Build: NetBeans IDE Dev (Build cnd-trunk-build-3677-on-20160920)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.101-b13, Java(TM) SE Runtime Environment, 1.8.0_101-b13
OS: Windows 7

User Comments:
soldatov: Build "Hello CMake World" project on \\Host\folder




Stacktrace: 
org.openide.filesystems.FileStateInvalidException
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObjWindows.createFolder(RootObjWindows.java:211)
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObj.createFolder(RootObj.java:258)
   at org.openide.filesystems.FileUtil.createFolder(FileUtil.java:712)
   at org.netbeans.modules.cnd.makeproject.MakeActionProviderImpl.onPreBuildStep(MakeActionProviderImpl.java:827)
   at org.netbeans.modules.cnd.makeproject.MakeActionProviderImpl.addTarget(MakeActionProviderImpl.java:487)
   at org.netbeans.modules.cnd.makeproject.MakeActionProviderImpl.addAction(MakeActionProviderImpl.java:468)
Comment 1 soldatov 2016-09-20 11:43:14 UTC
Created attachment 162128 [details]
stacktrace
Comment 2 Alexander Simon 2016-09-20 12:52:27 UTC
Root folder (instance of FileBasedFSWithUI)
has 3 children  (instances of FolderObj):
\\ALEX-PC\Users
E:\
C:\
But fileUtil cannot create folder "\\ALEX-PC\Users\alex\HelloCMakeWorld_1\build\Debug" in root folder.
Comment 3 Alexander Simon 2016-09-20 12:55:54 UTC
P1 because fileUtil is a base platform utility and it must work.
Comment 4 Alexander Simon 2016-09-20 13:51:43 UTC
Created attachment 162131 [details]
work around on CND side
Comment 5 Quality Engineering 2016-10-20 01:59:07 UTC
Integrated into 'main-silver', will be available in build *201610200002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/2c8555aa355b
User: Alexander Simon <alexvsimon@netbeans.org>
Log: work around Bug #268116 org.openide.filesystems.FileStateInvalidException at org.netbeans.modules.masterfs.filebasedfs.fileobjects.RootObjWindows.createFolder
(transplanted from fdab45c64cd48fab5bdbbfc095ef17cf539d673e)
Comment 6 Tomas Hurka 2017-03-22 07:57:38 UTC
I am sorry, but it not quite clear to me, what is wrong. Can please provide exact steps how to reproduce it? Is it Windows only issue? Thanks.
Comment 7 Alexander Simon 2017-03-22 13:13:28 UTC
(In reply to Tomas Hurka from comment #6)
> I am sorry, but it not quite clear to me, what is wrong. Can please provide
> exact steps how to reproduce it? Is it Windows only issue? Thanks.

Yes it is a Windows specific bug.
FileUtils cannot create file object on local file system.
Steps are:
FileSystem fs; // is a local windows file system
// failed to create file:
FileUtil.createFolder(fs.getRoot(), "\\HOST-NAME\Users\user\tmp");
Comment 8 Alexander Simon 2017-03-22 13:14:46 UTC
(In reply to Alexander Simon from comment #7)
> (In reply to Tomas Hurka from comment #6)
> > I am sorry, but it not quite clear to me, what is wrong. Can please provide
> > exact steps how to reproduce it? Is it Windows only issue? Thanks.
> 
> Yes it is a Windows specific bug.
> FileUtils cannot create file object on local file system.
> Steps are:
> FileSystem fs; // is a local windows file system
> // failed to create file:
> FileUtil.createFolder(fs.getRoot(), "\\HOST-NAME\Users\user\tmp");
FileUtil.createFolder(fs.getRoot(), "\\\\HOST-NAME\\Users\\user\\tmp");
Comment 9 Tomas Hurka 2017-03-23 09:29:23 UTC
This does not look like P1 to me.

>P1 because fileUtil is a base platform utility and it must work.
You can use same argument on almost any platform bug. Moreover there is an easy workaround - just mount \\Host\dir as a disk X: - everything will for fine.
Another fix can be done in code - do not use absolute path "\\ALEX-PC\Users\alex\HelloCMakeWorld_1\build\Debug" with filesystem root, just use fileObject representing project root directory "HelloCMakeWorld_1" and  call 
FileUtil.createFolder(fs.getRoot(), "build\Debug");
In fact the code above is much more efficient, since it don't need to check all the directories from the root of filesystem to the project root directory. 
We will investigate, if the original case can be fixed.
Comment 10 Tomas Hurka 2017-03-27 12:05:29 UTC
Fixed in profiler-main

changeset:   302893:7ed3d611286f
user:        Tomas Hurka <thurka@netbeans.org>
date:        Mon Mar 27 14:02:17 2017 +0200
summary:     bugfix #268116, handle UNC names in FileUtil.createFolder() - use FileUtil.toFileObject() to get FileObject for \\ComputerName\sharedFolder
Comment 11 Quality Engineering 2017-03-28 01:40:49 UTC
Integrated into 'main-silver', will be available in build *201703280002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7ed3d611286f
User: Tomas Hurka <thurka@netbeans.org>
Log: bugfix #268116, handle UNC names in FileUtil.createFolder() - use FileUtil.toFileObject() to get FileObject for \\ComputerName\sharedFolder
Comment 12 ilia 2017-04-12 12:52:41 UTC
https://netbeans.org/bugzilla/show_bug.cgi?id=268116 Changesets:
    http://hg.netbeans.org/releases/rev/b97791ab88b8 # bugfix #268116, handle UNC names in FileUtil.createFolder() - use FileUtil.toFileObject() to get FileObject for \\ComputerName\sharedFolder