Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 401885

Summary: RWT.getUISession().exec throws IllegalStateException: Invalid thread access
Product: [RT] RAP Reporter: rgra Missing name <rgransberger>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description rgra Missing name CLA 2013-02-27 07:03:05 EST
I'm in the process of migrating a 1.5 RAP application to RAP 2.0.

UICallBack.runNonUIThreadWithFakeContext is deprecated and documentation states it should be replaces with RWT.getUISession().exec.

The call to RWT.getUISession() results in an IllegalStateException: Invalid thread access (see below). I'm not in a UI context, and try to access a SessionSingleton which previously worked with UICallBack.runNonUIThreadWithFakeContext.

java.lang.IllegalStateException: Invalid thread access
	at org.eclipse.rap.rwt.RWT.checkContext(RWT.java:608)
	at org.eclipse.rap.rwt.RWT.getUISession(RWT.java:467)
Comment 1 Ivan Furnadjiev CLA 2013-02-27 07:25:53 EST
The equivalent of UICallBack#runNonUIThreadWithFakeContext( Display, Runnable ) is RWT#getUISession( Display ).exec( Runnable ) and it is correctly stated in the JavaDoc. In the JavaDoc of RWT#getUISession() (without display parameter ) is mentioned that "...This method must be executed from the UI thread." I will close it as invalid. Please reopen if you disagree.