summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-01-07 16:44:46 +0000
committerGerrit Code Review <gerrit@onap.org>2019-01-07 16:44:46 +0000
commit62734cb1e278b32b3ade040eb97491ffc0b04dcc (patch)
treea5de30cf4dab1b18a3d230b1fb7c7861b03ec9f5
parent744a1990fb07830bd6364c9e6fbb9308086cb2d2 (diff)
parent28c3abf558b0697f063e792fc08e1b1b0a9c561b (diff)
Merge "fixed sonar issues in PrintYangToProp.java"
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java18
1 files changed, 8 insertions, 10 deletions
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java
index 86135210..3e8983bb 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java
@@ -48,6 +48,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Strings;
public class PrintYangToProp {
@@ -144,8 +145,8 @@ public class PrintYangToProp {
fieldName = toLowerHyphen(m.getName().substring(2));
}
- if(fieldName!= null && fieldName.length() >0 ) fieldName = fieldName.substring(0, 1).toLowerCase()
- + fieldName.substring(1);
+ if(Strings.isNullOrEmpty(fieldName)) fieldName = fieldName.substring(0, 1).toLowerCase()+ fieldName.substring(1);
+
// Is the return type a yang generated class?
if (isYangGenerated(returnType)) {
@@ -196,8 +197,7 @@ public class PrintYangToProp {
if (retValue != null) {
String propVal = retValue.getValue();
- //LOG.debug("Setting property " + propName
- // + " to " + propVal);
+
props.setProperty(propName, propVal);
}
@@ -223,8 +223,7 @@ public class PrintYangToProp {
if (retValue != null) {
String propVal = retValue.getValue();
- //LOG.debug("Setting property " + propName
- // + " to " + propVal);
+
props.setProperty(propName, propVal);
}
@@ -236,7 +235,7 @@ public class PrintYangToProp {
+ TO_PROPERTIES_STRING, e);
}
} else if (isIpv4Prefix(returnType)) {
- //System.out.println("isIpv4Prefix");
+
// Save its value
try {
String propName = propNamePfx + "." + fieldName;
@@ -250,9 +249,8 @@ public class PrintYangToProp {
}
if (retValue != null) {
- String propVal = retValue.getValue().toString();
- //LOG.debug("Setting property " + propName
- // + " to " + propVal);
+ String propVal = retValue.getValue();
+
props.setProperty(propName, propVal);
}