Sonar: if/else/for/while/do statements need braces
[lispflowmapping.git] / mappingservice / implementation / src / main / java / org / opendaylight / lispflowmapping / implementation / config / ConfigIni.java
index c687f5e92bfe01aa724030bef894b118ee42bdb7..d770d076fa128311b9e826551e318f8aa2263c42 100644 (file)
@@ -14,7 +14,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ConfigIni {
-    protected static final Logger logger = LoggerFactory.getLogger(ConfigIni.class);
+    protected static final Logger LOG = LoggerFactory.getLogger(ConfigIni.class);
     private boolean mappingOverwrite;
     private boolean smr;
     private String elpPolicy;
@@ -41,47 +41,49 @@ public class ConfigIni {
 
         String str = null;
 
-        if (context != null)
+        if (context != null) {
             str = context.getProperty(LISP_MAPPING_OVERWRITE);
+        }
 
         if (str == null) {
             str = System.getProperty(LISP_MAPPING_OVERWRITE);
             if (str == null) {
-                logger.debug("Configuration variable '{}' is unset. Setting to default value: 'true'", LISP_MAPPING_OVERWRITE);
+                LOG.debug("Configuration variable '{}' is unset. Setting to default value: 'true'", LISP_MAPPING_OVERWRITE);
                 return;
             }
         }
 
         if (str.trim().equalsIgnoreCase("false")) {
             this.mappingOverwrite = false;
-            logger.debug("Setting configuration variable '{}' to 'false'", LISP_MAPPING_OVERWRITE);
+            LOG.debug("Setting configuration variable '{}' to 'false'", LISP_MAPPING_OVERWRITE);
         } else {
-            logger.debug("Setting configuration variable '{}' to 'true'", LISP_MAPPING_OVERWRITE);
+            LOG.debug("Setting configuration variable '{}' to 'true'", LISP_MAPPING_OVERWRITE);
         }
     }
 
     private void initSmr(BundleContext context) {
         // set the default value first
-        this.smr = false;
+        this.smr = true;
 
         String str = null;
 
-        if (context != null)
+        if (context != null) {
             str = context.getProperty(LISP_SMR);
+        }
 
         if (str == null) {
             str = System.getProperty(LISP_SMR);
             if (str == null) {
-                logger.debug("Configuration variable '{}' is unset. Setting to default value: 'false'", LISP_SMR);
+                LOG.debug("Configuration variable '{}' is unset. Setting to default value: 'true'", LISP_SMR);
                 return;
             }
         }
 
-        if (str.trim().equalsIgnoreCase("true")) {
-            this.smr = true;
-            logger.debug("Setting configuration variable '{}' to 'true'", LISP_SMR);
+        if (str.trim().equalsIgnoreCase("false")) {
+            this.smr = false;
+            LOG.debug("Setting configuration variable '{}' to 'false'", LISP_SMR);
         } else {
-            logger.debug("Setting configuration variable '{}' to 'false'", LISP_SMR);
+            LOG.debug("Setting configuration variable '{}' to 'true'", LISP_SMR);
         }
     }
 
@@ -91,13 +93,14 @@ public class ConfigIni {
 
         String str = null;
 
-        if (context != null)
+        if (context != null) {
             str = context.getProperty(LISP_ELP_POLICY);
+        }
 
         if (str == null) {
             str = System.getProperty(LISP_ELP_POLICY);
             if (str == null) {
-                logger.debug("Configuration variable '{}' is unset. Setting to default value: 'default' (ELP only)",
+                LOG.debug("Configuration variable '{}' is unset. Setting to default value: 'default' (ELP only)",
                         LISP_ELP_POLICY);
                 return;
             }
@@ -105,12 +108,12 @@ public class ConfigIni {
 
         if (str.trim().equalsIgnoreCase("both")) {
             this.elpPolicy = "both";
-            logger.debug("Setting configuration variable '{}' to 'both' (keep ELP, add next hop)", LISP_ELP_POLICY);
+            LOG.debug("Setting configuration variable '{}' to 'both' (keep ELP, add next hop)", LISP_ELP_POLICY);
         } else if (str.trim().equalsIgnoreCase("replace")) {
             this.elpPolicy = "replace";
-            logger.debug("Setting configuration variable '{}' to 'replace' (next hop only)", LISP_ELP_POLICY);
+            LOG.debug("Setting configuration variable '{}' to 'replace' (next hop only)", LISP_ELP_POLICY);
         } else {
-            logger.debug("Setting configuration variable '{}' to 'default' (ELP only)", LISP_ELP_POLICY);
+            LOG.debug("Setting configuration variable '{}' to 'default' (ELP only)", LISP_ELP_POLICY);
         }
     }