From e022b95b2dd08661fa1a91c9fd0e85d0c8ac0c44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Henning?= <stu114708@informatik.uni-kiel.de> Date: Wed, 6 Apr 2016 17:47:58 +0200 Subject: [PATCH] throw exception on failed edge adding --- .../java/kieker/analysis/graph/impl/ExceptionFactory.java | 4 ++++ src/main/java/kieker/analysis/graph/impl/GraphImpl.java | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/kieker/analysis/graph/impl/ExceptionFactory.java b/src/main/java/kieker/analysis/graph/impl/ExceptionFactory.java index f437379e..862e44aa 100644 --- a/src/main/java/kieker/analysis/graph/impl/ExceptionFactory.java +++ b/src/main/java/kieker/analysis/graph/impl/ExceptionFactory.java @@ -33,6 +33,10 @@ class ExceptionFactory { return new IllegalStateException("Edge with id does not exist: " + id); } + public static IllegalStateException verticesAreNotInSameGraph(final Object id1, final Object id2) { + return new IllegalStateException("Vertices with ids are not in the same graph: " + id1 + ", " + id2); + } + public static IllegalArgumentException bothIsNotSupported() { return new IllegalArgumentException("A direction of BOTH is not supported"); } diff --git a/src/main/java/kieker/analysis/graph/impl/GraphImpl.java b/src/main/java/kieker/analysis/graph/impl/GraphImpl.java index 8bb08ffe..58cccb73 100644 --- a/src/main/java/kieker/analysis/graph/impl/GraphImpl.java +++ b/src/main/java/kieker/analysis/graph/impl/GraphImpl.java @@ -89,8 +89,7 @@ public class GraphImpl extends ElementImpl implements Graph { } if (outVertexParents.peek().graph != inVertexParents.peek().graph) { - // throw exception TODO - throw new IllegalStateException(); + throw ExceptionFactory.verticesAreNotInSameGraph(outVertex.getId(), inVertex.getId()); } GraphImpl firstEqualParent = null; -- GitLab