From 2d186df9e3ed47599dbc86c2f435f7884535398c Mon Sep 17 00:00:00 2001 From: liamfallon Date: Wed, 16 Jun 2021 12:08:01 +0100 Subject: Clean up CLAMP Sonar and checkstyle issues This commit cleans up sonar and checkstyle issues identified in the CLAMP repository. Issue-ID: POLICY-3206 Change-Id: I16b61bbe771cc17de15183a24b2a5e82a8d35872 Signed-off-by: liamfallon --- .../participant/dcae/main/parameters/CommonTestData.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'participant/participant-impl/participant-impl-dcae/src/test/java') diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java index cb06fcb15..5d8881eb3 100644 --- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java +++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/parameters/CommonTestData.java @@ -59,16 +59,19 @@ public class CommonTestData { /** * Converts the contents of a map to a parameter class. * + * @param specific type of ParameterGroup class * @param source property map * @param clazz class of object to be created from the map * @return a new object represented by the map + * @throws ControlLoopRuntimeException on errors */ public T toObject(final Map source, final Class clazz) { try { return coder.convert(source, clazz); } catch (final CoderException e) { - throw new RuntimeException("cannot create " + clazz.getName() + " from map", e); + throw new ControlLoopRuntimeException(Response.Status.INTERNAL_SERVER_ERROR, + "cannot create " + clazz.getName() + " from map", e); } } @@ -95,6 +98,7 @@ public class CommonTestData { * * @param isEmpty boolean value to represent that object created should be empty or not * @return a property map suitable for constructing an object + * @throws ControlLoopRuntimeException on errors */ public Map getClampClientParametersMap(final boolean isEmpty) { final Map map = new TreeMap<>(); @@ -121,6 +125,7 @@ public class CommonTestData { * * @param isEmpty boolean value to represent that object created should be empty or not * @return a property map suitable for constructing an object + * @throws ControlLoopRuntimeException on errors */ public Map getConsulClientParametersMap(final boolean isEmpty) { final Map map = new TreeMap<>(); @@ -228,6 +233,7 @@ public class CommonTestData { * * @param port port to be inserted into the parameters * @return the standard participant parameters + * @throws ControlLoopRuntimeException on errors */ public ParticipantDcaeParameters getParticipantParameterGroup(int port) { try { @@ -244,6 +250,7 @@ public class CommonTestData { * * @param port port to be inserted into the parameters * @return the standard participant parameters + * @throws ControlLoopRuntimeException on errors */ public static String getParticipantParameterGroupAsString(int port) { @@ -289,6 +296,7 @@ public class CommonTestData { * * @param status the status of Partecipant * @return the JSON + * @throws ControlLoopRuntimeException on errors */ public static String createJsonStatus(String status) { try { -- cgit 1.2.3-korg