Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Invalid thread access exception while loading a Complete OCL file(Unable to load a simple empty Complete OCL file on a SysML model with nested profiles.)
Invalid thread access exception while loading a Complete OCL file [message #1729585] Fri, 15 April 2016 16:18 Go to next message
Roman Tre is currently offline Roman TreFriend
Messages: 5
Registered: April 2016
Junior Member
Hello everyone,

I'm trying to validate a simple SysML papyrus model via Complete OCL. The model has a custom profile applied which in turn has the "Blocks" profile from SysML applied.
Unfortunately when I'm trying to load a Complete OCL file (even an empty one) manually (via right-click -> OCL -> Load Document) on the model's .uml file to validate it, I'm getting an "Invalid thread access" exception.
Eclipse is telling me that "An internal error occurred during: "Deferred Load OCL Document".

To make my problem more clear, these are the steps to reproduce the problem:
Quote:

- Create a new project (General -> Project)
- Create 3 folders: diagram, ocl, profile

- In folder "profile" create a new Papyrus profile called "custom.profile.di"
-- Name the root element "CustomRoot", choose "Profile Diagram" as diagram kind, click "Finish"
- Open the Properties View on the CustomRoot element and apply the "SysML > Blocks" profile (use the button "Apply registered profile" in the "Profile" tab)
- The EPackage "SysML" is now visible in the Model Explorer View, drag the "Block" element in the design view. The Block stereotype will get imported.
- Create a new Stereotype as a generalization of Block, name it "MyStereotype"
- Save and define the profile

- In folder "diagram" create a new SysML model called model.di
-- Choose "Block Definition Diagram" as diagram kind
-- Apply our created custom.profile.di
- Create a new Block in the diagram view and apply the "MyStereotype" stereotype, created above
- Save the model

- In folder "ocl" create a new empty CompleteOCL file
- Open the model.uml file with the Sample Reflective Ecore Model Editor
- Right-click on the model.uml resource in the editor and load the empty ocl file as described above => this is where the exception mentioned above occurs


I also attached a small example, so you can check yourself.

It seems the Complete OCL loader fails to load additional profiles that are referenced in the custom profile. If you remove the "Blocks" profile application from the custom profile, the Complete OCL file loads just fine.

I'm getting the following stacktrace:

!ENTRY org.eclipse.core.jobs 4 2 2016-04-15 17:57:56.684
!MESSAGE An internal error occurred during: "Deferred Load OCL Document".
!STACK 0
org.eclipse.swt.SWTException: Invalid thread access
	at org.eclipse.swt.SWT.error(SWT.java:4491)
	at org.eclipse.swt.SWT.error(SWT.java:4406)
	at org.eclipse.swt.SWT.error(SWT.java:4377)
	at org.eclipse.swt.widgets.Widget.error(Widget.java:482)
	at org.eclipse.swt.widgets.Shell.<init>(Shell.java:266)
	at org.eclipse.swt.widgets.Shell.<init>(Shell.java:362)
	at org.eclipse.jface.window.Window.createShell(Window.java:486)
	at org.eclipse.jface.window.Window.create(Window.java:429)
	at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1096)
	at org.eclipse.jface.window.Window.open(Window.java:792)
	at org.eclipse.emf.common.ui.dialogs.DiagnosticDialog.open(DiagnosticDialog.java:384)
	at org.eclipse.emf.common.ui.dialogs.DiagnosticDialog.open(DiagnosticDialog.java:125)
	at org.eclipse.emf.common.ui.dialogs.DiagnosticDialog.open(DiagnosticDialog.java:66)
	at org.eclipse.ocl.xtext.completeocl.ui.commands.LoadCompleteOCLResourceHandler$ResourceDialog.error(LoadCompleteOCLResourceHandler.java:323)
	at org.eclipse.ocl.xtext.completeocl.ui.commands.LoadCompleteOCLResourceHandler$ResourceDialog$DeferredLoadDocumentJob$2.error(LoadCompleteOCLResourceHandler.java:166)
	at org.eclipse.ocl.xtext.completeocl.utilities.CompleteOCLLoader.loadMetamodels(CompleteOCLLoader.java:113)
	at org.eclipse.ocl.xtext.completeocl.ui.commands.LoadCompleteOCLResourceHandler$ResourceDialog$DeferredLoadDocumentJob.processResources(LoadCompleteOCLResourceHandler.java:170)
	at org.eclipse.ocl.xtext.completeocl.ui.commands.LoadCompleteOCLResourceHandler$ResourceDialog$DeferredLoadDocumentJob.run(LoadCompleteOCLResourceHandler.java:150)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)


Installation details:
Eclipse Mars 4.5.2
Papyrus 1.1.4.20160210
UML2 5.1.2.v20160201-0816
OCL for UML 5.1.0.v20150521-1211
EMF Validation Framework Version: 1.9.0.201505312255
EMF Validation Framework OCL Integration Version: 1.9.0.201505312255
Eclipse Modeling Framework Core Runtime Version: 2.11.2.v20160208-0816

Kind regards and thanks for your help,

Roman
Re: Invalid thread access exception while loading a Complete OCL file [message #1729616 is a reply to message #1729585] Sat, 16 April 2016 06:32 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5838
Registered: July 2009
Senior Member
Hi

https://bugs.eclipse.org/bugs/show_bug.cgi?id=491845 raised

It's never helpful for the diagnostic reporting process to fail, thereby
preventing you seeing what the original problem was.

Regards

Ed Willink


On 15/04/2016 17:18, Roman Tre wrote:
> Hello everyone,
>
> I'm trying to validate a simple SysML papyrus model via Complete OCL. The model has a custom profile applied which in turn has the "Blocks" profile from SysML applied.
> Unfortunately when I'm trying to load a Complete OCL file (even an empty one) manually (via right-click -> OCL -> Load Document) on the model's .uml file to validate it, I'm getting an "Invalid thread access" exception.
> Eclipse is telling me that "An internal error occurred during: "Deferred Load OCL Document".
>
> To make my problem more clear, these are the steps to reproduce the problem:
> Quote:
>> - Create a new project (General -> Project)
>> - Create 3 folders: diagram, ocl, profile
>>
>> - In folder "profile" create a new Papyrus profile called "custom.profile.di"
>> -- Name the root element "CustomRoot", choose "Profile Diagram" as diagram kind, click "Finish"
>> - Open the Properties View on the CustomRoot element and apply the "SysML > Blocks" profile (use the button "Apply registered profile" in the "Profile" tab)
>> - The EPackage "SysML" is now visible in the Model Explorer View, drag the "Block" element in the design view. The Block stereotype will get imported.
>> - Create a new Stereotype as a generalization of Block, name it "MyStereotype"
>> - Save and define the profile
>>
>> - In folder "diagram" create a new SysML model called model.di
>> -- Choose "Block Definition Diagram" as diagram kind
>> -- Apply our created custom.profile.di
>> - Create a new Block in the diagram view and apply the "MyStereotype" stereotype, created above
>> - Save the model
>>
>> - In folder "ocl" create a new empty CompleteOCL file
>> - Open the model.uml file with the Sample Reflective Ecore Model Editor
>> - Right-click on the model.uml resource in the editor and load the empty ocl file as described above => this is where the exception mentioned above occurs
>
> I also attached a small example, so you can check yourself.
>
> It seems the Complete OCL loader fails to load additional profiles that are referenced in the custom profile. If you remove the "Blocks" profile application from the custom profile, the Complete OCL file loads just fine.
>
> I'm getting the following stacktrace:
>
> !ENTRY org.eclipse.core.jobs 4 2 2016-04-15 17:57:56.684
> !MESSAGE An internal error occurred during: "Deferred Load OCL Document".
> !STACK 0
> org.eclipse.swt.SWTException: Invalid thread access
> at org.eclipse.swt.SWT.error(SWT.java:4491)
> at org.eclipse.swt.SWT.error(SWT.java:4406)
> at org.eclipse.swt.SWT.error(SWT.java:4377)
> at org.eclipse.swt.widgets.Widget.error(Widget.java:482)
> at org.eclipse.swt.widgets.Shell.<init>(Shell.java:266)
> at org.eclipse.swt.widgets.Shell.<init>(Shell.java:362)
> at org.eclipse.jface.window.Window.createShell(Window.java:486)
> at org.eclipse.jface.window.Window.create(Window.java:429)
> at org.eclipse.jface.dialogs.Dialog.create(Dialog.java:1096)
> at org.eclipse.jface.window.Window.open(Window.java:792)
> at org.eclipse.emf.common.ui.dialogs.DiagnosticDialog.open(DiagnosticDialog.java:384)
> at org.eclipse.emf.common.ui.dialogs.DiagnosticDialog.open(DiagnosticDialog.java:125)
> at org.eclipse.emf.common.ui.dialogs.DiagnosticDialog.open(DiagnosticDialog.java:66)
> at org.eclipse.ocl.xtext.completeocl.ui.commands.LoadCompleteOCLResourceHandler$ResourceDialog.error(LoadCompleteOCLResourceHandler.java:323)
> at org.eclipse.ocl.xtext.completeocl.ui.commands.LoadCompleteOCLResourceHandler$ResourceDialog$DeferredLoadDocumentJob$2.error(LoadCompleteOCLResourceHandler.java:166)
> at org.eclipse.ocl.xtext.completeocl.utilities.CompleteOCLLoader.loadMetamodels(CompleteOCLLoader.java:113)
> at org.eclipse.ocl.xtext.completeocl.ui.commands.LoadCompleteOCLResourceHandler$ResourceDialog$DeferredLoadDocumentJob.processResources(LoadCompleteOCLResourceHandler.java:170)
> at org.eclipse.ocl.xtext.completeocl.ui.commands.LoadCompleteOCLResourceHandler$ResourceDialog$DeferredLoadDocumentJob.run(LoadCompleteOCLResourceHandler.java:150)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
>
> Installation details:
> Eclipse Mars 4.5.2
> Papyrus 1.1.4.20160210
> UML2 5.1.2.v20160201-0816
> OCL for UML 5.1.0.v20150521-1211
> EMF Validation Framework Version: 1.9.0.201505312255
> EMF Validation Framework OCL Integration Version: 1.9.0.201505312255
> Eclipse Modeling Framework Core Runtime Version: 2.11.2.v20160208-0816
>
> Kind regards and thanks for your help,
>
> Roman
Re: Invalid thread access exception while loading a Complete OCL file [message #1730905 is a reply to message #1729616] Fri, 29 April 2016 15:47 Go to previous messageGo to next message
Roman Tre is currently offline Roman TreFriend
Messages: 5
Registered: April 2016
Junior Member
Hi Ed,

it seems the thrown exception is coming from Eclipse's GUI loading mechanism of OCL-files itself since it only occurs when manually loading a CompleteOCL file from the context menu on my created sample.
I tried to validate the same model with the same .ocl file programmatically by using a CompleteOCLEObjectValidator and it worked like a charm.

On further investigating the problem in the development environment, I came across an IOException, telling me that Eclipse was not able to locate the linked profile at "pathmap://plugin/...".
I tried to load the ocl-file in a runtime environment with the profile loaded and it worked out, so maybe this is a hint to the solution / to fix the bug?

Regards,
Roman
Re: Invalid thread access exception while loading a Complete OCL file [message #1731045 is a reply to message #1730905] Mon, 02 May 2016 13:15 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5838
Registered: July 2009
Senior Member
Hi

The bad "pathmap://plugin/..." may indeed be your real problem, which
the poor UI has been hiding.

The original problem was that complex models such as UML or OCL-enriched
are slow to load and fire the UI-freeze detector introduced last year.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=450481

Moving opening to a worker thread cured this problem and introduced many
more some of which are fixed. Others just keep annoying me.

https://bugs.eclipse.org/bugs/show_bug.cgi?id=473825

Reverting to the lesser UI freeze problem has been on my to-do list for
too long. I've left it a bit late for M7 today, but hopefully these UI
issues will simplify shortly.

Regards

Ed Willink


On 29/04/2016 16:47, Roman Tre wrote:
> Hi Ed,
>
> it seems the thrown exception is coming from Eclipse's GUI loading
> mechanism of OCL-files itself since it only occurs when manually
> loading a CompleteOCL file from the context menu on my created sample.
> I tried to validate the same model with the same .ocl file
> programmatically by using a CompleteOCLEObjectValidator and it worked
> like a charm.
>
> On further investigating the problem in the development environment, I
> came across an IOException, telling me that Eclipse was not able to
> locate the linked profile at "pathmap://plugin/...". I tried to load
> the ocl-file in a runtime environment with the profile loaded and it
> worked out, so maybe this is a hint to the solution / to fix the bug?
>
> Regards, Roman
Re: Invalid thread access exception while loading a Complete OCL file [message #1731115 is a reply to message #1731045] Mon, 02 May 2016 21:57 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5838
Registered: July 2009
Senior Member
Hi Roman

My previous reply confused two different worker thread issues.

The editor re-opening problem is fixed for M7.

Your Load Complete OCL bad thread just missded M&. Fixed on HEAD for RC1.

Regards

Ed Willink


On 02/05/2016 14:15, Ed Willink wrote:
> Hi
>
> The bad "pathmap://plugin/..." may indeed be your real problem, which
> the poor UI has been hiding.
>
> The original problem was that complex models such as UML or
> OCL-enriched are slow to load and fire the UI-freeze detector
> introduced last year.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=450481
>
> Moving opening to a worker thread cured this problem and introduced
> many more some of which are fixed. Others just keep annoying me.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=473825
>
> Reverting to the lesser UI freeze problem has been on my to-do list
> for too long. I've left it a bit late for M7 today, but hopefully
> these UI issues will simplify shortly.
>
> Regards
>
> Ed Willink
>
>
> On 29/04/2016 16:47, Roman Tre wrote:
>> Hi Ed,
>>
>> it seems the thrown exception is coming from Eclipse's GUI loading
>> mechanism of OCL-files itself since it only occurs when manually
>> loading a CompleteOCL file from the context menu on my created sample.
>> I tried to validate the same model with the same .ocl file
>> programmatically by using a CompleteOCLEObjectValidator and it worked
>> like a charm.
>>
>> On further investigating the problem in the development environment,
>> I came across an IOException, telling me that Eclipse was not able to
>> locate the linked profile at "pathmap://plugin/...". I tried to load
>> the ocl-file in a runtime environment with the profile loaded and it
>> worked out, so maybe this is a hint to the solution / to fix the bug?
>>
>> Regards, Roman
>
>
Previous Topic:OCL XText grammar
Next Topic:[oclinecore] unable to set EKeys
Goto Forum:
  


Current Time: Tue Apr 24 09:08:06 GMT 2018

Powered by FUDForum. Page generated in 0.02650 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software