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 203038 - Exception: Should not be called from UI thread
Summary: Exception: Should not be called from UI thread
Status: RESOLVED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Profile (show other bugs)
Version: 7.0.1
Hardware: All All
: P2 normal (vote)
Assignee: Vladimir Kvashin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-04 12:01 UTC by Alexander Simon
Modified: 2011-12-01 12:10 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 181591


Attachments
stacktrace (4.76 KB, text/plain)
2011-10-04 12:01 UTC, Alexander Simon
Details
proposed patch for replacing getHomeDirectory in remoteUtils (2.94 KB, patch)
2011-10-06 11:02 UTC, Andrew Krasny
Details | Diff
stacktrace (2.98 KB, text/plain)
2011-10-13 13:53 UTC, Maria Tishkova
Details
Proposed fix (30.00 KB, patch)
2011-11-23 06:45 UTC, Vladimir Kvashin
Details | Diff
Proposed fix, take 2. Less changes, but less clear interface (15.37 KB, patch)
2011-11-23 07:18 UTC, Vladimir Kvashin
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Simon 2011-10-04 12:01:00 UTC
This issue was reported manually by vv159170.
It already has 1 duplicates 


Build: Oracle Solaris Studio 12.3 (2011/10/03 79f1f4dc26d0)
VM: Java HotSpot(TM) Server VM, 20.0-b11, Java(TM) SE Runtime Environment, 1.6.0_25-b06
OS: SunOS

User Comments:
alexvsimon: click hotspot on full remote profiling demo results




Stacktrace: 
java.lang.Exception: Should not be called from UI thread
   at org.netbeans.modules.cnd.utils.CndUtils.assertTrue(CndUtils.java:175)
   at org.netbeans.modules.cnd.utils.CndUtils.assertFalse(CndUtils.java:170)
   at org.netbeans.modules.cnd.utils.CndUtils.assertNonUiThread(CndUtils.java:240)
   at org.netbeans.modules.cnd.remote.support.RemoteUtil.getHomeDirectory(RemoteUtil.java:101)
   at org.netbeans.modules.cnd.remote.mapper.RemoteMirrorPathProvider.getRemoteMirror(RemoteMirrorPathProvider.java:83)
   at org.netbeans.modules.cnd.remote.mapper.RemotePathMap.getRemoteSyncRoot(RemotePathMap.java:577)
Comment 1 Alexander Simon 2011-10-04 12:01:04 UTC
Created attachment 111451 [details]
stacktrace
Comment 2 Leonid Lenyashin 2011-10-06 09:30:53 UTC
Is it relevant for 7.0.1 patch as well?
Comment 3 Alexander Simon 2011-10-06 09:41:18 UTC
It's a gizmo issue and should be fixed in  7.0.1 patch.
Comment 4 Andrew Krasny 2011-10-06 10:48:09 UTC
I cannot consider this issue to be a patch candidate because this exception is ONLY visible if assertions are enabled;

Also CndUtils.assertNonUiThread(); in RemoteUtil.getHomeDirectory() is invoked UNCONDITIONALLY. Even if home directory is cashed. (and this is the case) So UI will not be frozen... 

Also I was wondering to see this implementation of RemoteUtil.getHomeDirectory(), because home directory is available in HostInfo.getUserDir().. IMO it's better to use this info instead of invoking an external process.... 

So. My plan is:
- will remove 701patch2-candidate kw;
- will fix HostInfo.getUserDir() in cnd-main;
- will move DataProvider subscriptions out of AWT in dlight once it is moved to sputnik
Comment 5 Andrew Krasny 2011-10-06 11:02:05 UTC
Created attachment 111590 [details]
proposed patch for replacing getHomeDirectory in remoteUtils
Comment 6 Maria Tishkova 2011-10-13 13:53:34 UTC
Created attachment 112004 [details]
stacktrace
Comment 7 Vladimir Kvashin 2011-11-23 06:45:18 UTC
Created attachment 113442 [details]
Proposed fix
Comment 8 Vladimir Kvashin 2011-11-23 07:18:40 UTC
Created attachment 113443 [details]
Proposed fix, take 2. Less changes, but less clear interface

In previous fix, MirrorPathProvider.getRemoteMirror throws exception in the case it can not determine remote user home.

But call graph shows that all clients just use null in this case. In this fix I removed exceptions, MirrorPathProvider.getRemoteMirror returns null.

As a result, less code is changed; and no NPE in existent code introduced.
Comment 9 Vladimir Kvashin 2011-11-28 07:50:16 UTC
Fix that combines both approaches is pushed into cnd-main
http://hg.netbeans.org/cnd-main/rev/cde7e6fb1eab
Comment 10 Quality Engineering 2011-12-01 12:10:58 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/cde7e6fb1eab
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fixed #203038 - Exception: Should not be called from UI thread