diff options
-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 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); } |