fixed sonar issues in PrintYangToProp.java
authorSandeep J <sandeejh@in.ibm.com>
Fri, 7 Dec 2018 10:29:45 +0000 (15:59 +0530)
committerSandeep J <sandeejh@in.ibm.com>
Fri, 7 Dec 2018 10:29:59 +0000 (15:59 +0530)
fixed sonar issues

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

index 2e29102..e22f392 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights
  *                                             reserved.
  * ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
@@ -53,9 +55,11 @@ public class PrintYangToProp {
        private static final Logger LOG = LoggerFactory.getLogger(PrintYangToProp.class);
        public static final String PROPERTIES_FILE="";
        private static Properties properties;
+       private static final String BUILDER="-builder";
+       private static final String IMPL="-impl";
        
        public static Properties prop = new Properties();
-       public static ArrayList<String> propList = new ArrayList<String>();
+       public static ArrayList<String> propList = new ArrayList<>();
 
        
        public static Properties toProperties(Properties props, Object fromObj) {
@@ -115,14 +119,14 @@ public class PrintYangToProp {
                                        propNamePfx = toLowerHyphen(fromClass.getSimpleName());
                                }
 
-                               if (propNamePfx.endsWith("-builder")) {
+                               if (propNamePfx.endsWith(BUILDER)) {
                                        propNamePfx = propNamePfx.substring(0, propNamePfx.length()
-                                                       - "-builder".length());
+                                                       - BUILDER.length());
                                }
 
-                               if (propNamePfx.endsWith("-impl")) {
+                               if (propNamePfx.endsWith(IMPL)) {
                                        propNamePfx = propNamePfx.substring(0, propNamePfx.length()
-                                                       - "-impl".length());
+                                                       - IMPL.length());
                                }
                        }
                        
@@ -486,14 +490,14 @@ public class PrintYangToProp {
                                        propNamePfx = toLowerHyphen(toClass.getSimpleName());
                                }
 
-                               if (propNamePfx.endsWith("-builder")) {
+                               if (propNamePfx.endsWith(BUILDER)) {
                                        propNamePfx = propNamePfx.substring(0, propNamePfx.length()
-                                                       - "-builder".length());
+                                                       - BUILDER.length());
                                }
 
-                               if (propNamePfx.endsWith("-impl")) {
+                               if (propNamePfx.endsWith(IMPL)) {
                                        propNamePfx = propNamePfx.substring(0, propNamePfx.length()
-                                                       - "-impl".length());
+                                                       - IMPL.length());
                                }
                        }
 
@@ -999,14 +1003,14 @@ public class PrintYangToProp {
                                        propNamePfx = toLowerHyphen(toClass.getSimpleName());
                                }
 
-                               if (propNamePfx.endsWith("-builder")) {
+                               if (propNamePfx.endsWith(BUILDER)) {
                                        propNamePfx = propNamePfx.substring(0, propNamePfx.length()
-                                                       - "-builder".length());
+                                                       - BUILDER.length());
                                }
 
-                               if (propNamePfx.endsWith("-impl")) {
+                               if (propNamePfx.endsWith(IMPL)) {
                                        propNamePfx = propNamePfx.substring(0, propNamePfx.length()
-                                                       - "-impl".length());
+                                                       - IMPL.length());
                                }
                        }