From 808cf997318c94f5f3268049a8b80f395141eb3e Mon Sep 17 00:00:00 2001 From: aishkashyap Date: Mon, 15 Jan 2018 13:55:18 +0530 Subject: Sonar Minor:Define a constant instead of literal. Define a constant instead of duplicating this literal depth. Sonar Link: https://sonar.onap.org/component_issues/index?id=org.onap.aai.traversal%3Atraversal#resolved=false|assignees=aishkashyap Location: src/main/java/org/onap/aai/rest/QueryConsumer.java Line No:186 Issue-ID: AAI-656 Change-Id: I92e4753aa501d939bd1b85732fcadeaebfbdef16 Signed-off-by: aishkashyap --- aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'aai-traversal/src/main/java') diff --git a/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java b/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java index b5f2658..9e7edeb 100644 --- a/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java +++ b/aai-traversal/src/main/java/org/onap/aai/rest/QueryConsumer.java @@ -70,6 +70,8 @@ import com.google.gson.JsonParser; @Path("{version: v9|v1[012]}/query") public class QueryConsumer extends RESTAPI { + + private static final String DEPTH = "depth"; /** The introspector factory type. */ private ModelType introspectorFactoryType = ModelType.MOXY; @@ -183,8 +185,8 @@ public class QueryConsumer extends RESTAPI { public void checkQueryParams(MultivaluedMap params) throws AAIException { - if (params.containsKey("depth") && params.getFirst("depth").matches("\\d+")) { - String depth = params.getFirst("depth"); + if (params.containsKey(DEPTH) && params.getFirst(DEPTH).matches("\\d+")) { + String depth = params.getFirst(DEPTH); Integer i = Integer.parseInt(depth); if (i > 1) { throw new AAIException("AAI_3303"); -- cgit 1.2.3-korg