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 230147

Summary: User can't create file or folder in Favorites tab (remote host)
Product: projects Reporter: soldatov <soldatov>
Component: Generic InfrastructureAssignee: Milos Kleint <mkleint>
Status: VERIFIED FIXED    
Severity: normal CC: anebuzelsky, apepin, issues, mkleint, mkozeny
Priority: P1 Keywords: 7.4_HR_FIX, REGRESSION
Version: 7.4   
Hardware: PC   
OS: All   
See Also: https://netbeans.org/bugzilla/show_bug.cgi?id=230134
Issue Type: DEFECT Exception Reporter:
Bug Depends on: 230134    
Bug Blocks:    
Attachments: Proposed patch

Description soldatov 2013-05-23 07:43:58 UTC
Scenario:
- Start NetBeans trunk
- Add new remote host (default mode)
- Open Services tab
- Call context menu on host under "C/C++ Build Hosts" node
- Select "Add to Favorites|Remote Home Folder"
- Open Favorites tab
- Call context menu on any remote folder
- Select "New|Empty File..." or "New|Folder..."
===>
In NetBeans 7.3 I can create new file or folder
In NetBeans Dev I can't create file or folder
Comment 1 Andrew Krasny 2013-05-23 07:53:33 UTC
I have no problems with creating a new Empty File.
But when tried to create a new Folder have got the following exception:
java.lang.AssertionError: org.netbeans.modules.project.ui.NewFileWizard@1d7e453
	at org.netbeans.modules.project.ui.NewFileIterator.getPanel(NewFileIterator.java:117)
	at org.netbeans.modules.project.ui.NewFileIterator.initialize(NewFileIterator.java:163)
	at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.initialize(TemplateWizard.java:1036)
	at org.openide.loaders.TemplateWizardIterImpl.setIterator(TemplateWizardIterImpl.java:104)
	at org.openide.loaders.TemplateWizardIteratorWrapper.setIterator(TemplateWizardIteratorWrapper.java:79)
	at org.openide.loaders.TemplateWizard.setTemplateImpl(TemplateWizard.java:209)
	at org.openide.loaders.TemplateWizard$1.run(TemplateWizard.java:231)
	at org.openide.loaders.TemplateWizard$1.run(TemplateWizard.java:228)
	at org.openide.util.Mutex.doEventAccess(Mutex.java:1363)
	at org.openide.util.Mutex.readAccess(Mutex.java:273)
	at org.openide.loaders.TemplateWizard.setTemplate(TemplateWizard.java:228)
	at org.netbeans.modules.project.ui.TemplateChooserPanel.storeSettings(TemplateChooserPanel.java:170)
	at org.netbeans.modules.project.ui.TemplateChooserPanel.storeSettings(TemplateChooserPanel.java:72)
	at org.openide.WizardDescriptor.storeSettingsAndNotify(WizardDescriptor.java:1391)
	at org.openide.WizardDescriptor.access$1800(WizardDescriptor.java:92)
	at org.openide.WizardDescriptor$Listener$1.run(WizardDescriptor.java:2203)
	at org.openide.WizardDescriptor.lazyValidate(WizardDescriptor.java:1516)
	at org.openide.WizardDescriptor.access$2000(WizardDescriptor.java:92)
	at org.openide.WizardDescriptor$Listener.actionPerformed(WizardDescriptor.java:2227)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:458)
	at sun.proxy.$Proxy17.actionPerformed(Unknown Source)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2018)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2341)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
	at java.awt.Component.processMouseEvent(Component.java:6505)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3321)
	at java.awt.Component.processEvent(Component.java:6270)
	at java.awt.Container.processEvent(Container.java:2229)
	at java.awt.Component.dispatchEventImpl(Component.java:4861)
	at java.awt.Container.dispatchEventImpl(Container.java:2287)
	at java.awt.Component.dispatchEvent(Component.java:4687)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422)
	at java.awt.Container.dispatchEventImpl(Container.java:2273)
	at java.awt.Window.dispatchEventImpl(Window.java:2719)
	at java.awt.Component.dispatchEvent(Component.java:4687)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:729)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:688)
	at java.awt.EventQueue$3.run(EventQueue.java:686)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87)
	at java.awt.EventQueue$4.run(EventQueue.java:702)
	at java.awt.EventQueue$4.run(EventQueue.java:700)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:699)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
[catch] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:154)
	at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:182)
	at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:221)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:219)
	at java.awt.Dialog.show(Dialog.java:1082)
	at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:1078)
	at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:1128)
	at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:1100)
	at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:128)
	at org.openide.util.Mutex.doEventAccess(Mutex.java:1363)
	at org.openide.util.Mutex.readAccess(Mutex.java:273)
	at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:1085)
	at java.awt.Component.show(Component.java:1651)
	at java.awt.Component.setVisible(Component.java:1603)
	at java.awt.Window.setVisible(Window.java:1014)
	at java.awt.Dialog.setVisible(Dialog.java:1005)
	at org.netbeans.core.windows.services.DialogDisplayerImpl$1AWTQuery.showDialog(DialogDisplayerImpl.java:260)
	at org.netbeans.core.windows.services.DialogDisplayerImpl$1AWTQuery.run(DialogDisplayerImpl.java:186)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
	at java.awt.EventQueue.access$200(EventQueue.java:103)
	at java.awt.EventQueue$3.run(EventQueue.java:688)
	at java.awt.EventQueue$3.run(EventQueue.java:686)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
	at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Comment 2 Andrew Krasny 2013-05-23 07:54:50 UTC
Still the exception didn't prevent folder creation...
Comment 3 Andrew Krasny 2013-05-23 07:59:30 UTC
Now I see. The better way to reproduce is to mount not $HOME, but some other folder - in this case I see that it tries to create (and in my first scenario creates) *local*, nor *remote* files...
Comment 4 Alexander Pepin 2013-05-29 10:54:51 UTC
see also bug #230134 and bug #230136
Comment 5 Andrew Krasny 2013-06-18 12:08:16 UTC
Created attachment 135963 [details]
Proposed patch
Comment 6 Andrew Krasny 2013-06-18 12:10:57 UTC
The problem is that currently infrastructure forgets about a FileObject that was pre-selected and tries to re-create it from a string (always locally). 

I have attached a proposed fix.

Please review.

Thanks, 
=Andrew
Comment 7 Andrew Krasny 2013-06-18 13:12:52 UTC
BTW, the proposed fix will not solve the problem of "Browse..." button. It also uses java.io.File and relevant code should be re-written to use FileObject instead...
Comment 8 Milos Kleint 2013-06-19 10:16:34 UTC
hmm.. just a sidenote: who told you that creating a remote filesystem was a good idea to follow? Netbeans used to have some kind of remotefs infrastructure in 3.x times but since 4.x the project system at least assumes local filesystem projects only IMHO.
Comment 9 Milos Kleint 2013-06-20 08:51:02 UTC
the move from SimpleTargetChooserPanel.java
-            rootFolder = FileUtil.toFileObject(FileUtil.normalizeFile(new File(gui.getTargetFolder())));

to SimpleTargetChooserPanelGUI.java

+ return (fs == null) ? FileUtil.toFileObject(new File("")) : fs.getRoot(); // NOI18N

is suspicious as the gui.getTargetFolder() was replaced with "".

Please make sure that all scenarios in issue 230134#c5 work as expected
Comment 10 Andrew Krasny 2013-06-24 09:17:08 UTC
(In reply to comment #8)
> hmm.. just a sidenote: who told you that creating a remote filesystem was a
> good idea to follow? Netbeans used to have some kind of remotefs infrastructure
> in 3.x times but since 4.x the project system at least assumes local filesystem
> projects only IMHO.

Don't forget about cnd ;) We do have a remote filesystem... So it has to be supported.
Comment 11 Milos Kleint 2013-06-24 09:28:44 UTC
(In reply to comment #10)
> (In reply to comment #8)
> > hmm.. just a sidenote: who told you that creating a remote filesystem was a
> > good idea to follow? Netbeans used to have some kind of remotefs infrastructure
> > in 3.x times but since 4.x the project system at least assumes local filesystem
> > projects only IMHO.
> 
> Don't forget about cnd ;) We do have a remote filesystem... So it has to be
> supported.

my point was that you should not have added the feature, at least not before all parts of the IDE affected are identified and changed accordingly. Or maybe it would be apparent then that the cost of such new feature outweights  it's benefits.
Comment 12 Andrew Krasny 2013-06-24 09:51:45 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #8)
> > > hmm.. just a sidenote: who told you that creating a remote filesystem was a
> > > good idea to follow? Netbeans used to have some kind of remotefs infrastructure
> > > in 3.x times but since 4.x the project system at least assumes local filesystem
> > > projects only IMHO.
> > 
> > Don't forget about cnd ;) We do have a remote filesystem... So it has to be
> > supported.
> 
> my point was that you should not have added the feature, at least not before
> all parts of the IDE affected are identified and changed accordingly. Or maybe
> it would be apparent then that the cost of such new feature outweights  it's
> benefits.

But this used to work and, as NB provides FileSystem all it's parts should be FS-capable. It is not our (cnd) feature...

From this point of view it is a bug in the code under discussion. And it should be fixed thoroughly.. Proposed patch is really a very minimal thing to do. It doesn't solve all the problems (like Browse button, for example).
Comment 13 soldatov 2013-08-09 09:48:43 UTC
Which plans and progress?
Comment 14 soldatov 2013-08-19 10:58:37 UTC
15 days to Code Freeze. Can this bug be fixed in NetBeans 7.4 or not?
Comment 15 Vladimir Voskresensky 2013-08-19 11:22:38 UTC
Martin or Milos, can you evaluate, please. 
It have to be fixed in 7.4. It's better to have fix before CF to allow to check if something extra should be done on our side in RemoteFS impl.
Comment 16 Milos Kleint 2013-08-23 05:22:11 UTC
(In reply to Vladimir Voskresensky from comment #15)
> Martin or Milos, can you evaluate, please. 
> It have to be fixed in 7.4. It's better to have fix before CF to allow to
> check if something extra should be done on our side in RemoteFS impl.

a P1 can be fixed after CF, and that includes any of your fixes in RemoteFS, I hope to find some time next week though.
Comment 17 Milos Kleint 2013-09-04 11:19:06 UTC
http://hg.netbeans.org/core-main/rev/df789f961513

please verify so that we can integrate into release74 branch
Comment 18 soldatov 2013-09-04 11:36:46 UTC
I will check fix in next "trunk" build from http://bits.netbeans.org/download/trunk/nightly/latest/
Comment 19 Quality Engineering 2013-09-05 01:29:48 UTC
Integrated into 'main-silver', will be available in build *201309050001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/df789f961513
User: Milos Kleint <mkleint@netbeans.org>
Log: #230147 handle non-local filesystems in case of the wizard being executed outside of projects.
Comment 20 soldatov 2013-09-05 08:06:01 UTC
I can't check fix in 201309050001 build, because a lot of exceptions appears if Favorites tab has been activated (see issue 235520)
Comment 21 soldatov 2013-09-05 09:12:54 UTC
I downloaded latest cnd-main build (http://hg.netbeans.org/cnd-main) with http://hg.netbeans.org/cnd-main/rev/961a1bc451d1 fix. I think bug is fixed, because I can create a local or remote file/folder. Though I see 2 small problems.
1) If I call New File wizard in Favorites tab and a file was been created outside of any project, then Browse... button are enabled, but it doesn't work.
2) If I use Windows as a local host and Unix as a remote host, then in "New File" wizard I see "\var\tmp\zzzz" path instead of "/var/tmp/zzzz"
Comment 22 Milos Kleint 2013-09-05 09:18:57 UTC
(In reply to soldatov from comment #21)
> I downloaded latest cnd-main build (http://hg.netbeans.org/cnd-main) with
> http://hg.netbeans.org/cnd-main/rev/961a1bc451d1 fix. I think bug is fixed,
> because I can create a local or remote file/folder. Though I see 2 small
> problems.
> 1) If I call New File wizard in Favorites tab and a file was been created
> outside of any project, then Browse... button are enabled, but it doesn't
> work.

I think this is filed separately and definitely not a stopper for 7.4. 

> 2) If I use Windows as a local host and Unix as a remote host, then in "New
> File" wizard I see "\var\tmp\zzzz" path instead of "/var/tmp/zzzz"

that's because all paths on windows have backslashes as path separators? Does not have a clear solution, FileObjects use forwardslashes on all platforms.
Comment 23 soldatov 2013-09-05 09:31:24 UTC
(In reply to Milos Kleint from comment #22)
> I think this is filed separately and definitely not a stopper for 7.4. 

I agree
Comment 24 soldatov 2013-09-06 08:27:23 UTC
Verified in trunk.

>Log Session: Friday, September 6, 2013 12:19:09 PM MSK
>System Info: 
  Product Version         = NetBeans IDE Dev (Build 201309060001) (#260c2bc52e91)
  Operating System        = Windows XP version 5.1 running on x86
  Java; VM; Vendor        = 1.7.0_25; Java HotSpot(TM) Client VM 23.25-b01; Oracle Corporation
  Runtime                 = Java(TM) SE Runtime Environment 1.7.0_25-b15
  Java Home               = C:\Program Files\Java\jdk1.7.0_25\jre
  System Locale; Encoding = en_US (nb); Cp1251
Comment 25 Milos Kleint 2013-09-06 08:32:44 UTC
thanks.

http://hg.netbeans.org/releases/rev/66da781c5848
Comment 26 soldatov 2013-09-11 09:20:23 UTC
verified in NetBeans 7.4rc1

Product Version         = NetBeans IDE 7.4 RC1 (Build 201309102300) (#631dc6239006)
Operating System        = Windows XP version 5.1 running on x86
Java; VM; Vendor        = 1.7.0_25; Java HotSpot(TM) Client VM 23.25-b01; Oracle Corporation
Runtime                 = Java(TM) SE Runtime Environment 1.7.0_25-b15