Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » NPE while loading OCL file(OCL Editor NPE Problem)
NPE while loading OCL file [message #1805858] Thu, 25 April 2019 15:55 Go to next message
Johannes Schmidt is currently offline Johannes SchmidtFriend
Messages: 1
Registered: April 2019
Junior Member
In the Complete OCL Editor, I always get a NullPointerException and my content is underlined in red.

Here the exception
java.lang.NullPointerException
	at org.eclipse.ocl.pivot.internal.complete.AbstractCompletePackages.didRemovePackage(AbstractCompletePackages.java:110)
	at org.eclipse.ocl.pivot.internal.CompletePackageImpl.didRemoveNestedPackage(CompletePackageImpl.java:496)
	at org.eclipse.ocl.pivot.internal.complete.PartialPackages.didRemovePackage(PartialPackages.java:148)
	at org.eclipse.ocl.pivot.internal.complete.ModelListeners.didRemovePackage(ModelListeners.java:47)
	at org.eclipse.ocl.pivot.internal.PackageImpl.didRemovePackage(PackageImpl.java:644)
	at org.eclipse.ocl.pivot.internal.PackageImpl$2.didRemove(PackageImpl.java:701)
	at org.eclipse.ocl.pivot.internal.PackageImpl$2.didRemove(PackageImpl.java:1)
	at org.eclipse.emf.common.util.BasicEList.remove(BasicEList.java:615)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.doRemove(NotifyingListImpl.java:756)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.remove(NotifyingListImpl.java:737)
	at org.eclipse.emf.common.util.AbstractEList.remove(AbstractEList.java:456)
	at org.eclipse.ocl.xtext.base.cs2as.CS2ASConversion.update(CS2ASConversion.java:1477)
	at org.eclipse.ocl.xtext.base.cs2as.CS2AS.update(CS2AS.java:676)
	at org.eclipse.ocl.xtext.base.utilities.CS2ASLinker.afterModelLinked(CS2ASLinker.java:67)
	at org.eclipse.xtext.linking.impl.AbstractCleaningLinker.linkModel(AbstractCleaningLinker.java:57)
	at org.eclipse.xtext.resource.XtextResource.doLinking(XtextResource.java:340)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLinking(LazyLinkingResource.java:121)
	at org.eclipse.ocl.xtext.essentialocl.utilities.EssentialOCLCSResource.doLinking(EssentialOCLCSResource.java:365)
	at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:301)
	at org.eclipse.xtext.resource.XtextResource.updateInternalState(XtextResource.java:290)
	at org.eclipse.xtext.resource.XtextResource.update(XtextResource.java:271)
	at org.eclipse.xtext.ui.editor.reconciler.XtextDocumentReconcileStrategy.doReconcile(XtextDocumentReconcileStrategy.java:182)
	at org.eclipse.xtext.ui.editor.reconciler.XtextDocumentReconcileStrategy.reconcile(XtextDocumentReconcileStrategy.java:90)
	at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler.doRun(XtextReconciler.java:450)
	at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler.access$3(XtextReconciler.java:430)
	at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler$1.process(XtextReconciler.java:364)
	at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler$1.process(XtextReconciler.java:1)
	at org.eclipse.xtext.util.concurrent.IUnitOfWork$Void.exec(IUnitOfWork.java:37)
	at org.eclipse.xtext.resource.OutdatedStateManager.exec(OutdatedStateManager.java:91)
	at org.eclipse.xtext.ui.editor.model.XtextDocument$XtextDocumentLocker.modify(XtextDocument.java:434)
	at org.eclipse.xtext.ui.editor.model.XtextDocument.internalModify(XtextDocument.java:167)
	at org.eclipse.xtext.ui.editor.reconciler.XtextReconciler.run(XtextReconciler.java:361)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)


My OCL file looks like this

import 'model.uml#packageid'


The editor error looks like this

Multiple markers at this line
- The required feature 'pivot::Import::importedNamespace' of
   'null : «null»' must be set
- Unresolved import 'model.uml#packageid' :
   org.eclipse.ocl.pivot.utilities.ParserException: Failed to load
   'platform:/resource/project/final/model.uml.oclas'
   : null


My questions are


  • Should I specify another path type like a URI or something other?
  • What is a *.uml.oclas file?


I use Papyrus for UML 4.1.0, OCL All-in-One SDK 6.7.0

Thank you for your help!

Best Regards


Re: NPE while loading OCL file [message #1806315 is a reply to message #1805858] Tue, 07 May 2019 16:17 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You appear to have written on 25-Apr-2019. Apologies. Somehow your message has only just propagated through the feeds. Raising a Bugzilla would avoid the flaky response times of the Forums.

"model.uml#packageid" looks strange to me. I would expect to see some more after the #.

Internally the Eclipse UML variant of the OMG UML model is normalized to an OCL Pivot Model. The "AbstractCompletePackages.didRemovePackage" is an indication that the OCL Pivot Model is tracking the removal of a UML Package. But your comment does not seem to suggest you were deleting.

A common problem is that UML Packages do not have URIs which may lead to multiple packages sharing the same blank/null URI allowing creation of one to 'delete' another. However I thought I had fixed sufficient bugs in this respect to make it no longer a problem.

Whatever. Clearly you do have a problem, so something, albeit perhaps just a diagnostic, should be better. I need a full repro, at least *.uml and *.ocl and human actions to reproduce. Preferably a zipped project.

The *.uml.oclas is the normal OCL Abstract Syntax Pivot model auto-generated from *..uml. (Similarly *.ecore.oclas). You should not be aware of the *.uml.oclas so a precise sequence of your tool activations and key strokes would be helpful.

Checking through my UML + OCL test suite I see:

import myumlmodel : 'Bug404882.uml#/'
import 'Bug423905.uml'
import 'Bug446007.profile.uml'
import uml : 'http://www.eclipse.org/uml2/5.0.0/UML#/'

variously identified the whole Model implicitly without a fragment or implicitly with a root fragment.

Changing to an xmi:id fragment such as

import myumlmodel : 'Bug404882.uml#_3OZ-0Km6EeG6cMdGet4Yrg'

Are you sure that "model.uml#packageid" is a valid element reference?

If I type a bad reference such as

import myumlmodel : 'Bug404882.uml#packageid'

I see similar editor errors but no stack trace,

Regards

Ed Willink
Previous Topic:Safe OCL
Next Topic:OCL editor exception in eclipse
Goto Forum:
  


Current Time: Thu Apr 25 19:56:07 GMT 2024

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

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

Back to the top