Mass whitespace changes (Style Warnings)
[aaf/authz.git] / auth / auth-cass / src / main / java / org / onap / aaf / auth / dao / CassAccess.java
index 9b168a8..b8062fc 100644 (file)
@@ -64,9 +64,9 @@ public class CassAccess {
 
 //    @SuppressWarnings("deprecation")
     public static synchronized Cluster cluster(Env env, String prefix) throws APIException, IOException {
-        if(cb == null) {
+        if (cb == null) {
             String pre;
-            if(prefix==null) {
+            if (prefix==null) {
                 pre="";
             } else {
                 env.info().log("Cassandra Connection for ",prefix);
@@ -74,19 +74,19 @@ public class CassAccess {
             }
             cb = Cluster.builder();
             String str = env.getProperty(pre+CASSANDRA_CLUSTERS_PORT,env.getProperty(CASSANDRA_CLUSTERS_PORT,"9042"));
-            if(str!=null) {
+            if (str!=null) {
                 env.init().log("Cass Port = ",str );
                 cb.withPort(Integer.parseInt(str));
             }
             str = env.getProperty(pre+CASSANDRA_CLUSTERS_USER_NAME,env.getProperty(CASSANDRA_CLUSTERS_USER_NAME,null));
-            if(str!=null) {
+            if (str!=null) {
                 env.init().log("Cass User = ",str );
                 String epass = env.getProperty(pre + CASSANDRA_CLUSTERS_PASSWORD,env.getProperty(CASSANDRA_CLUSTERS_PASSWORD,null));
-                if(epass==null) {
+                if (epass==null) {
                     throw new APIException("No Password configured for " + str);
                 }
                 //TODO Figure out way to ensure Decryptor setting in AuthzEnv
-                if(env instanceof AuthzEnv) {
+                if (env instanceof AuthzEnv) {
                     cb.withCredentials(str,((AuthzEnv)env).decrypt(epass,true));
                 } else {
                     cb.withCredentials(str, env.decryptor().decrypt(epass));
@@ -94,9 +94,9 @@ public class CassAccess {
             }
     
             str = env.getProperty(pre+CASSANDRA_RESET_EXCEPTIONS,env.getProperty(CASSANDRA_RESET_EXCEPTIONS,null));
-            if(str!=null) {
+            if (str!=null) {
                 env.init().log("Cass ResetExceptions = ",str );
-                for(String ex : Split.split(',', str)) {
+                for (String ex : Split.split(',', str)) {
                     resetExceptions.add(new Resettable(env,ex));
                 }
             }
@@ -105,7 +105,7 @@ public class CassAccess {
             Double lat = str!=null?Double.parseDouble(str):null;
             str = env.getProperty(Config.CADI_LONGITUDE);
             Double lon = str!=null?Double.parseDouble(str):null;
-            if(lat == null || lon == null) {
+            if (lat == null || lon == null) {
                 throw new APIException(Config.CADI_LATITUDE + " and/or " + Config.CADI_LONGITUDE + " are not set");
             }
             
@@ -118,23 +118,23 @@ public class CassAccess {
             String bestDC = null;
             int numInBestDC = 1;
             double mlat, mlon,temp,distance = Double.MAX_VALUE;
-            for(int i=0;i<machs.length;++i) {
+            for (int i=0;i<machs.length;++i) {
                 String[] minfo = Split.split(':',machs[i]);
-                if(minfo.length>0) {
+                if (minfo.length>0) {
                     cpoints[i]=minfo[0];
                 }
                 
-                if(minfo.length>3) {
-                    if(minfo[1].equals(bestDC)) {
+                if (minfo.length>3) {
+                    if (minfo[1].equals(bestDC)) {
                         ++numInBestDC;
                     } else {
                         // Calc closest DC with Great Circle
                         mlat = Double.parseDouble(minfo[2]);
                         mlon = Double.parseDouble(minfo[3]);
                         // Note: GreatCircle Distance is always >= 0.0 (not negative)
-                        if((temp=GreatCircle.calc(lat, lon, mlat, mlon)) < distance) {
+                        if ((temp=GreatCircle.calc(lat, lon, mlat, mlon)) < distance) {
                             distance = temp;
-                            if(bestDC==null || !bestDC.equals(minfo[1])) {
+                            if (bestDC==null || !bestDC.equals(minfo[1])) {
                                 bestDC = minfo[1];
                                 numInBestDC = 1;
                             }
@@ -145,7 +145,7 @@ public class CassAccess {
             
             cb.addContactPoints(cpoints);
             
-            if(bestDC!=null) {
+            if (bestDC!=null) {
                 // 8/26/2016 Management has determined that Accuracy is preferred over speed in bad situations
                 // Local DC Aware Load Balancing appears to have the highest normal performance, with the best
                 // Degraded Accuracy
@@ -171,18 +171,18 @@ public class CassAccess {
         
         @SuppressWarnings("unchecked")
         public Resettable(Env env, String propData) throws APIException {
-            if(propData!=null && propData.length()>1) {
+            if (propData!=null && propData.length()>1) {
                 String[] split = Split.split(':', propData);
-                if(split.length>0) {
+                if (split.length>0) {
                     try {
                         cls = (Class<? extends Exception>)Class.forName(split[0]);
                     } catch (ClassNotFoundException e) {
                         throw new APIException("Declared Cassandra Reset Exception, " + propData + ", cannot be ClassLoaded");
                     }
                 }
-                if(split.length>1) {
+                if (split.length>1) {
                     messages=new ArrayList<>();
-                    for(int i=1;i<split.length;++i) {
+                    for (int i=1;i<split.length;++i) {
                         String str = split[i];
                         int start = str.startsWith("\"")?1:0;
                         int end = str.length()-(str.endsWith("\"")?1:0);
@@ -195,11 +195,11 @@ public class CassAccess {
         }
         
         public boolean matches(Exception ex) {
-            if(ex.getClass().equals(cls)) {
-                if(messages!=null) {
+            if (ex.getClass().equals(cls)) {
+                if (messages!=null) {
                     String msg = ex.getMessage();
-                    for(String m : messages) {
-                        if(msg.contains(m)) {
+                    for (String m : messages) {
+                        if (msg.contains(m)) {
                             return true;
                         }
                     }
@@ -210,11 +210,11 @@ public class CassAccess {
     }
     
     public static final boolean isResetException(Exception e) {
-        if(e==null) {
+        if (e==null) {
             return true;
         }
-        for(Resettable re : resetExceptions) {
-            if(re.matches(e)) {
+        for (Resettable re : resetExceptions) {
+            if (re.matches(e)) {
                 return true;
             }
         }