diff options
author | Sandeep J <sandeejh@in.ibm.com> | 2018-12-20 13:08:04 +0530 |
---|---|---|
committer | Sandeep Jha <sandeejh@in.ibm.com> | 2019-01-07 09:37:58 +0000 |
commit | 28c3abf558b0697f063e792fc08e1b1b0a9c561b (patch) | |
tree | 95df7f373808b0fb7ce5c2e9199e94b8a4831526 | |
parent | 0935246ecb1cad72a86eeedbc43f1ebdbbe5a9c8 (diff) |
fixed sonar issues in PrintYangToProp.java
fixed sonar issues
Issue-ID: CCSDK-525
Change-Id: Ifb7328c8b3cf40d412a0efffad6cb55673cf83dc
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
-rw-r--r-- | sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java | 18 |
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 861352106..3e8983bbf 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); } |