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.
Build: NetBeans IDE 6.9.1 (Build 201011082200) VM: Java HotSpot(TM) 64-Bit Server VM, 19.1-b02, Java(TM) SE Runtime Environment, 1.6.0_24-b07 OS: Linux User Comments: epele83: Using a remote windows machine * It has cygwin installed to connect by ssh (connection works) * try to use the browse button to open a JFileChooser as for a remote linux machine NPE occours (I suppose some problems related to the hostInfo.getUserDir() and hostInfo.getUserDirFile() methods) Forgot to say, I'm using a linux client and try to connect to a windows machine. Thanks in advance -Paolo Stacktrace: java.lang.NullPointerException at org.netbeans.modules.remote.api.ui.FileObjectBasedFile.<init>(FileObjectBasedFile.java:83) at org.netbeans.modules.remote.api.ui.RemoteFileSystemView.getHomeDirectory(RemoteFileSystemView.java:136) at javax.swing.plaf.metal.MetalFileChooserUI.installComponents(MetalFileChooserUI.java:253) at javax.swing.plaf.basic.BasicFileChooserUI.installUI(BasicFileChooserUI.java:136) at javax.swing.plaf.metal.MetalFileChooserUI.installUI(MetalFileChooserUI.java:126) at javax.swing.JComponent.setUI(JComponent.java:662)
Created attachment 107089 [details] stacktrace
My apologies, I increase priority to P2 because it's blocking for the use of remote api in our RCP application. Thanks in advance -Paolo
Created attachment 107239 [details] Remote File View (linux client, windows + cygwin server)
I found an easy patch for the NPE. as for the constructor at line 80 of org.netbeans.modules.remote.api.ui.FileObjectBasedFile public FileObjectBasedFile(ExecutionEnvironment env, FileObject fo) { super( fo == null || "".equals(fo.getPath()) ? "/" : fo.getPath()); this.fo = fo; this.path = fo == null || "".equals(fo.getPath()) ? "/" : fo.getPath(); //add NPE protection as for super(...) call this.env = env; } Now we can open the Remote File Chooser but we have some problems with the folder that contains some space. It happen that this folders are split in different files. Es: Documents and Settings -> 3 different files: "Documents" "and" "Settings" Second, the parent folder should be /cygdrive/c/ and not just /cygdrive/ Thanks in advanced. -Paolo
Hi, Several issues are mixed here. First one is NPE. It is a duplicate of issue 189307 that has been already fixed (and the fix was exactly the same you propose - see http://hg.netbeans.org/cnd-main/rev/9b71548ab1ea). The second one is inability of remote file chooser to work with directories that contain a space. So let's consider this issue is exactly against this. The third one is working from Linux to Windows. The remote wasn't intended to work this way; you can file an enhancement if you wish; however it's unlikely that we'll invest in this. Which doesn't mean it necessarily won't work - it probably will (in sharing mode).
I'm creating a fix for that. In org.netbeans.modules.cnd.remote.fs.RemoteFileSupport line 222: final String rdir = remoteDir.length() == 0 ? "/" : remoteDir; // NOI18N checkConnection(dir, rdir, true); //my hack for cygdrive replace (otherwise we have some other problem) //not best check... but only for testing String _rdir = rdir.replaceAll("cygdrive", "cygdrive/c"); final String script = "test -d \"" + _rdir + "\" && " + // NOI18N "cd \"" + _rdir + "\" && " + // NOI18N "for D in "+ _rdir + "/*; do if [ -d \"$D\" ]; then echo D \"`basename \"$D\"`\"; else echo F \"`basename \"$D\"`\"; fi; done"; System.out.println(_rdir + ":----\n" + script); final AtomicReference<IOException> ex = new AtomicReference<IOException>(); final AtomicBoolean dirCreated = new AtomicBoolean(false); instead to use /bin/ls try to seach for <dir>/* then the space are handle in the right way. Thanks Paolo
Thank you for your effort! But you do this against old, 6.9.x code base. Now we do this via sftp and don't parse ls; RemoteFileSupport is quite different as well. However the issue still exists (which is sure a shame upon me). I believe I'll fix it today and it will be available in development version quite soon.
Thanks a lot, Do you know if this fix can be ported in NB 7.0. Thanks again -Paolo
I was mistaken. The issue with spaces is fixed in 7.0 and development version.