Fix checkstyle if-statements must use braces in aaa-authn 41/13641/3
authorThanh Ha <thanh.ha@linuxfoundation.org>
Sun, 14 Dec 2014 20:25:06 +0000 (15:25 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Sat, 7 Feb 2015 02:44:47 +0000 (21:44 -0500)
- Fix if-statements must use braces
- Add missing License headers

Change-Id: I5c9279d1702ec8c3ce0d1b5ea82aef5c7325e620
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
aaa-authn/src/main/java/org/opendaylight/aaa/AuthenticationBuilder.java
aaa-authn/src/main/java/org/opendaylight/aaa/ClaimBuilder.java
aaa-authn/src/main/java/org/opendaylight/aaa/ClientManager.java
aaa-authn/src/main/java/org/opendaylight/aaa/HashCodeUtil.java
aaa-authn/src/main/java/org/opendaylight/aaa/PasswordCredentialBuilder.java
aaa-authn/src/main/java/org/opendaylight/aaa/SecureBlockingQueue.java

index 65561432a9600bbe56974008b17b81594fb1edc7..664ff86f1abbbe02cecd41249a0bcbe652c65e48 100644 (file)
@@ -101,10 +101,12 @@ public class AuthenticationBuilder extends ClaimBuilder {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o)
+            if (this == o) {
                 return true;
-            if (!(o instanceof Authentication))
+            }
+            if (!(o instanceof Authentication)) {
                 return false;
+            }
             Authentication a = (Authentication) o;
             return areEqual(expiration, a.expiration()) && super.equals(o);
         }
index e8eb19824bc6b8f488465a90da77294d19149314..b1a08345bbc581e2bfe226f42168d3d174b3435c 100644 (file)
@@ -140,14 +140,18 @@ public class ClaimBuilder {
         @Override
         public String toString() {
             StringBuffer sb = new StringBuffer();
-            if (clientId != null)
+            if (clientId != null) {
                 sb.append("clientId:").append(clientId).append(",");
-            if (userId != null)
+            }
+            if (userId != null) {
                 sb.append("userId:").append(userId).append(",");
-            if (user != null)
+            }
+            if (user != null) {
                 sb.append("userName:").append(user).append(",");
-            if (domain != null)
+            }
+            if (domain != null) {
                 sb.append("domain:").append(domain).append(",");
+            }
             sb.append("roles:").append(roles);
             return sb.toString();
         }
index ce1c635b2dd0fee0e3983a308661e844d065275b..cf7f4fdef9c3675688b6a4d73d4fee090963fcb5 100644 (file)
@@ -52,17 +52,20 @@ public class ClientManager implements ClientService, ManagedService {
     public void validate(String clientId, String clientSecret)
             throws AuthenticationException {
         // TODO: Post-Helium, we will support a CRUD API
-        if (!clients.containsKey(clientId))
+        if (!clients.containsKey(clientId)) {
             throw new AuthenticationException(UNAUTHORIZED_CLIENT_ERR);
-        if (!clients.get(clientId).equals(clientSecret))
+        }
+        if (!clients.get(clientId).equals(clientSecret)) {
             throw new AuthenticationException(UNAUTHORIZED_CLIENT_ERR);
+        }
     }
 
     @Override
     public void updated(Dictionary<String, ?> props)
             throws ConfigurationException {
-        if (props == null)
+        if (props == null) {
             props = defaults;
+        }
         reconfig(props);
     }
 
index cbbbaa2d160cd11d64b1a9d8d8750769bb33c04e..3c87d49e3bed88bdd54559a8bd5a4e62b1deabf9 100644 (file)
@@ -1,3 +1,11 @@
+/*****************************************************************************
+ * Copyright (c) 2014 Hewlett-Packard Development Company, L.P. and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *****************************************************************************/
 package org.opendaylight.aaa;
 
 import java.lang.reflect.Array;
@@ -75,8 +83,9 @@ public final class HashCodeUtil {
                 Object item = Array.get(aObject, idx);
                 // if an item in the array references the array itself, prevent
                 // infinite looping
-                if (!(item == aObject))
+                if (!(item == aObject)) {
                     result = hash(result, item);
+                }
             }
         }
         return result;
index 0f6902a8c55583dfe715c746706c9fbe814e8270..7e75007a4826a3b8f2540ef5f618821678b3e6fe 100644 (file)
@@ -15,9 +15,9 @@ import org.opendaylight.aaa.api.PasswordCredentials;
 
 /**
  * {@link PasswordCredentials} builder.
- * 
+ *
  * @author liemmn
- * 
+ *
  */
 public class PasswordCredentialBuilder {
     private final MutablePasswordCredentials pc = new MutablePasswordCredentials();
@@ -31,7 +31,7 @@ public class PasswordCredentialBuilder {
         pc.password = password;
         return this;
     }
-    
+
     public PasswordCredentials build() {
         return pc;
     }
@@ -54,10 +54,12 @@ public class PasswordCredentialBuilder {
 
         @Override
         public boolean equals(Object o) {
-            if (this == o)
+            if (this == o) {
                 return true;
-            if (!(o instanceof PasswordCredentials))
+            }
+            if (!(o instanceof PasswordCredentials)) {
                 return false;
+            }
             PasswordCredentials p = (PasswordCredentials) o;
             return areEqual(username, p.username())
                     && areEqual(password, p.password());
index 6eef06ebd731a911626688c85a073f8179bc19ed..df7c8cc0019ad87cda42dda68661d3b53a37e3af 100644 (file)
@@ -167,8 +167,9 @@ public class SecureBlockingQueue<T> implements BlockingQueue<T> {
         Iterator<SecureData<T>> it = queue.iterator();
         while (it.hasNext()) {
             SecureData<T> sd = it.next();
-            if (sd.data.equals(o))
+            if (sd.data.equals(o)) {
                 return queue.remove(sd);
+            }
         }
         return false;
     }
@@ -178,8 +179,9 @@ public class SecureBlockingQueue<T> implements BlockingQueue<T> {
         Iterator<SecureData<T>> it = queue.iterator();
         while (it.hasNext()) {
             SecureData<T> sd = it.next();
-            if (sd.data.equals(o))
+            if (sd.data.equals(o)) {
                 return true;
+            }
         }
         return false;
     }
@@ -210,8 +212,9 @@ public class SecureBlockingQueue<T> implements BlockingQueue<T> {
     @SuppressWarnings("unchecked")
     private Collection<SecureData<T>> fromData(Collection<?> c) {
         Collection<SecureData<T>> sd = new ArrayList<>(c.size());
-        for (Object d : c)
+        for (Object d : c) {
             sd.add((SecureData<T>) new SecureData<>(d));
+        }
         return sd;
     }
 
@@ -226,8 +229,9 @@ public class SecureBlockingQueue<T> implements BlockingQueue<T> {
     private Collection<T> toData(Collection<SecureData<T>> secureData) {
         Collection<T> data = new ArrayList<>(secureData.size());
         Iterator<SecureData<T>> it = secureData.iterator();
-        while (it.hasNext())
+        while (it.hasNext()) {
             data.add(it.next().data);
+        }
         return data;
     }
 
@@ -244,7 +248,9 @@ public class SecureBlockingQueue<T> implements BlockingQueue<T> {
         @SuppressWarnings("rawtypes")
         @Override
         public boolean equals(Object o) {
-            if (o == null) return false;
+            if (o == null) {
+                return false;
+            }
             return (o instanceof SecureData)
                     ? data.equals(((SecureData) o).data): false;
         }