From e3b9e07f1110d557c86480d94f81d0c6ee1ea7e8 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 25 Oct 2021 19:58:15 +0200 Subject: [PATCH] Eliminate parenthesis* variables These three variables are in fact constant and record initial state -- i.e. they shadow two of the method's arguments. So let's remove them them and create a startLevel variable to hold the initial set. JIRA: NETCONF-820 Change-Id: Ic31bf706b28c94edd8e63159c62455422b2f890f Signed-off-by: Robert Varga --- .../utils/parser/ParserFieldsParameter.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameter.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameter.java index 8417229db5..f4b7b77e9b 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameter.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/utils/parser/ParserFieldsParameter.java @@ -153,17 +153,14 @@ public abstract class ParserFieldsParameter { private void parseInput(final @NonNull String input, final @NonNull QNameModule startQNameModule, final @NonNull DataSchemaContextNode startNode, final @NonNull List> parsed, final SchemaContext context) { + final Set startLevel = new HashSet<>(); + parsed.add(startLevel); + int currentPosition = 0; int startPosition = 0; DataSchemaContextNode currentNode = startNode; QNameModule currentQNameModule = startQNameModule; - - Set currentLevel = new HashSet<>(); - parsed.add(currentLevel); - - DataSchemaContextNode parenthesisNode = currentNode; - Set parenthesisLevel = currentLevel; - QNameModule parenthesisQNameModule = currentQNameModule; + Set currentLevel = startLevel; while (currentPosition < input.length()) { final char currentChar = input.charAt(currentPosition); @@ -235,9 +232,9 @@ public abstract class ParserFieldsParameter { currentPosition++; // next nodes can be placed on already utilized level-s - currentNode = parenthesisNode; - currentQNameModule = parenthesisQNameModule; - currentLevel = parenthesisLevel; + currentNode = startNode; + currentQNameModule = startQNameModule; + currentLevel = startLevel; break; default: throw new RestconfDocumentedException( -- 2.36.6