Bug 202853 - [71cat] ClassCastException: org.netbeans.modules.cnd.utils.ui.FileChooser cannot be cast to org.netbeans.modules.remote.api.ui.FileChooserBuilder$JFileChooserEx
[71cat] ClassCastException: org.netbeans.modules.cnd.utils.ui.FileChooser can...
Status: VERIFIED FIXED
Product: cnd
Classification: Unclassified
Component: Remote
7.1
All All
: P2 (vote)
: 7.1
Assigned To: Vladimir Voskresensky
issues@cnd
EXCEPTIONS_REPORT 701patch2-verified
:
Depends on: 203671 203675
Blocks:
  Show dependency treegraph
 
Reported: 2011-09-30 05:46 UTC by sunbiz
Modified: 2011-10-20 09:47 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (4.46 KB, text/plain)
2011-09-30 05:46 UTC, sunbiz
Details
stacktrace (629 bytes, text/plain)
2011-10-07 10:55 UTC, Vladimir Voskresensky
Details
7.0.1 proposed patch (6.06 KB, patch)
2011-10-14 12:01 UTC, Vladimir Voskresensky
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sunbiz 2011-09-30 05:46:54 UTC
Build: NetBeans IDE 7.1 Beta (Build 201109222201)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.2-b06, Java(TM) SE Runtime Environment, 1.6.0_27-b07
OS: Windows 7

User Comments:
sunbiz: Selecting "other folder" from start terminal for a C/C++ Build Host




Stacktrace: 
java.lang.ClassCastException: org.netbeans.modules.cnd.utils.ui.FileChooser cannot be cast to org.netbeans.modules.remote.api.ui.FileChooserBuilder$JFileChooserEx
   at org.netbeans.modules.remote.ui.OpenTerminalAction.getRemoteFileObject(OpenTerminalAction.java:293)
   at org.netbeans.modules.remote.ui.OpenTerminalAction$AddOther.getPath(OpenTerminalAction.java:283)
   at org.netbeans.modules.remote.ui.OpenTerminalAction$AddPlace$1.run(OpenTerminalAction.java:173)
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1424)
   at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1973)
Comment 1 sunbiz 2011-09-30 05:46:58 UTC
Created attachment 111335 [details]
stacktrace
Comment 2 Vladimir Voskresensky 2011-10-07 10:55:56 UTC
Created attachment 111647 [details]
stacktrace

in services for host
Open Terminal->Other...
Comment 3 Alexander Simon 2011-10-11 10:48:42 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/7d97c2698732
Comment 4 Quality Engineering 2011-10-12 14:25:17 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/7d97c2698732
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #202853 [71cat] ClassCastException: org.netbeans.modules.cnd.utils.ui.FileChooser cannot be cast to org.netbeans.modules.remote.api.ui.FileChooserBuilder$JFileChooserEx
Comment 5 Vladimir Voskresensky 2011-10-13 08:56:41 UTC
please, keep in lastUsedDirs locals as well to have non-null for lastUsedDirs.get(env);
Comment 6 Alexander Simon 2011-10-13 14:23:24 UTC
reworked change set:
http://hg.netbeans.org/cnd-main/rev/4139546ab748
Comment 7 Vladimir Voskresensky 2011-10-13 16:24:53 UTC
File selectedFile = fileChooser.getSelectedFile(); can return null
=>FileUtil.toFileObject(selectedFile) can give NPE
Comment 8 Alexander Simon 2011-10-13 17:17:43 UTC
(In reply to comment #7)
> File selectedFile = fileChooser.getSelectedFile(); can return null
> =>FileUtil.toFileObject(selectedFile) can give NPE
Do not agree. Try to reproduce NPE.
getSelectedFile() != null after "approve" action.
If you insist on checking NPE you should suggest to fix NPE in ~30 places also.
Comment 9 Alexander Simon 2011-10-13 17:58:55 UTC
Probably you mean this line:
lastUsedDirs.put(env, fo.getParent().getPath());

fo.getParent() can return null ==> NPE (real, not imaginary)
Reassign to author of original code to rewrite this part of code.
See report http://statistics.netbeans.org/analytics/detail.do?id=181976
Comment 10 Alexander Simon 2011-10-13 18:10:13 UTC
Too buggy code, probably best solution for patch is switch off action at all.
Comment 11 Alexander Simon 2011-10-13 18:36:47 UTC
Also see usability problem of open terminal in other folder.
User going to do something in terminal.
I hardly imagine that this user will select folder by file chooser.
IMHO user does "cd" to needed folder in terminal.
Comment 12 Alexander Simon 2011-10-13 18:54:39 UTC
Another usability problem:
- IDE support common storage for last selected folders.
So file chooser invoked from any place should use previous selected folder.
Open terminal in other folder violates this rule an use own storage.
Why?
Comment 13 Vladimir Voskresensky 2011-10-14 09:27:38 UTC
(In reply to comment #11)
> Also see usability problem of open terminal in other folder.
> User going to do something in terminal.
> I hardly imagine that this user will select folder by file chooser.
> IMHO user does "cd" to needed folder in terminal.
Agree:
http://hg.netbeans.org/cnd-main/rev/72d498ee68cf
Comment 14 Vladimir Voskresensky 2011-10-14 12:01:12 UTC
Created attachment 112051 [details]
7.0.1 proposed patch

Proposed patch which removes "Other..." for terminal
Comment 15 Alexander Simon 2011-10-14 12:05:57 UTC
Do not forget change set 48fa7a9f1ac8 from Bug #203507
Comment 16 Alexander Simon 2011-10-14 13:15:31 UTC
patch is safe and correct.
Comment 17 Vladimir Voskresensky 2011-10-14 13:26:39 UTC
pushed on e**f as 204901:8db2af52de19
Comment 18 Quality Engineering 2011-10-14 15:02:39 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/4139546ab748
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #202853 [71cat] ClassCastException: org.netbeans.modules.cnd.utils.ui.FileChooser cannot be cast to org.netbeans.modules.remote.api.ui.FileChooserBuilder$JFileChooserEx
Comment 19 Alexander Pepin 2011-10-17 13:30:32 UTC
verified in OSS IDE dev build #3410 (20111016)
Comment 20 Vladimir Voskresensky 2011-10-17 13:56:49 UTC
integrated into releases/release701_fixes
http://hg.netbeans.org/releases/rev/8db2af52de19
Comment 21 Quality Engineering 2011-10-17 20:05:23 UTC
Integrated into 'releases'
Changeset: http://hg.netbeans.org/releases/rev/8db2af52de19
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixed #202853 - [71cat] ClassCastException: org.netbeans.modules.cnd.utils.ui.FileChooser cannot be cast to org.netbeans.modules.remote.api.ui.FileChooserBuilder
Comment 22 soldatov 2011-10-20 09:47:14 UTC
verified in Oracle Solaris Studio 12.3 (2011/10/18) build 32.0

small exception appears in messages.log if you selected Open Terminal|Remote Mirror of Local Files, but this folder doesn't exist

INFO [nativeexecution.support.logger]: [181667 ms.] Error occurred: Unable to start pty process: /bin/sh[2]: cd: /home/user/.netbeans/remote/aaa/bbb-SunOS-x86_64: [No such file or directory]
java.io.IOException: Unable to start pty process: /bin/sh[2]: cd: /home/user/.netbeans/remote/aaa/bbb-SunOS-x86_64: [No such file or directory]
	at org.netbeans.modules.nativeexecution.PtyNativeProcess.create(PtyNativeProcess.java:184)
[catch] at org.netbeans.modules.nativeexecution.AbstractNativeProcess.createAndStart(AbstractNativeProcess.java:152)
	at org.netbeans.modules.nativeexecution.api.NativeProcessBuilder.call(NativeProcessBuilder.java:233)


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo