From bbc81d85bda5e9c446e3218e30b1ba5bdf3dc3e0 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Sat, 31 Aug 2024 22:06:12 +0100 Subject: [Cps Path Parser] Remove unneeded validation in grammar The invalid prefix/postfix is not needed; existing tests show that PathParsingException is thrown in for invalid paths. Issue-ID: CPS-2365 Signed-off-by: danielhanrahan Change-Id: I202f0ca0bc5eb768fc3af711180405882dafc22d --- .../main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java | 11 ----------- 1 file changed, 11 deletions(-) (limited to 'cps-path-parser/src/main/java/org/onap') diff --git a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java index 0bb09235ff..66964bbc47 100644 --- a/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java +++ b/cps-path-parser/src/main/java/org/onap/cps/cpspath/parser/CpsPathBuilder.java @@ -29,7 +29,6 @@ import org.onap.cps.cpspath.parser.antlr4.CpsPathBaseListener; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.AncestorAxisContext; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.DescendantContext; -import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.IncorrectPrefixContext; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.LeafConditionContext; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.MultipleLeafConditionsContext; import org.onap.cps.cpspath.parser.antlr4.CpsPathParser.PrefixContext; @@ -57,11 +56,6 @@ public class CpsPathBuilder extends CpsPathBaseListener { private final List comparativeOperators = new ArrayList<>(); - @Override - public void exitInvalidPostFix(final CpsPathParser.InvalidPostFixContext ctx) { - throw new PathParsingException(ctx.getText()); - } - @Override public void exitPrefix(final PrefixContext ctx) { cpsPathQuery.setXpathPrefix(normalizedXpathBuilder.toString()); @@ -72,11 +66,6 @@ public class CpsPathBuilder extends CpsPathBaseListener { cpsPathQuery.setNormalizedParentPath(normalizedXpathBuilder.toString()); } - @Override - public void exitIncorrectPrefix(final IncorrectPrefixContext ctx) { - throw new PathParsingException("CPS path can only start with one or two slashes (/)"); - } - @Override public void exitLeafCondition(final LeafConditionContext ctx) { final Object comparisonValue; -- cgit 1.2.3-korg