Skip to content

Commit ba8d513

Browse files
committed
more parse safety
1 parent b07986b commit ba8d513

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/main/java/org/variantsync/diffdetective/diff/difftree/serialize/edgeformat/EdgeLabelFormat.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.variantsync.diffdetective.diff.difftree.DiffNode;
44
import org.variantsync.diffdetective.diff.difftree.LineGraphConstants;
55
import org.variantsync.diffdetective.diff.difftree.serialize.LinegraphFormat;
6+
import org.variantsync.diffdetective.util.Assert;
67
import org.variantsync.diffdetective.util.StringUtils;
78
import org.variantsync.functjonal.Pair;
89

@@ -49,14 +50,14 @@ public Direction getEdgeDirection() {
4950
protected void connectAccordingToLabel(final DiffNode child, final DiffNode parent, final String edgeLabel) {
5051
if (edgeLabel.startsWith(LineGraphConstants.BEFORE_AND_AFTER_PARENT)) {
5152
// Nothing has been changed. The child-parent relationship remains the same
52-
parent.addAfterChild(child);
53-
parent.addBeforeChild(child);
53+
Assert.assertTrue(parent.addAfterChild(child));
54+
Assert.assertTrue(parent.addBeforeChild(child));
5455
} else if (edgeLabel.startsWith(LineGraphConstants.BEFORE_PARENT)) {
5556
// The child DiffNode lost its parent DiffNode (an orphan DiffNode)
56-
parent.addBeforeChild(child);
57+
Assert.assertTrue(parent.addBeforeChild(child));
5758
} else if (edgeLabel.startsWith(LineGraphConstants.AFTER_PARENT)) {
5859
// The parent DiffNode has a new child DiffNode
59-
parent.addAfterChild(child);
60+
Assert.assertTrue(parent.addAfterChild(child));
6061
} else {
6162
throw new IllegalArgumentException("Syntax error. Invalid name in edge label " + edgeLabel);
6263
}

0 commit comments

Comments
 (0)