Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2017-08-08 04:52:22 -0400
committerHenrik Rentz-Reichert2017-08-08 04:52:22 -0400
commitbfe4211ba3573727e5c43e42f32ec8a2fa6e1054 (patch)
tree288543ae77078ce968ff9910bf69c492dbb904ac
parentbfadd8fc9c19549d45a496bbcfeba1af0c60d8c8 (diff)
downloadorg.eclipse.etrice-bfe4211ba3573727e5c43e42f32ec8a2fa6e1054.tar.gz
org.eclipse.etrice-bfe4211ba3573727e5c43e42f32ec8a2fa6e1054.tar.xz
org.eclipse.etrice-bfe4211ba3573727e5c43e42f32ec8a2fa6e1054.zip
made ReachabilityValidator more robust
-rw-r--r--plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java10
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel.fsm/src-gen/org/eclipse/etrice/core/genmodel/fsm/fsmgen/impl/LinkImpl.java2
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend3
-rw-r--r--plugins/org.eclipse.etrice.core.genmodel.fsm/xtend-gen/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.java6
-rw-r--r--plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java9
5 files changed, 26 insertions, 4 deletions
diff --git a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
index 61f3cde66..f575cca20 100644
--- a/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
+++ b/plugins/org.eclipse.etrice.abstractexec.behavior/src/org/eclipse/etrice/abstractexec/behavior/ReachabilityValidator.java
@@ -27,8 +27,10 @@ import org.eclipse.etrice.core.common.validation.ICustomValidator;
import org.eclipse.etrice.core.fsm.fSM.FSMPackage;
import org.eclipse.etrice.core.fsm.fSM.ModelComponent;
import org.eclipse.etrice.core.genmodel.fsm.ExtendedFsmGenBuilder;
+import org.eclipse.etrice.core.genmodel.fsm.FsmGenChecker;
import org.eclipse.etrice.core.genmodel.fsm.FsmGenExtensions;
import org.eclipse.etrice.core.genmodel.fsm.NullDiagnostician;
+import org.eclipse.etrice.core.genmodel.fsm.NullLogger;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphContainer;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.GraphItem;
import org.eclipse.etrice.core.genmodel.fsm.fsmgen.Link;
@@ -72,6 +74,11 @@ public class ReachabilityValidator implements ICustomValidator {
GraphContainer gc;
try {
gc = builder.createTransformedModel(mc);
+ NullLogger logger = new NullLogger();
+ FsmGenChecker.check(gc, logger);
+ if (logger.hasErrors()) {
+ return;
+ }
builder.withTriggersInStates(gc);
}
catch (Throwable t) {
@@ -89,6 +96,9 @@ public class ReachabilityValidator implements ICustomValidator {
GraphItem toCheck = (GraphItem) item;
if (!checker.isReachable(toCheck)) {
String name = FsmGenExtensions.getName(toCheck);
+ if (name==null) {
+ name = "<no name>";
+ }
EObject stateGraphItem = (toCheck instanceof Node) ?
((Node) toCheck).getStateGraphNode() : ((Link) toCheck).getTransition();
diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/src-gen/org/eclipse/etrice/core/genmodel/fsm/fsmgen/impl/LinkImpl.java b/plugins/org.eclipse.etrice.core.genmodel.fsm/src-gen/org/eclipse/etrice/core/genmodel/fsm/fsmgen/impl/LinkImpl.java
index a61a36a53..e3190f0c8 100644
--- a/plugins/org.eclipse.etrice.core.genmodel.fsm/src-gen/org/eclipse/etrice/core/genmodel/fsm/fsmgen/impl/LinkImpl.java
+++ b/plugins/org.eclipse.etrice.core.genmodel.fsm/src-gen/org/eclipse/etrice/core/genmodel/fsm/fsmgen/impl/LinkImpl.java
@@ -416,7 +416,7 @@ public class LinkImpl extends GraphItemImpl implements Link {
return "Link initial -> " + getTarget().toString() + " (InitialTransition)";
}
else if (getTransition() instanceof NonInitialTransition) {
- return "Link " + getSource().toString() + " -> " + getTarget().toString() + " (InitialTransition)";
+ return "Link " + getSource().toString() + " -> " + getTarget().toString() + " (NonInitialTransition)";
}
else if (getTransition() instanceof RefinedTransition) {
return "RefinedTransition";
diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend b/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend
index 400150348..ba6fd869a 100644
--- a/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend
+++ b/plugins/org.eclipse.etrice.core.genmodel.fsm/src/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.xtend
@@ -89,6 +89,9 @@ class FsmGenChecker {
else if (stateGraphNode.getName()==null) {
logger.logError("ROOM graph node without name")
}
+ else if (graph==null) {
+ logger.logError("node isn't contained in a graph")
+ }
// incoming transitions
for (l : incoming) {
diff --git a/plugins/org.eclipse.etrice.core.genmodel.fsm/xtend-gen/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.java b/plugins/org.eclipse.etrice.core.genmodel.fsm/xtend-gen/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.java
index 602558a1b..9f5bc48b2 100644
--- a/plugins/org.eclipse.etrice.core.genmodel.fsm/xtend-gen/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.java
+++ b/plugins/org.eclipse.etrice.core.genmodel.fsm/xtend-gen/org/eclipse/etrice/core/genmodel/fsm/FsmGenChecker.java
@@ -162,6 +162,12 @@ public class FsmGenChecker {
boolean _equals_2 = Objects.equal(_name, null);
if (_equals_2) {
logger.logError("ROOM graph node without name");
+ } else {
+ Graph _graph = it.getGraph();
+ boolean _equals_3 = Objects.equal(_graph, null);
+ if (_equals_3) {
+ logger.logError("node isn\'t contained in a graph");
+ }
}
}
}
diff --git a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java
index 5945e2342..102cbe383 100644
--- a/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java
+++ b/plugins/org.eclipse.etrice.core.room/src/org/eclipse/etrice/core/validation/RoomJavaValidator.java
@@ -641,9 +641,12 @@ public class RoomJavaValidator extends AbstractRoomJavaValidator {
@Check
public void checkMessageFromIf(MessageFromIf mfi){
- if(mfi.getFrom() != null){
- if(roomHelpers.getProtocol((InterfaceItem)mfi.getFrom()).getCommType() != CommunicationType.EVENT_DRIVEN)
- error("port must have event driven protocol", mfi, FSMPackage.eINSTANCE.getMessageFromIf_From());
+ if (mfi.getFrom() != null){
+ ProtocolClass protocol = roomHelpers.getProtocol((InterfaceItem)mfi.getFrom());
+ if (protocol!=null && !protocol.eIsProxy()) {
+ if (protocol.getCommType() != CommunicationType.EVENT_DRIVEN)
+ error("port must have event driven protocol", mfi, FSMPackage.eINSTANCE.getMessageFromIf_From());
+ }
}
}

Back to the top