Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Validate OCL from ecore standalone => Exception java.lang.NullPointerException: null
Validate OCL from ecore standalone => Exception java.lang.NullPointerException: null [message #1784293] Mon, 26 March 2018 10:46 Go to next message
Jens Zimmermann is currently offline Jens ZimmermannFriend
Messages: 6
Registered: March 2018
Junior Member
I tried to set up a standalone application which would validate the OCLs emebedded in the ecore like they are validated in the generated Editor.
I used the code posted inside
https://www.eclipse.org/forums/index.php/m/754946/?srch=standalone+ecore#msg_754946
as a template but after solving the build-path-issues I do not get further than

An exception occurred while delegating evaluation of the 'MyConstraintName' constraint on 'csfam.impl.SwcImpl@20f12539{file:/C:/.../mymodel.csfam#//@modules.0}': java.lang.NullPointerException: null

Is there any template for a standalone application performing those OCL-Checks mentioned in ecore?
Re: Validate OCL from ecore standalone => Exception java.lang.NullPointerException: null [message #1784298 is a reply to message #1784293] Mon, 26 March 2018 12:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6111
Registered: July 2009
Senior Member
Hi

It should work, but...

quite possibly you did not solve the build path issues correctly

an NPE is a legitimate although not very helpful diagnosis; perhaps your test model or more likely test harness is bad

Wiithout a repro, your report is really not much more help that an "it doesn't work" report.

Not sure what you mean by "those OCL-Checks mentioned in ecore".

Regards

Ed Willink
Re: Validate OCL from ecore standalone => Exception java.lang.NullPointerException: null [message #1784299 is a reply to message #1784298] Mon, 26 March 2018 12:10 Go to previous messageGo to next message
Jens Zimmermann is currently offline Jens ZimmermannFriend
Messages: 6
Registered: March 2018
Junior Member
Thanks, Ed, what would you Need to continue discussion here: Since it is possible a build-path-issue the code and Modell would not be enough, but I would Need to communicate the complete Project Setup with all libraries (how)?
Re: Validate OCL from ecore standalone => Exception java.lang.NullPointerException: null [message #1784302 is a reply to message #1784299] Mon, 26 March 2018 12:26 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6111
Registered: July 2009
Senior Member
Hi

Generally a zipped project. See https://wiki.eclipse.org/OCL/ForumNetiquette

Regards

Ed Willink
Re: Validate OCL from ecore standalone => Exception java.lang.NullPointerException: null [message #1784305 is a reply to message #1784302] Mon, 26 March 2018 13:05 Go to previous messageGo to next message
Jens Zimmermann is currently offline Jens ZimmermannFriend
Messages: 6
Registered: March 2018
Junior Member
Thanks, Ed, I attached the important part of an example Project and hope you find everything necessary. If not, feel free to request additional Information / artifacts.
Thanks for investigating.
  • Attachment: workspace.zip
    (Size: 138.94KB, Downloaded 18 times)
Re: Validate OCL from ecore standalone => Exception java.lang.NullPointerException: null [message #1784311 is a reply to message #1784305] Mon, 26 March 2018 15:16 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6111
Registered: July 2009
Senior Member
Hi

Somehow you are mixing and matching the old (org.eclipse.ocl.ecore..., org.eclipse.ocl.uml...) and the new (org.eclipse.ocl.pivot..., org.eclipse.ocl.xtext...) OCL facilities. Please try to identify what steered you towards your init_OclStuff() solution so that I can try to help others avoid the same pitfalls. Unfortunately, while the new code supports the same textual language, the underlying models and API are improved, so it is not a drop-in replacement and I'm not yet ready to force the new as the default. Consequently there are opportunities for mixing and matching that I need to tackle.

If you replace init_OclStuff() by EssentialOCLStandaloneSetup.doSetup(), it works, or rather reports what is probably a genuine validation failure.

Diagnosis of xDemoVal.impl.ObjImpl@7ce69770{file:/E:/Development/Rusa/Workspace/workspace.zip_expanded/XDemoValStandAlone/My.xdemoval#/}
The 'Value_must_be_greater_than_zero' constraint is violated on 'xDemoVal.impl.ObjImpl@7ce69770{file:/E:/Development/Rusa/Workspace/workspace.zip_expanded/XDemoValStandAlone/My.xdemoval#/}'

Did you look at the standalone init section of the OCL Documentation?

You will find that it is worthwhile exploiting the auto-classpath generation of Plugin Projects and MANIFEST.MF for standalone projects too.

Regards

Ed Willink
Re: Validate OCL from ecore standalone => Exception java.lang.NullPointerException: null [message #1784413 is a reply to message #1784311] Tue, 27 March 2018 18:15 Go to previous messageGo to next message
Jens Zimmermann is currently offline Jens ZimmermannFriend
Messages: 6
Registered: March 2018
Junior Member
Many thanks, Ed.
If I remember correctly, next to the Forum entry cited above, the following was leading me into the not-completely-right direction:
- Without any initialization of the OCL stuff I ran a Diagnostician, which then reported "...Unable to find delegate to evaluate the..." which led me to the page
https://wiki.eclipse.org/OCL/FAQ#Unable_to_find_delegate_to_evaluate_the_.27....27_constraint_on_.27....27:_http:.2F.2Fwww.eclipse.org.2Femf.2F2002.2FEcore.2FOCL

Thanks again and best regards
Re: Validate OCL from ecore standalone => Exception java.lang.NullPointerException: null [message #1784465 is a reply to message #1784413] Wed, 28 March 2018 09:19 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6111
Registered: July 2009
Senior Member
Hi

Thanks. I refresh the OCL Documentation every so often. The Wiki and in particular the FAQs need some serious attention. Will do.

Regards

Ed Willink
Previous Topic:Generic Enumeration Literal
Next Topic:Code Generation with external ocl document
Goto Forum:
  


Current Time: Wed Nov 14 23:40:08 GMT 2018

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

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

Back to the top