summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-02-20 11:03:39 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2018-02-20 11:03:39 +0530
commitb24c44159cdfc5fb3417890d84f6074a6cd02f78 (patch)
tree529bdac76710800a115898e7e772050c967d72e0
parent8896b3392d29e2d64188b407ef0ccc2bfd3af174 (diff)
Improve logging and avoid null chance
Issue-ID: CLI-92 Change-Id: I681f605a1cb52ff548c03b5510452cafb648bae9 Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
-rw-r--r--main/src/main/java/org/onap/cli/main/OnapCli.java1
-rw-r--r--profiles/snmp/src/main/java/org/onap/cli/fw/snmp/cmd/OnapSnmpCommand.java2
2 files changed, 2 insertions, 1 deletions
diff --git a/main/src/main/java/org/onap/cli/main/OnapCli.java b/main/src/main/java/org/onap/cli/main/OnapCli.java
index b8af6f51..443b86f2 100644
--- a/main/src/main/java/org/onap/cli/main/OnapCli.java
+++ b/main/src/main/java/org/onap/cli/main/OnapCli.java
@@ -377,6 +377,7 @@ public class OnapCli {
generateSmapleYaml(cmd);
} catch (OnapCommandWarning w) {
+ this.print(w);
this.print(cmd.getResult().getDebugInfo());
this.exitSuccessfully();
} catch (Exception e) {
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 cf2d91d0..6bdc9a03 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
@@ -120,7 +120,7 @@ public class OnapSnmpCommand extends OnapCommand {
case OnapCommandSnmpConstants.SNMP_CMD_GET:
ResponseEvent responseEvent = snmp.send(getPDU(PDU.GET, oidStrArr), getTarget(), null);
- if ( responseEvent != null || responseEvent.getResponse().getErrorStatus() == PDU.noError) {
+ if ( responseEvent != null && responseEvent.getResponse().getErrorStatus() == PDU.noError) {
Vector<? extends VariableBinding> variableBindings = responseEvent.getResponse().getVariableBindings();
variableBindings.stream().forEach(varBinding -> { //NOSONAR
String key = getKeyForValue(varBinding.getOid().toString());