osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
39 stars 8 forks source link

ClassCastException in FTA #2177

Closed lwrage closed 4 years ago

lwrage commented 4 years ago

Summary

When running an FTA on the attached model no fault tree is created. There is also no error message displayed.

Expected and Current Behavior

Either a fault tree should be created or an error message displayed if something is wrong with the model.

A ClassCastException is recorded in the error log:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2020-01-22 12:52:27.801
!MESSAGE Command 'org.osate.aadl2.errormodel.analysis.fta' failed
!STACK 0
org.eclipse.core.commands.ExecutionException: Error executing 'org.osate.aadl2.errormodel.analysis.fta': java.lang.ClassCastException: org.osate.xtext.aadl2.errormodel.errorModel.impl.TypeTokenImpl cannot be cast to org.osate.aadl2.errormodel.FaultTree.Event
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:170)
    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.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5676)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1423)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4935)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4429)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1049)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:660)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:559)
    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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    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:1465)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
Caused by: org.eclipse.e4.core.di.InjectionException: java.lang.ClassCastException: org.osate.xtext.aadl2.errormodel.errorModel.impl.TypeTokenImpl cannot be cast to org.osate.aadl2.errormodel.FaultTree.Event
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:68)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:318)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:252)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
    ... 33 more
Caused by: java.lang.ClassCastException: org.osate.xtext.aadl2.errormodel.errorModel.impl.TypeTokenImpl cannot be cast to org.osate.aadl2.errormodel.FaultTree.Event
    at org.osate.aadl2.errormodel.faulttree.generation.FTAGenerator.finalizeAsOrEvents(FTAGenerator.java:182)
    at org.osate.aadl2.errormodel.faulttree.generation.FTAGenerator.postProcessOr(FTAGenerator.java:1048)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.processCondition(PropagationGraphBackwardTraversal.java:688)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.handleOutgoingErrorPropagationCondition(PropagationGraphBackwardTraversal.java:379)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.traverseOutgoingErrorPropagation(PropagationGraphBackwardTraversal.java:158)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.traverseIncomingErrorPropagation(PropagationGraphBackwardTraversal.java:1008)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.processCondition(PropagationGraphBackwardTraversal.java:875)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.processCondition(PropagationGraphBackwardTraversal.java:683)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.traverseErrorBehaviorState(PropagationGraphBackwardTraversal.java:554)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.traverseCompositeErrorState(PropagationGraphBackwardTraversal.java:1063)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.processCondition(PropagationGraphBackwardTraversal.java:729)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.processCondition(PropagationGraphBackwardTraversal.java:666)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.traverseCompositeErrorState(PropagationGraphBackwardTraversal.java:1051)
    at org.osate.aadl2.errormodel.PropagationGraph.util.PropagationGraphBackwardTraversal.traverseCompositeErrorState(PropagationGraphBackwardTraversal.java:1041)
    at org.osate.aadl2.errormodel.faulttree.generation.FTAGenerator.getftaModel(FTAGenerator.java:82)
    at org.osate.aadl2.errormodel.faulttree.generation.CreateFTAModel.createModel(CreateFTAModel.java:104)
    at org.osate.aadl2.errormodel.faulttree.handler.FTAHandler.execute(FTAHandler.java:155)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
    ... 37 more

Steps to Reproduce

  1. Import project Issue2177 from the zip file below
  2. Instantiate Platform.EMV2 from Platform_Test_Harness.aadl
  3. Run FTA (with defaults in dialog) on the instance model

issue2177.zip

Environment

reteprelief commented 4 years ago

Interesting recursion problem. It is due to them using out propagations in conditions - only in propagations should be allowed unless the condition references subcomponents. In addition the example uses the same condition to trigger a transition, and to specify an out propagation condition which is based on the state the transition goes to. We need to add a validation and fix the backward traversal code to recognize the cycle.

reteprelief commented 4 years ago

I will make a pass at this.

yoogx commented 4 years ago

If you add a validation; does it mean we miss an implementation of a legality rule? or we also miss this legality rule ? (asking for a friend in charge of updating the standard ;-)

reteprelief commented 4 years ago

I’ll check for that. We may already have one.

From: Jerome Hugues notifications@github.com Sent: Tuesday, January 28, 2020 8:08 AM To: osate/osate2 osate2@noreply.github.com Cc: Peter Feiler phf@sei.cmu.edu; Assign assign@noreply.github.com Subject: Re: [osate/osate2] ClassCastException in FTA (#2177)

If you add a validation; does it mean we miss an implementation of a legality rule? or we also miss this legality rule ? (asking for a friend in charge of updating the standard ;-)

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHubhttps://github.com/osate/osate2/issues/2177?email_source=notifications&email_token=AAFXHOBFNPSWQVMDCUBSGVTRAAU3NA5CNFSM4KKJ2W5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKDHJUA#issuecomment-579237072, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAFXHOE7O3ZWWUHNFHG4LSLRAAU3NANCNFSM4KKJ2W5A.

reteprelief commented 4 years ago

The legality rule is there. It is actually a set of naming rules in E.8

From: Jerome Hugues notifications@github.com Sent: Tuesday, January 28, 2020 8:08 AM To: osate/osate2 osate2@noreply.github.com Cc: Peter Feiler phf@sei.cmu.edu; Assign assign@noreply.github.com Subject: Re: [osate/osate2] ClassCastException in FTA (#2177)

If you add a validation; does it mean we miss an implementation of a legality rule? or we also miss this legality rule ? (asking for a friend in charge of updating the standard ;-)

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHubhttps://github.com/osate/osate2/issues/2177?email_source=notifications&email_token=AAFXHOBFNPSWQVMDCUBSGVTRAAU3NA5CNFSM4KKJ2W5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKDHJUA#issuecomment-579237072, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAFXHOE7O3ZWWUHNFHG4LSLRAAU3NANCNFSM4KKJ2W5A.

sklarskyRC commented 4 years ago

I'm watching this issue since I reported it and wondering if there is a recommended change to the model needed, or if the issue resides in the tooling?

reteprelief commented 4 years ago

One problem is that in your transition condition and outgoing propagation condition you refer to outgoing propagations instead of incoming propagations. The validation should give you an error message. I have added a fix for that. I am looking into why we do not detect the resulting cycle of propagation

Here is a fragment of SUbsys2A.EMV2 with the condition changed. For the outgoing propagation condition it is sufficient to idicate that the state causes outpropagation as the transition rule is applied first, resulting in the transition tho the MisleadingData state.

sklarskyRC commented 4 years ago

Thank you. I do not see a fragment of Subsys2A.EMV2 in your previous comment, but I do see my error in using the outgoing propagation in the transition instead of the incoming propagation. That was an oversight on my part.

I am attempting to have an error flow that is linear and starts and end in Subsys1. The path is that it start is Subsys1, goes to Subsys2A, then Subsys2B, then back to Subsys2A, and back to Subsys1 where it ends. What comes in to Subsys1 should have no effect on what goes out of Subsys1.

reteprelief commented 4 years ago

I figured out that's what you want to do. Actively working on the fix. WIll send you my variant of the model when everything works.

reteprelief commented 4 years ago

Attached is the revised model of yours that I used in fixing and testing FTA.

Issue2177.zip

There is now a pull request to be reviewed by Lutz or Jerome. Once that is through you can pick up the fix on the nightly build.