Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Validation problems
Validation problems [message #1834877] Thu, 19 November 2020 15:00 Go to next message
Oliver Gardiner is currently offline Oliver GardinerFriend
Messages: 50
Registered: May 2014
Location: Oxford, UK
Member
I have an RCP built on Papyrus so that I can add tooling specific to our DSML. We have a specific Profile we use but the models we create are straight UML so can also be edited in vanilla Papyrus. I want to add some validation constraints to our RCP and so have created the requisite plugin but the validation threw an exception when run. I tried running validation in the Papyrus RCP against the same model and got the same result. I then tried creating a small model from scratch with our profile applied and the validation ran without errors.

Unsurprisingly, I conclude from that that we have somehow managed to corrupt our model such that it breaks validation. That leaves me with two questions:
1) Might it be possible in future to stop the validation from failing and instead identify where the issue is with the model?
2) Is there any hope of tracking down the nature of the issue with the model from the error in the log?

The log entry is below.

Thanks,

Oliver

!ENTRY org.eclipse.emf.edit.ui 2 0 2020-11-19 14:44:13.070
!MESSAGE
!STACK 0
java.lang.reflect.InvocationTargetException
at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:397)
at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:469)
at org.eclipse.papyrus.infra.services.validation.commands.AbstractValidateCommand.runValidation(AbstractValidateCommand.java:169)
at org.eclipse.papyrus.infra.services.validation.commands.ValidateModelCommand.doExecuteWithResult(ValidateModelCommand.java:79)
at org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand.doExecute(AbstractTransactionalCommand.java:248)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper.execute(GMFtoEMFCommandWrapper.java:123)
at org.eclipse.papyrus.infra.services.validation.handler.AbstractCommandHandler.execute(AbstractCommandHandler.java:157)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:319)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:253)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:438)
at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:449)
at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:475)
at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem$$Lambda$429/0000000000000000.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4213)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1037)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4030)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3630)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1158)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1047)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:658)
at org.eclipse.ui.internal.Workbench$$Lambda$208/0000000000000000.run(Unknown Source)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:557)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:154)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:150)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
Caused by: java.lang.NullPointerException
at org.eclipse.ocl.pivot.uml.internal.labels.SlotLabelGenerator.buildLabelFor(SlotLabelGenerator.java:29)
at org.eclipse.ocl.pivot.uml.internal.labels.SlotLabelGenerator.buildLabelFor(SlotLabelGenerator.java:1)
at org.eclipse.ocl.pivot.labels.LabelGeneratorRegistry.buildSubLabelFor(LabelGeneratorRegistry.java:216)
at org.eclipse.ocl.pivot.labels.LabelGeneratorRegistry.buildLabelFor(LabelGeneratorRegistry.java:197)
at org.eclipse.ocl.pivot.labels.AbstractLabelGeneratorBuilder.buildLabelFor(AbstractLabelGeneratorBuilder.java:44)
at org.eclipse.ocl.pivot.labels.LabelGeneratorRegistry.labelFor(LabelGeneratorRegistry.java:300)
at org.eclipse.ocl.pivot.utilities.NameUtil.qualifiedNameFor(NameUtil.java:173)
at org.eclipse.ocl.pivot.utilities.LabelUtil.getLabel(LabelUtil.java:282)
at org.eclipse.ocl.pivot.internal.labels.LabelSubstitutionLabelProvider.getObjectLabel(LabelSubstitutionLabelProvider.java:26)
at org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(EObjectValidator.java:103)
at org.eclipse.uml2.uml.util.UMLValidator.validate_MultiplicityConforms(UMLValidator.java:26901)
at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryMultiplicityConforms(EObjectValidator.java:579)
at org.eclipse.uml2.uml.util.UMLValidator.validateSlot(UMLValidator.java:12663)
at org.eclipse.uml2.uml.util.UMLValidator.validate(UMLValidator.java:4151)
at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:324)
at org.eclipse.ocl.pivot.validation.ComposedEValidator.validate(ComposedEValidator.java:125)
at org.eclipse.papyrus.uml.service.validation.internal.OCLEValidatorAdapter.validate(OCLEValidatorAdapter.java:94)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:82)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:309)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:122)
at org.eclipse.papyrus.infra.services.validation.commands.AbstractValidateCommand.validate(AbstractValidateCommand.java:228)
at org.eclipse.papyrus.infra.services.validation.commands.ValidationOperation.run(ValidationOperation.java:58)
at org.eclipse.papyrus.infra.ui.util.TransactionUIHelper$2.run(TransactionUIHelper.java:120)
at org.eclipse.emf.transaction.impl.PrivilegedRunnable.run(PrivilegedRunnable.java:87)
at org.eclipse.papyrus.infra.ui.util.TransactionUIHelper$PrivilegedRunnableWithProgress.run(TransactionUIHelper.java:158)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Root exception:
java.lang.NullPointerException
at org.eclipse.ocl.pivot.uml.internal.labels.SlotLabelGenerator.buildLabelFor(SlotLabelGenerator.java:29)
at org.eclipse.ocl.pivot.uml.internal.labels.SlotLabelGenerator.buildLabelFor(SlotLabelGenerator.java:1)
at org.eclipse.ocl.pivot.labels.LabelGeneratorRegistry.buildSubLabelFor(LabelGeneratorRegistry.java:216)
at org.eclipse.ocl.pivot.labels.LabelGeneratorRegistry.buildLabelFor(LabelGeneratorRegistry.java:197)
at org.eclipse.ocl.pivot.labels.AbstractLabelGeneratorBuilder.buildLabelFor(AbstractLabelGeneratorBuilder.java:44)
at org.eclipse.ocl.pivot.labels.LabelGeneratorRegistry.labelFor(LabelGeneratorRegistry.java:300)
at org.eclipse.ocl.pivot.utilities.NameUtil.qualifiedNameFor(NameUtil.java:173)
at org.eclipse.ocl.pivot.utilities.LabelUtil.getLabel(LabelUtil.java:282)
at org.eclipse.ocl.pivot.internal.labels.LabelSubstitutionLabelProvider.getObjectLabel(LabelSubstitutionLabelProvider.java:26)
at org.eclipse.emf.ecore.util.EObjectValidator.getObjectLabel(EObjectValidator.java:103)
at org.eclipse.uml2.uml.util.UMLValidator.validate_MultiplicityConforms(UMLValidator.java:26901)
at org.eclipse.emf.ecore.util.EObjectValidator.validate_EveryMultiplicityConforms(EObjectValidator.java:579)
at org.eclipse.uml2.uml.util.UMLValidator.validateSlot(UMLValidator.java:12663)
at org.eclipse.uml2.uml.util.UMLValidator.validate(UMLValidator.java:4151)
at org.eclipse.emf.ecore.util.EObjectValidator.validate(EObjectValidator.java:324)
at org.eclipse.ocl.pivot.validation.ComposedEValidator.validate(ComposedEValidator.java:125)
at org.eclipse.papyrus.uml.service.validation.internal.OCLEValidatorAdapter.validate(OCLEValidatorAdapter.java:94)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:82)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:309)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:143)
at org.eclipse.emf.ecore.util.Diagnostician.doValidateContents(Diagnostician.java:313)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.doValidateContents(UMLDiagnostician.java:110)
at org.eclipse.papyrus.infra.services.validation.internal.EcoreDiagnostician.validate(EcoreDiagnostician.java:85)
at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:190)
at org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate(UMLDiagnostician.java:122)
at org.eclipse.papyrus.infra.services.validation.commands.AbstractValidateCommand.validate(AbstractValidateCommand.java:228)
at org.eclipse.papyrus.infra.services.validation.commands.ValidationOperation.run(ValidationOperation.java:58)
at org.eclipse.papyrus.infra.ui.util.TransactionUIHelper$2.run(TransactionUIHelper.java:120)
at org.eclipse.emf.transaction.impl.PrivilegedRunnable.run(PrivilegedRunnable.java:87)
at org.eclipse.papyrus.infra.ui.util.TransactionUIHelper$PrivilegedRunnableWithProgress.run(TransactionUIHelper.java:158)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
Re: Validation problems [message #1834878 is a reply to message #1834877] Thu, 19 November 2020 15:07 Go to previous messageGo to next message
Oliver Gardiner is currently offline Oliver GardinerFriend
Messages: 50
Registered: May 2014
Location: Oxford, UK
Member
I'm going to try debug with a breakpoint at the root cause:

public final class SlotLabelGenerator extends AbstractLabelGenerator<Slot>
{
public static void initialize(Registry registry) {
registry.install(Slot.class, new SlotLabelGenerator());
}

public SlotLabelGenerator() {
super(Slot.class);
}

@Override
public void buildLabelFor(@NonNull Builder labelBuilder, @NonNull Slot object) {
String name = object.getDefiningFeature().getName();
if (name != null)
labelBuilder.appendString(name);
else {
labelBuilder.appendString("<null-featured-");
labelBuilder.appendString(object.getClass().getSimpleName());
labelBuilder.appendString(">");
}
}
}

It's clearly failing to get the name so I'm assuming that the issue is the xmi reference to the defining feature being broken leading to the getDefiningFeature returning null - would it be possible to put in a null test on that call to flag the problem before then making the call to getName()?

Thanks,

Oliver
Re: Validation problems [message #1834880 is a reply to message #1834878] Thu, 19 November 2020 15:49 Go to previous messageGo to next message
Oliver Gardiner is currently offline Oliver GardinerFriend
Messages: 50
Registered: May 2014
Location: Oxford, UK
Member
I've tracked this down to Instance Specifications - if you create an Instance Specification and then add a Slot, it defaults to <UNDEFINED> for the Defining Feature and it looks like this will lead to the validation failing as described. Given that this is a model state that is easy to create through the UI (rather than, e.g. the model having been damaged in some opaque way), I think would be appropriate put in the null check.

Thanks,

Oliver
Re: Validation problems [message #1834887 is a reply to message #1834880] Thu, 19 November 2020 19:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You omit the packaging but I presume you are referring to org.eclipse.ocl.pivot.uml.internal.labels.SlotLabelGenerator which is part of the OCL support and so might confuse the Papyrus developers.

While a null check could be added to the code, this is not really what validation is about.

Validation is intended amongst other things to gain insight into a defective model. A stack trace is absolutely not the user-friendly response. Even worse as here for the stack trace to be produced while attempting to report an earlier failure.

Unfortunately the EMF API is that validation never fails to diagnose, but any non-trivial validation code given a bad model may crash and it is infeasible to code for every possible defective model, let alone recode every called EMF routine on the off chance that it might be tripped up by the defect, therefore it is the responsibility of the outer level validation (probably org.eclipse.papyrus.uml.service.validation.internal.UMLDiagnostician.validate) to catch the Exception convert it to an error wrt the defective model element and continue validation for the rest of the model. Consequently the validation dialog details should show the stack trace along with all the other problems which will probably show that a diagnostic had already been created for the bad definingFeature.. The EMF dialog was recently improved to ensure that these details are now more consistently available.

Regards

Ed Willink

[Updated on: Thu, 19 November 2020 19:57]

Report message to a moderator

Re: Validation problems [message #1834889 is a reply to message #1834887] Thu, 19 November 2020 20:17 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

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

Regards

Ed Willink
Previous Topic:Alf Editor is unavailable
Next Topic:Profile defined classes
Goto Forum:
  


Current Time: Thu Apr 25 00:43:14 GMT 2024

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

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

Back to the top