summaryrefslogtreecommitdiffstats
path: root/profiles/snmp/src
diff options
context:
space:
mode:
authorjitendra007 <jitendra.sharma1@huawei.com>2020-06-18 16:25:39 +0530
committerpriyanka.akhade <priyanka.akhade@huawei.com>2020-07-09 13:06:31 +0530
commit5f23e02caa5ab128a4c01866dec91eaea8dc7cee (patch)
treeca3c4f31dc56ce64aa9c0165b8cac4dab8e70b7c /profiles/snmp/src
parentc3391bef9e04c2ad38ed96bd28a5c43ab6d961de (diff)
Fixed sonarcloud issues
Issue-ID: CLI-270 Signed-off-by: jitendra007 <jitendra.sharma1@huawei.com> Change-Id: Ibb52afb2fe8fe7c9be4299d1a1cb1e3d32ab0eca
Diffstat (limited to 'profiles/snmp/src')
-rw-r--r--profiles/snmp/src/main/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommand.java8
-rw-r--r--profiles/snmp/src/main/java/org/onap/cli/fw/snmp/schema/OnapCommandSchemaSnmpLoader.java6
2 files changed, 5 insertions, 9 deletions
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<String> validateSnmpSchemaSection(Map<String, Object> values) {
ArrayList<String> errorList = new ArrayList<>();
@@ -61,7 +63,7 @@ public class OnapCommandSchemaSnmpLoader {
case OnapCommandSnmpConstants.SNMP_COMMAND:
cmd.setCommand((String) entry.getValue());
-
+ break;
default:
break;
}