From 5f23e02caa5ab128a4c01866dec91eaea8dc7cee Mon Sep 17 00:00:00 2001 From: jitendra007 Date: Thu, 18 Jun 2020 16:25:39 +0530 Subject: Fixed sonarcloud issues Issue-ID: CLI-270 Signed-off-by: jitendra007 Change-Id: Ibb52afb2fe8fe7c9be4299d1a1cb1e3d32ab0eca --- .../src/main/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommand.java | 8 +------- .../org/onap/cli/fw/snmp/schema/OnapCommandSchemaSnmpLoader.java | 6 ++++-- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'profiles/snmp/src') diff --git a/profiles/snmp/src/main/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommand.java b/profiles/snmp/src/main/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommand.java index 3e841e76..4fc47538 100644 --- a/profiles/snmp/src/main/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommand.java +++ b/profiles/snmp/src/main/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommand.java @@ -116,9 +116,7 @@ public class OnapSnmpCommand extends OnapCommand { String[] oidStrArr = oids.toArray(new String[oids.size()]); - switch (this.command) { - - case OnapCommandSnmpConstants.SNMP_CMD_GET: + if (OnapCommandSnmpConstants.SNMP_CMD_GET.equals(this.command)) { ResponseEvent responseEvent = snmp.send(getPDU(PDU.GET, oidStrArr), getTarget(), null); if ( responseEvent != null) { if (responseEvent.getResponse().getErrorStatus() == PDU.noError) { @@ -138,10 +136,6 @@ public class OnapSnmpCommand extends OnapCommand { } else { throw new OnapSnmpErrorResponse("Failed to send SNMP GET command"); } - break; - - default: - break; } snmp.close(); } catch (IOException ex) { diff --git a/profiles/snmp/src/main/java/org/onap/cli/fw/snmp/schema/OnapCommandSchemaSnmpLoader.java b/profiles/snmp/src/main/java/org/onap/cli/fw/snmp/schema/OnapCommandSchemaSnmpLoader.java index ca3f44e0..0d708202 100644 --- a/profiles/snmp/src/main/java/org/onap/cli/fw/snmp/schema/OnapCommandSchemaSnmpLoader.java +++ b/profiles/snmp/src/main/java/org/onap/cli/fw/snmp/schema/OnapCommandSchemaSnmpLoader.java @@ -27,7 +27,9 @@ import org.onap.cli.fw.snmp.conf.OnapCommandSnmpConstants; import org.onap.cli.fw.utils.OnapCommandUtils; public class OnapCommandSchemaSnmpLoader { - + private OnapCommandSchemaSnmpLoader() { + throw new IllegalStateException("Utility class"); + } private static List validateSnmpSchemaSection(Map values) { ArrayList errorList = new ArrayList<>(); @@ -61,7 +63,7 @@ public class OnapCommandSchemaSnmpLoader { case OnapCommandSnmpConstants.SNMP_COMMAND: cmd.setCommand((String) entry.getValue()); - + break; default: break; } -- cgit 1.2.3-korg