Fix checkstyle if-statements must use braces in aaa-idmlight 42/13642/3
authorThanh Ha <thanh.ha@linuxfoundation.org>
Sun, 14 Dec 2014 20:30:55 +0000 (15:30 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Sat, 7 Feb 2015 02:44:47 +0000 (21:44 -0500)
- Fix missing braces
- Fix indentation level

Change-Id: I5e81fb561b550a2085ceddf6403273dcb503c5ca
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/IdmLightApplication.java
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/IdmLightProxy.java
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/persistence/DomainStore.java
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/persistence/GrantStore.java
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/persistence/RoleStore.java
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/persistence/UserStore.java
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/rest/DomainHandler.java
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/rest/RoleHandler.java
aaa-idmlight/src/main/java/org/opendaylight/aaa/idm/rest/UserHandler.java

index 4a1afaddba23d6901dc30205fd4a75c456ab69fd..86d61f12fecc9d43425863e50b833e551a7bae27 100644 (file)
@@ -35,13 +35,16 @@ public class IdmLightApplication extends Application {
     public IdmLightApplication() {
         logger.info("starting idmlight .... ");
         config = new IdmLightConfig();
-        if (!config.load())
-           logger.error("unable to load idmlight config ");
-        else
-           config.log();
+        if (!config.load()) {
+            logger.error("unable to load idmlight config ");
+        }
+        else {
+            config.log();
+        }
         StoreBuilder storeBuilder = new StoreBuilder();
-        if (!storeBuilder.exists())
-           storeBuilder.init();
+        if (!storeBuilder.exists()) {
+            storeBuilder.init();
+        }
     }
 
     @Override
index 47fd746d3a0cdce310b2c9f0a530338c16f76825..16f3d0b69ec7165d6b2039fb7b3f077c62aa37c9 100644 (file)
@@ -69,8 +69,9 @@ public class IdmLightProxy implements CredentialAuth<PasswordCredentials>,
                 claim = cache.get(creds);
                 if (claim == null) {
                     claim = dbAuthenticate(creds, domainName);
-                    if (claim != null)
+                    if (claim != null) {
                         cache.put(creds, claim);
+                    }
                 }
             }
         }
@@ -78,8 +79,9 @@ public class IdmLightProxy implements CredentialAuth<PasswordCredentials>,
     }
 
     public static synchronized void clearClaimCache() {
-        for (Map<PasswordCredentials, Claim> cache : claimCache.values())
+        for (Map<PasswordCredentials, Claim> cache : claimCache.values()) {
             cache.clear();
+        }
     }
 
     private static Claim dbAuthenticate(PasswordCredentials creds, String domainName) {
@@ -130,8 +132,9 @@ public class IdmLightProxy implements CredentialAuth<PasswordCredentials>,
            claim.setUserId(user.getUserid().toString());
            claim.setUser(creds.username());
            claim.setDomain(domainName);
-           for (int z=0;z<roles.size();z++)
+           for (int z=0;z<roles.size();z++) {
               claim.addRole(roles.get(z));
+           }
            return claim.build();
         }
         catch (StoreException se) {
@@ -145,8 +148,9 @@ public class IdmLightProxy implements CredentialAuth<PasswordCredentials>,
         try {
            Users users = userStore.getUsers(userName);
            List<User> userList = users.getUsers();
-           if (userList.size()==0)
+           if (userList.size()==0) {
               return null;
+           }
            User user = userList.get(0);
            return user.getUserid().toString();
         }
@@ -228,8 +232,9 @@ public class IdmLightProxy implements CredentialAuth<PasswordCredentials>,
     }
 
     private static final void debug(String msg) {
-        if (logger.isDebugEnabled())
+        if (logger.isDebugEnabled()) {
             logger.debug(msg);
+        }
     }
 }
 
index 2a5792f005bdf1f42c13eb9af8bd1d3803f10603..0989031d3de445a80bd05de085ae5053c7fb5cee 100644 (file)
@@ -63,8 +63,9 @@ public class DomainStore {
                   throw new StoreException("Cannot connect to database server "+ e);
                }
             }
-            else
+            else {
                return dbConnection;
+            }
          }
         catch (SQLException sqe) {
             throw new StoreException("Cannot connect to database server "+ sqe);
@@ -229,13 +230,16 @@ protected void finalize ()  {
           statement.setString(2,domain.getDescription());
           statement.setInt(3,domain.getEnabled()?1:0);
           int affectedRows = statement.executeUpdate();
-          if (affectedRows == 0)
+          if (affectedRows == 0) {
              throw new StoreException("Creating domain failed, no rows affected.");
+          }
           ResultSet generatedKeys = statement.getGeneratedKeys();
-          if (generatedKeys.next())
+          if (generatedKeys.next()) {
              key = generatedKeys.getInt(1);
-          else
+          }
+          else {
              throw new StoreException("Creating domain failed, no generated key obtained.");
+          }
           domain.setDomainid(key);
           dbClose();
           return domain;
@@ -248,15 +252,19 @@ protected void finalize ()  {
 
    public Domain putDomain(Domain domain) throws StoreException {
       Domain savedDomain = this.getDomain(domain.getDomainid());
-      if (savedDomain==null)
+      if (savedDomain==null) {
          return null;
+      }
 
-      if (domain.getDescription()!=null)
+      if (domain.getDescription()!=null) {
          savedDomain.setDescription(domain.getDescription());
-      if (domain.getName()!=null)
+      }
+      if (domain.getName()!=null) {
          savedDomain.setName(domain.getName());
-      if (domain.getEnabled()!=null)
+      }
+      if (domain.getEnabled()!=null) {
          savedDomain.setEnabled(domain.getEnabled());
+      }
 
       Connection conn = dbConnect();
       try {
@@ -280,8 +288,9 @@ protected void finalize ()  {
 
    public Domain deleteDomain(Domain domain) throws StoreException {
       Domain savedDomain = this.getDomain(domain.getDomainid());
-      if (savedDomain==null)
+      if (savedDomain==null) {
          return null;
+      }
 
       Connection conn = dbConnect();
       Statement stmt=null;
@@ -301,8 +310,9 @@ protected void finalize ()  {
    }
 
    private static final void debug(String msg) {
-       if (logger.isDebugEnabled())
+       if (logger.isDebugEnabled()) {
            logger.debug(msg);
+       }
    }
 }
 
index 36555a32364e85f17798fa45dcefc1a63dea3b61..df6af4597ff538c7b036fdda9b2b256a613b2f0e 100644 (file)
@@ -65,8 +65,9 @@ public class GrantStore {
                   throw new StoreException("Cannot connect to database server "+ e);
                }
             }
-            else
+            else {
                return dbConnection;
+            }
          }
         catch (SQLException sqe) {
             throw new StoreException("Cannot connect to database server "+ sqe);
@@ -262,13 +263,16 @@ protected void finalize ()  {
           statement.setInt(3,grant.getUserid());
           statement.setInt(4,grant.getRoleid());
           int affectedRows = statement.executeUpdate();
-          if (affectedRows == 0)
+          if (affectedRows == 0) {
              throw new StoreException("Creating grant failed, no rows affected.");
+          }
           ResultSet generatedKeys = statement.getGeneratedKeys();
-          if (generatedKeys.next())
+          if (generatedKeys.next()) {
              key = generatedKeys.getInt(1);
-          else
+          }
+          else {
              throw new StoreException("Creating grant failed, no generated key obtained.");
+          }
           grant.setGrantid(key);
           dbClose();
           return grant;
@@ -281,8 +285,9 @@ protected void finalize ()  {
 
    public Grant deleteGrant(Grant grant) throws StoreException {
       Grant savedGrant = this.getGrant(grant.getGrantid());
-      if (savedGrant==null)
+      if (savedGrant==null) {
          return null;
+      }
 
       Connection conn = dbConnect();
       Statement stmt=null;
@@ -302,8 +307,9 @@ protected void finalize ()  {
    }
 
    private static final void debug(String msg) {
-       if (logger.isDebugEnabled())
+       if (logger.isDebugEnabled()) {
            logger.debug(msg);
+       }
    }
 }
 
index 6e6a0fc51e245b31612d11ff008fb3cf7b81c8d9..5abef32b1dccc7da257a7f8cb21cb110142796e5 100644 (file)
@@ -64,8 +64,9 @@ public class RoleStore {
                   throw new StoreException("Cannot connect to database server "+ e);
                }
             }
-            else
+            else {
                return dbConnection;
+            }
          }
         catch (SQLException sqe) {
             throw new StoreException("Cannot connect to database server "+ sqe);
@@ -199,13 +200,16 @@ protected void finalize ()  {
           statement.setString(1,role.getName());
           statement.setString(2,role.getDescription());
           int affectedRows = statement.executeUpdate();
-          if (affectedRows == 0)
+          if (affectedRows == 0) {
              throw new StoreException("Creating role failed, no rows affected.");
+          }
           ResultSet generatedKeys = statement.getGeneratedKeys();
-          if (generatedKeys.next())
+          if (generatedKeys.next()) {
              key = generatedKeys.getInt(1);
-          else
+          }
+          else {
              throw new StoreException("Creating role failed, no generated key obtained.");
+          }
           role.setRoleid(key);
           dbClose();
           return role;
@@ -219,13 +223,16 @@ protected void finalize ()  {
    public Role putRole(Role role) throws StoreException {
 
       Role savedRole = this.getRole(role.getRoleid());
-      if (savedRole==null)
+      if (savedRole==null) {
          return null;
+      }
 
-      if (role.getDescription()!=null)
+      if (role.getDescription()!=null) {
          savedRole.setDescription(role.getDescription());
-      if (role.getName()!=null)
+      }
+      if (role.getName()!=null) {
          savedRole.setName(role.getName());
+      }
 
       Connection conn = dbConnect();
       try {
@@ -248,8 +255,9 @@ protected void finalize ()  {
 
    public Role deleteRole(Role role) throws StoreException {
       Role savedRole = this.getRole(role.getRoleid());
-      if (savedRole==null)
+      if (savedRole==null) {
          return null;
+      }
 
       Connection conn = dbConnect();
       Statement stmt=null;
@@ -269,8 +277,9 @@ protected void finalize ()  {
    }
 
    private static final void debug(String msg) {
-       if (logger.isDebugEnabled())
+       if (logger.isDebugEnabled()) {
            logger.debug(msg);
+       }
    }
 }
 
index 43e57c17e51ef898e2846ee0e26b109e9af6a5f9..5ae5deca5a0dc29e6845d2b7a34a6257b982744f 100644 (file)
@@ -65,8 +65,9 @@ public class UserStore {
                   throw new StoreException("Cannot connect to database server "+ e);
                }
             }
-            else
+            else {
                return dbConnection;
+            }
          }
         catch (SQLException sqe) {
             throw new StoreException("Cannot connect to database server "+ sqe);
@@ -235,13 +236,16 @@ protected void finalize ()  {
           statement.setString(4,user.getDescription());
           statement.setInt(5,user.getEnabled()?1:0);
           int affectedRows = statement.executeUpdate();
-          if (affectedRows == 0)
+          if (affectedRows == 0) {
              throw new StoreException("Creating user failed, no rows affected.");
+          }
           ResultSet generatedKeys = statement.getGeneratedKeys();
-          if (generatedKeys.next())
+          if (generatedKeys.next()) {
              key = generatedKeys.getInt(1);
-          else
+          }
+          else {
              throw new StoreException("Creating user failed, no generated key obtained.");
+          }
           user.setUserid(key);
           dbClose();
           return user;
@@ -255,19 +259,25 @@ protected void finalize ()  {
    public User putUser(User user) throws StoreException {
 
       User savedUser = this.getUser(user.getUserid());
-      if (savedUser==null)
+      if (savedUser==null) {
          return null;
+      }
 
-      if (user.getDescription()!=null)
+      if (user.getDescription()!=null) {
          savedUser.setDescription(user.getDescription());
-      if (user.getName()!=null)
+      }
+      if (user.getName()!=null) {
          savedUser.setName(user.getName());
-      if (user.getEnabled()!=null)
+      }
+      if (user.getEnabled()!=null) {
          savedUser.setEnabled(user.getEnabled());
-      if (user.getEmail()!=null)
+      }
+      if (user.getEmail()!=null) {
          savedUser.setEmail(user.getEmail());
-      if (user.getPassword()!=null)
+      }
+      if (user.getPassword()!=null) {
          savedUser.setPassword(user.getPassword());
+      }
 
       Connection conn = dbConnect();
       try {
@@ -293,8 +303,9 @@ protected void finalize ()  {
 
    public User deleteUser(User user) throws StoreException {
       User savedUser = this.getUser(user.getUserid());
-      if (savedUser==null)
+      if (savedUser==null) {
          return null;
+      }
 
       Connection conn = dbConnect();
       Statement stmt=null;
@@ -314,8 +325,9 @@ protected void finalize ()  {
    }
 
    private static final void debug(String msg) {
-       if (logger.isDebugEnabled())
+       if (logger.isDebugEnabled()) {
            logger.debug(msg);
+       }
    }
 }
 
index 680d21c5815de74f4c267df06b03c16044e220da..1fa03565a30f91607f6d26a7be5869b367176507 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.aaa.idm.rest;
 
 /**
  *
- * @author peter.mellquist@hp.com 
+ * @author peter.mellquist@hp.com
  *
  */
 
@@ -55,8 +55,8 @@ public class DomainHandler {
    private static DomainStore domainStore = new DomainStore();
    private static UserStore userStore = new UserStore();
    private static RoleStore roleStore = new RoleStore();
-   private static GrantStore grantStore = new GrantStore(); 
-   
+   private static GrantStore grantStore = new GrantStore();
+
    @GET
    @Produces("application/json")
    public Response getDomains() {
@@ -115,12 +115,15 @@ public class DomainHandler {
    public Response createDomain(@Context UriInfo info,Domain domain) {
       logger.info("Post /domains");
       try {
-         if (domain.getEnabled()==null)
+         if (domain.getEnabled()==null) {
             domain.setEnabled(false);
-         if (domain.getName()==null)
+         }
+         if (domain.getName()==null) {
             domain.setName("");
-         if (domain.getDescription()==null)
+         }
+         if (domain.getDescription()==null) {
             domain.setDescription("");
+         }
          domain = domainStore.createDomain(domain);
       }
       catch (StoreException se) {
@@ -129,9 +132,9 @@ public class DomainHandler {
          idmerror.setMessage("Internal error creating domain");
          idmerror.setDetails(se.message);
          return Response.status(500).entity(idmerror).build();
-      } 
+      }
       return Response.status(201).entity(domain).build();
-   } 
+   }
 
    @PUT
    @Path("/{id}")
@@ -209,9 +212,9 @@ public class DomainHandler {
    @Path("/{did}/users/{uid}/roles")
    @Consumes("application/json")
    @Produces("application/json")
-   public Response createGrant( @Context UriInfo info, 
+   public Response createGrant( @Context UriInfo info,
                                 @PathParam("did") String did,
-                                @PathParam("uid") String uid,  
+                                @PathParam("uid") String uid,
                                 Grant grant) {
       logger.info("Post /domains/"+did+"/users/"+uid+"/roles");
       Domain domain=null;
@@ -221,8 +224,9 @@ public class DomainHandler {
       long longUid=0;
       long longRid=0;
 
-      if (grant.getDescription()==null)
+      if (grant.getDescription()==null) {
          grant.setDescription("");
+      }
 
       // validate domain id
       try {
@@ -302,7 +306,7 @@ public class DomainHandler {
          return Response.status(404).entity(idmerror).build();
       }
 
-      // see if grant already exists for this 
+      // see if grant already exists for this
       try {
          Grant existingGrant = grantStore.getGrant(longDid,longUid,longRid);
          if (existingGrant != null) {
@@ -320,7 +324,7 @@ public class DomainHandler {
       }
 
 
-      // create grant 
+      // create grant
       try {
          grant = grantStore.createGrant(grant);
       }
@@ -390,7 +394,7 @@ public class DomainHandler {
          return Response.status(400).entity(idmerror).build();
       }
 
-      // find userid for user 
+      // find userid for user
       try {
          Users users = userStore.getUsers(username);
          List<User> userList = users.getUsers();
@@ -405,7 +409,7 @@ public class DomainHandler {
          if (!userPwd.equals(reqPwd)) {
             IDMError idmerror = new IDMError();
             idmerror.setMessage("password does not match for username: "+username);
-            return Response.status(401).entity(idmerror).build(); 
+            return Response.status(401).entity(idmerror).build();
          }
          claim.setDomainid((int)longDid);
          claim.setUsername(username);
@@ -426,7 +430,7 @@ public class DomainHandler {
             idmerror.setDetails(se.message);
             return Response.status(500).entity(idmerror).build();
          }
-         claim.setRoles(roleList); 
+         claim.setRoles(roleList);
       }
       catch(StoreException se) {
          logger.error("StoreException : " + se);
@@ -437,7 +441,7 @@ public class DomainHandler {
       }
 
       return Response.ok(claim).build();
-   }  
+   }
 
    @GET
    @Path("/{did}/users/{uid}/roles")
@@ -611,8 +615,8 @@ public class DomainHandler {
          idmerror.setMessage("Not found! Role id :" + rid);
          return Response.status(404).entity(idmerror).build();
       }
-      
-      // see if grant already exists 
+
+      // see if grant already exists
       try {
          Grant existingGrant = grantStore.getGrant(longDid,longUid,longRid);
          if (existingGrant == null) {
index 8650a5b783a4bd2ca7e1c3541979cad5550ffcd0..0cefbe52a7052218dce58eb61ccf33a93a4c0389 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.aaa.idm.rest;
 
 /**
  *
- * @author peter.mellquist@hp.com 
+ * @author peter.mellquist@hp.com
  *
  */
 
@@ -36,12 +36,12 @@ import org.opendaylight.aaa.idm.model.IDMError;
 import org.opendaylight.aaa.idm.persistence.RoleStore;
 import org.opendaylight.aaa.idm.persistence.StoreException;
 import org.opendaylight.aaa.idm.IdmLightProxy;
-       
+
 @Path("/v1/roles")
 public class RoleHandler {
    private static Logger logger = LoggerFactory.getLogger(RoleHandler.class);
    private static RoleStore roleStore = new RoleStore();
-   
+
    @GET
    @Produces("application/json")
    public Response getRoles() {
@@ -89,29 +89,31 @@ public class RoleHandler {
    public Response createRole(@Context UriInfo info,Role role) {
       logger.info("Post /roles");
       try {
-         // TODO: role names should be unique!         
+         // TODO: role names should be unique!
          // name
-         if (role.getName()==null)
+         if (role.getName()==null) {
             return new IDMError(404,"name must be defined on role create","").response();
-         else 
-            if (role.getName().length()>RoleStore.MAX_FIELD_LEN)
-               return new IDMError(400,"role name max length is :" + RoleStore.MAX_FIELD_LEN,"").response();
-         
-         // description   
-         if (role.getDescription()==null)
+         }
+         else if (role.getName().length()>RoleStore.MAX_FIELD_LEN) {
+            return new IDMError(400,"role name max length is :" + RoleStore.MAX_FIELD_LEN,"").response();
+         }
+
+         // description
+         if (role.getDescription()==null) {
             role.setDescription("");
-         else
-            if (role.getDescription().length()>RoleStore.MAX_FIELD_LEN)
-               return new IDMError(400,"role description max length is :" + RoleStore.MAX_FIELD_LEN,"").response();
+         }
+         else if (role.getDescription().length()>RoleStore.MAX_FIELD_LEN) {
+            return new IDMError(400,"role description max length is :" + RoleStore.MAX_FIELD_LEN,"").response();
+         }
 
          role = roleStore.createRole(role);
       }
       catch (StoreException se) {
          return new IDMError(500,"internal error creating role",se.message).response();
-      } 
+      }
 
       return Response.status(201).entity(role).build();
-   } 
+   }
 
    @PUT
    @Path("/{id}")
@@ -132,12 +134,14 @@ public class RoleHandler {
 
          // name
          // TODO: names should be unique
-         if ((role.getName()!=null) && (role.getName().length()>RoleStore.MAX_FIELD_LEN))
+         if ((role.getName()!=null) && (role.getName().length()>RoleStore.MAX_FIELD_LEN)) {
             return new IDMError(400,"role name max length is :" + RoleStore.MAX_FIELD_LEN,"").response();
+         }
 
          // description
-         if ((role.getDescription()!=null) && (role.getDescription().length()>RoleStore.MAX_FIELD_LEN))
+         if ((role.getDescription()!=null) && (role.getDescription().length()>RoleStore.MAX_FIELD_LEN)) {
             return new IDMError(400,"role description max length is :" + RoleStore.MAX_FIELD_LEN,"").response();
+         }
 
          role = roleStore.putRole(role);
          if (role==null) {
index b9dd95752f9c497d05641a15325d2c5c18259c36..a8f646f4c5f2407fd1915ce0e64e49ef77146cec 100644 (file)
@@ -10,7 +10,7 @@ package org.opendaylight.aaa.idm.rest;
 
 /**
  *
- * @author peter.mellquist@hp.com 
+ * @author peter.mellquist@hp.com
  *
  */
 
@@ -36,13 +36,13 @@ import org.opendaylight.aaa.idm.model.IDMError;
 import org.opendaylight.aaa.idm.persistence.UserStore;
 import org.opendaylight.aaa.idm.persistence.StoreException;
 import org.opendaylight.aaa.idm.IdmLightProxy;
-       
+
 @Path("/v1/users")
 public class UserHandler {
    private static Logger logger = LoggerFactory.getLogger(UserHandler.class);
    private static UserStore userStore = new UserStore();
    protected final static String DEFAULT_PWD = "changeme";
-   
+
    @GET
    @Produces("application/json")
    public Response getUsers() {
@@ -56,9 +56,10 @@ public class UserHandler {
       }
 
       // obsfucate pwd
-      for (int z=0;z<users.getUsers().size();z++)
+      for (int z=0;z<users.getUsers().size();z++) {
           users.getUsers().get(z).setPassword("**********");
+      }
+
       return Response.ok(users).build();
    }
 
@@ -83,7 +84,7 @@ public class UserHandler {
          return new IDMError(500,"internal error getting user",se.message).response();
       }
       if (user==null) {
-         return new IDMError(404,"user not found! id:" + id,"").response(); 
+         return new IDMError(404,"user not found! id:" + id,"").response();
       }
       // obsfucate pwd
       user.setPassword("*********");
@@ -97,47 +98,52 @@ public class UserHandler {
       logger.info("post /users");
       try {
          // enabled by default
-         if (user.getEnabled()==null)
+         if (user.getEnabled()==null) {
             user.setEnabled(true);
-         
+         }
+
          // user name is required
-         if (user.getName()==null)
+         if (user.getName()==null) {
             return new IDMError(400,"user name is required","").response();
-         else
-            if (user.getName().length()>UserStore.MAX_FIELD_LEN)
-               return new IDMError(400,"user name max length is :" + UserStore.MAX_FIELD_LEN,"").response();
+         }
+         else if (user.getName().length()>UserStore.MAX_FIELD_LEN) {
+            return new IDMError(400,"user name max length is :" + UserStore.MAX_FIELD_LEN,"").response();
+         }
 
          // user description is optional
-         if (user.getDescription()==null)
+         if (user.getDescription()==null) {
             user.setDescription("");
-         else
-            if (user.getDescription().length()>UserStore.MAX_FIELD_LEN)
-               return new IDMError(400,"user description max length is :" + UserStore.MAX_FIELD_LEN,"").response();
+         }
+         else if (user.getDescription().length()>UserStore.MAX_FIELD_LEN) {
+            return new IDMError(400,"user description max length is :" + UserStore.MAX_FIELD_LEN,"").response();
+         }
 
          // user email is optional
-         if (user.getEmail()==null)
+         if (user.getEmail()==null) {
             user.setEmail("");
-         else
-            if (user.getEmail().length()>UserStore.MAX_FIELD_LEN)
-               return new IDMError(400,"user email max length is :" + UserStore.MAX_FIELD_LEN,"").response();
+         }
+         else if (user.getEmail().length()>UserStore.MAX_FIELD_LEN) {
+            return new IDMError(400,"user email max length is :" + UserStore.MAX_FIELD_LEN,"").response();
+         }
 
          // user password optional and will default if not provided
-         if (user.getPassword()==null)
+         if (user.getPassword()==null) {
             user.setPassword(DEFAULT_PWD);
-         else
-            if (user.getPassword().length()>UserStore.MAX_FIELD_LEN)
-               return new IDMError(400,"user password max length is :" + UserStore.MAX_FIELD_LEN,"").response();
+         }
+         else if (user.getPassword().length()>UserStore.MAX_FIELD_LEN) {
+            return new IDMError(400,"user password max length is :" + UserStore.MAX_FIELD_LEN,"").response();
+         }
 
          // create user
          user = userStore.createUser(user);
       }
       catch (StoreException se) {
          return new IDMError(500,"internal error creating user",se.message).response();
-      } 
+      }
 
       // created!
       return Response.status(201).entity(user).build();
-   } 
+   }
 
 
    @PUT
@@ -195,5 +201,5 @@ public class UserHandler {
       return Response.status(204).build();
    }
 
+
 }