fixed sonar issues in PrintYangToProp.java 51/74951/2
authorSandeep J <sandeejh@in.ibm.com>
Thu, 20 Dec 2018 07:38:04 +0000 (13:08 +0530)
committerSandeep Jha <sandeejh@in.ibm.com>
Mon, 7 Jan 2019 09:37:58 +0000 (09:37 +0000)
fixed sonar issues

Issue-ID: CCSDK-525
Change-Id: Ifb7328c8b3cf40d412a0efffad6cb55673cf83dc
Signed-off-by: Sandeep J <sandeejh@in.ibm.com>
sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/PrintYangToProp.java

index 8613521..3e8983b 100644 (file)
@@ -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);
 
                                 }