directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [1/2] directory-fortress-core git commit: Fixed some of the Sonar critical issues
Date Tue, 19 May 2015 15:43:59 GMT
Repository: directory-fortress-core
Updated Branches:
  refs/heads/master 9bebe5733 -> 99a6ab383


Fixed some of the Sonar critical issues


Project: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/commit/77efdc6c
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/77efdc6c
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/77efdc6c

Branch: refs/heads/master
Commit: 77efdc6c2abba1f02548e8ec5b854e01bf77654c
Parents: f02712d
Author: Emmanuel L├ęcharny <elecharny@symas.com>
Authored: Tue May 19 17:27:02 2015 +0200
Committer: Emmanuel L├ęcharny <elecharny@symas.com>
Committed: Tue May 19 17:27:02 2015 +0200

----------------------------------------------------------------------
 .../core/cli/CommandLineInterpreter.java        |  36 +-
 .../directory/fortress/core/rbac/PermDAO.java   |  13 +-
 .../directory/fortress/core/rbac/SdDAO.java     |   2 +-
 .../directory/fortress/core/rbac/User.java      |  72 +++-
 .../directory/fortress/core/rbac/UserDAO.java   | 418 +++++++++++--------
 .../directory/fortress/core/rbac/UserP.java     |  12 +-
 .../fortress/core/util/attr/VUtil.java          |   4 +-
 .../fortress/core/util/time/ClockTime.java      |  20 +-
 .../fortress/core/util/time/TUtil.java          |  31 +-
 .../fortress/core/util/time/Timeout.java        |  17 +-
 10 files changed, 390 insertions(+), 235 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java b/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java
index d2b1aed..4223169 100755
--- a/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java
+++ b/src/main/java/org/apache/directory/fortress/core/cli/CommandLineInterpreter.java
@@ -1161,6 +1161,7 @@ public class CommandLineInterpreter
     private void printPermission( Permission perm )
     {
         String type = "P";
+
         if ( perm != null )
         {
             printRow( type, "POBJ", perm.getObjName() );
@@ -1168,6 +1169,7 @@ public class CommandLineInterpreter
             printRow( type, "IID", perm.getInternalId() );
             printRow( type, "TYPE", perm.getType() );
         }
+
         if ( VUtil.isNotNullOrEmpty( perm != null ? perm.getRoles() : null ) )
         {
             for ( String roleName : perm.getRoles() )
@@ -1175,24 +1177,30 @@ public class CommandLineInterpreter
                 printRow( "R", "ROLE", roleName );
             }
         }
-        if ( VUtil.isNotNullOrEmpty( perm.getUsers() ) )
+
+        if ( perm != null )
         {
-            for ( String userId : perm.getUsers() )
+            if ( VUtil.isNotNullOrEmpty( perm.getUsers() ) )
             {
-                printRow( "U", "USER", userId );
+                for ( String userId : perm.getUsers() )
+                {
+                    printRow( "U", "USER", userId );
+                }
             }
-        }
-        if ( VUtil.isNotNullOrEmpty( perm.getProperties() ) )
-        {
-            printSeparator();
-            int ctr = 0;
-            for ( Enumeration<?> e = perm.getProperties().propertyNames(); e.hasMoreElements(); )
+
+            if ( VUtil.isNotNullOrEmpty( perm.getProperties() ) )
             {
-                String key = ( String ) e.nextElement();
-                String val = perm.getProperty( key );
-                ++ctr;
-                LOG.info( "{}   KEY{} [{}]", type, ctr, key );
-                LOG.info( "{}   VAL{} [{}]", type, ctr, val );
+                printSeparator();
+                int ctr = 0;
+
+                for ( Enumeration<?> e = perm.getProperties().propertyNames(); e.hasMoreElements(); )
+                {
+                    String key = ( String ) e.nextElement();
+                    String val = perm.getProperty( key );
+                    ++ctr;
+                    LOG.info( "{}   KEY{} [{}]", type, ctr, key );
+                    LOG.info( "{}   VAL{} [{}]", type, ctr, val );
+                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java
index b2f23e3..d0c4e6e 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/PermDAO.java
@@ -1437,9 +1437,12 @@ final class PermDAO extends ApacheDsDataProvider
 
         try
         {
-            String filter = GlobalIds.FILTER_PREFIX + PERM_OP_OBJECT_CLASS_NAME + ")(|";
-            filter += "(" + USERS + "=" + session.getUserId() + ")";
+            StringBuilder filter = new StringBuilder();
+
+            filter.append( GlobalIds.FILTER_PREFIX ).append( PERM_OP_OBJECT_CLASS_NAME ).append( ")(|" );
+            filter.append( "(" ).append( USERS ).append( "=" ).append( session.getUserId() ).append( ")" );
             Set<String> roles;
+
             if ( isAdmin )
             {
                 roles = AdminRoleUtil.getInheritedRoles( session.getAdminRoles(), session.getContextId() );
@@ -1452,14 +1455,14 @@ final class PermDAO extends ApacheDsDataProvider
             {
                 for ( String uRole : roles )
                 {
-                    filter += "(" + ROLES + "=" + uRole + ")";
+                    filter.append( "(" ).append( ROLES ).append( "=" ).append( uRole ).append( ")" );
                 }
             }
 
-            filter += "))";
+            filter.append( "))" );
             ld = getAdminConnection();
             SearchCursor searchResults = search( ld, permRoot,
-                SearchScope.SUBTREE, filter, PERMISSION_OP_ATRS, false, GlobalIds.BATCH_SIZE );
+                SearchScope.SUBTREE, filter.toString(), PERMISSION_OP_ATRS, false, GlobalIds.BATCH_SIZE );
             long sequence = 0;
 
             while ( searchResults.next() )

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java
index 3935ff6..3d91b3b 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/SdDAO.java
@@ -634,7 +634,7 @@ final class SdDAO extends ApacheDsDataProvider
         entity.setDescription( getAttribute( le, SchemaConstants.DESCRIPTION_AT ) );
         entity.setMembers( getAttributeSet( le, ROLES ) );
         String szCard = getAttribute( le, SD_SET_CARDINALITY );
-        entity.setCardinality( new Integer( szCard ) );
+        entity.setCardinality( Integer.valueOf( szCard ) );
 
         return entity;
     }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/rbac/User.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/User.java b/src/main/java/org/apache/directory/fortress/core/rbac/User.java
index 04dfa6b..2e03651 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/User.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/User.java
@@ -232,7 +232,7 @@ import org.apache.directory.fortress.core.util.time.Constraint;
         "homeDirectory",
         "loginShell",
         "gecos"
-/*        "jpegPhoto"*/
+    /*        "jpegPhoto"*/
 })
 public class User extends FortEntity implements Constraint, Serializable
 {
@@ -296,51 +296,61 @@ public class User extends FortEntity implements Constraint, Serializable
     private String loginShell;
     private String gecos;
 
+
     public String getUidNumber()
     {
         return uidNumber;
     }
 
+
     public void setUidNumber( String uidNumber )
     {
         this.uidNumber = uidNumber;
     }
 
+
     public String getGidNumber()
     {
         return gidNumber;
     }
 
+
     public void setGidNumber( String gidNumber )
     {
         this.gidNumber = gidNumber;
     }
 
+
     public String getHomeDirectory()
     {
         return homeDirectory;
     }
 
+
     public void setHomeDirectory( String homeDirectory )
     {
         this.homeDirectory = homeDirectory;
     }
 
+
     public String getLoginShell()
     {
         return loginShell;
     }
 
+
     public void setLoginShell( String loginShell )
     {
         this.loginShell = loginShell;
     }
 
+
     public String getGecos()
     {
         return gecos;
     }
 
+
     public void setGecos( String gecos )
     {
         this.gecos = gecos;
@@ -376,7 +386,7 @@ public class User extends FortEntity implements Constraint, Serializable
     public User( String userId, char[] password )
     {
         this.userId = userId;
-        if( password != null )
+        if ( password != null )
             this.password = password.clone();
     }
 
@@ -391,7 +401,7 @@ public class User extends FortEntity implements Constraint, Serializable
     public User( String userId, char[] password, String roleName )
     {
         this.userId = userId;
-        if( password != null )
+        if ( password != null )
             this.password = password.clone();
         setRole( new UserRole( roleName ) );
     }
@@ -407,7 +417,7 @@ public class User extends FortEntity implements Constraint, Serializable
     public User( String userId, char[] password, String[] roleNames )
     {
         this.userId = userId;
-        if( password != null )
+        if ( password != null )
             this.password = password.clone();
 
         if ( roleNames != null )
@@ -431,12 +441,13 @@ public class User extends FortEntity implements Constraint, Serializable
     public User( String userId, char[] password, String roleName, String ou )
     {
         this.userId = userId;
-        if( password != null )
+        if ( password != null )
             this.password = password.clone();
         setRole( new UserRole( roleName ) );
         this.ou = ou;
     }
 
+
     /**
      * Used to retrieve User's valid userId attribute.  The Fortress userId maps to 'uid' for InetOrgPerson object class.
      *
@@ -478,6 +489,7 @@ public class User extends FortEntity implements Constraint, Serializable
             '}';
     }
 
+
     /**
      * Required by Constraint Interface but not needed for user entity. Not intended for external use.
      *
@@ -821,7 +833,17 @@ public class User extends FortEntity implements Constraint, Serializable
      */
     public char[] getPassword()
     {
-        return password;
+        if ( password != null )
+        {
+            char[] copy = new char[password.length];
+            System.arraycopy( password, 0, copy, 0, password.length );
+
+            return copy;
+        }
+        else
+        {
+            return null;
+        }
     }
 
 
@@ -834,19 +856,47 @@ public class User extends FortEntity implements Constraint, Serializable
      */
     public void setPassword( char[] password )
     {
-        this.password = password;
+        if ( password != null )
+        {
+            // Copy the password
+            this.password = new char[password.length];
+            System.arraycopy( password, 0, this.password, 0, password.length );
+        }
+        else
+        {
+            this.password = null;
+        }
     }
 
 
     public char[] getNewPassword()
     {
-        return newPassword;
+        if ( newPassword != null )
+        {
+            char[] copy = new char[newPassword.length];
+            System.arraycopy( newPassword, 0, copy, 0, newPassword.length );
+
+            return copy;
+        }
+        else
+        {
+            return null;
+        }
     }
 
 
     public void setNewPassword( char[] newPassword )
     {
-        this.newPassword = newPassword;
+        if ( newPassword != null )
+        {
+            // Copy the newPassword
+            this.newPassword = new char[newPassword.length];
+            System.arraycopy( newPassword, 0, this.newPassword, 0, newPassword.length );
+        }
+        else
+        {
+            this.newPassword = null;
+        }
     }
 
 
@@ -956,6 +1006,7 @@ public class User extends FortEntity implements Constraint, Serializable
         return displayName;
     }
 
+
     /**
      * Optional attribute maps to 'displayName' attribute on inetOrgPerson object class.
      *
@@ -966,6 +1017,7 @@ public class User extends FortEntity implements Constraint, Serializable
         this.displayName = displayName;
     }
 
+
     /**
      * temporal boolean flag is used by internal Fortress components.
      *
@@ -1566,7 +1618,7 @@ public class User extends FortEntity implements Constraint, Serializable
      */
     public void setJpegPhoto( byte[] jpegPhoto )
     {
-        if( jpegPhoto != null )
+        if ( jpegPhoto != null )
             this.jpegPhoto = jpegPhoto.clone();
     }
 

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java b/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java
index 928c176..c634988 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/UserDAO.java
@@ -151,9 +151,10 @@ final class UserDAO extends ApacheDsDataProvider
 
     // The Fortress User entity attributes are stored within standard LDAP object classes along with custom auxiliary
     // object classes:
-    private static final String USER_OBJ_CLASS[] = {SchemaConstants.TOP_OC, Config.getProperty( USER_OBJECT_CLASS ),
-        USERS_AUX_OBJECT_CLASS_NAME, GlobalIds.PROPS_AUX_OBJECT_CLASS_NAME, GlobalIds
-        .FT_MODIFIER_AUX_OBJECT_CLASS_NAME, USERS_EXTENSIBLE_OBJECT,
+    private static final String USER_OBJ_CLASS[] =
+        { SchemaConstants.TOP_OC, Config.getProperty( USER_OBJECT_CLASS ),
+            USERS_AUX_OBJECT_CLASS_NAME, GlobalIds.PROPS_AUX_OBJECT_CLASS_NAME, GlobalIds
+            .FT_MODIFIER_AUX_OBJECT_CLASS_NAME, USERS_EXTENSIBLE_OBJECT,
         //            POSIX_ACCOUNT_OBJECT_CLASS_NAME
     };
 
@@ -197,10 +198,13 @@ final class UserDAO extends ApacheDsDataProvider
     private static final String OPENLDAP_PW_LOCKED_TIME = "pwdAccountLockedTime";
     private static final String OPENLDAP_ACCOUNT_LOCKED_TIME = "pwdAccountLockedTime";
     private static final String LOCK_VALUE = "000001010000Z";
-    private static final String[] USERID = {SchemaConstants.UID_AT};
-    private static final String[] ROLES = {GlobalIds.USER_ROLE_ASSIGN};
+    private static final String[] USERID =
+        { SchemaConstants.UID_AT };
+    private static final String[] ROLES =
+        { GlobalIds.USER_ROLE_ASSIGN };
 
-    private static final String[] USERID_ATRS = {SchemaConstants.UID_AT};
+    private static final String[] USERID_ATRS =
+        { SchemaConstants.UID_AT };
 
     // These will be loaded in static initializer that follows:
     private static String[] AUTHN_ATRS = null;
@@ -216,101 +220,167 @@ final class UserDAO extends ApacheDsDataProvider
         if ( GlobalIds.IS_OPENLDAP )
         {
             // This default set of attributes contains all and is used for search operations.
-            DEFAULT_ATRS = new String[]{GlobalIds.FT_IID, SchemaConstants.UID_AT, SchemaConstants.USER_PASSWORD_AT,
-                SchemaConstants.DESCRIPTION_AT, SchemaConstants.OU_AT, SchemaConstants.CN_AT, SchemaConstants.SN_AT,
-                GlobalIds.USER_ROLE_DATA, GlobalIds.CONSTRAINT, GlobalIds.USER_ROLE_ASSIGN, OPENLDAP_PW_RESET,
-                OPENLDAP_PW_LOCKED_TIME, OPENLDAP_POLICY_SUBENTRY, GlobalIds.PROPS, GlobalIds.USER_ADMINROLE_ASSIGN,
-                GlobalIds.USER_ADMINROLE_DATA, SchemaConstants.POSTAL_ADDRESS_AT, SchemaConstants.L_AT,
-                SchemaConstants.POSTALCODE_AT, SchemaConstants.POSTOFFICEBOX_AT, SchemaConstants.ST_AT,
-                SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT, DEPARTMENT_NUMBER, ROOM_NUMBER, SchemaConstants
-                .TELEPHONE_NUMBER_AT, MOBILE, SchemaConstants.MAIL_AT, EMPLOYEE_TYPE, SchemaConstants.TITLE_AT,
-                SYSTEM_USER, JPEGPHOTO,
-/*
-            TODO: add for RFC2307Bis
-            UID_NUMBER,
-            GID_NUMBER,
-            HOME_DIRECTORY,
-            LOGIN_SHELL,
-            GECOS
-*/};
+            DEFAULT_ATRS = new String[]
+                {
+                    GlobalIds.FT_IID,
+                    SchemaConstants.UID_AT,
+                    SchemaConstants.USER_PASSWORD_AT,
+                    SchemaConstants.DESCRIPTION_AT,
+                    SchemaConstants.OU_AT,
+                    SchemaConstants.CN_AT,
+                    SchemaConstants.SN_AT,
+                    GlobalIds.USER_ROLE_DATA,
+                    GlobalIds.CONSTRAINT,
+                    GlobalIds.USER_ROLE_ASSIGN,
+                    OPENLDAP_PW_RESET,
+                    OPENLDAP_PW_LOCKED_TIME,
+                    OPENLDAP_POLICY_SUBENTRY,
+                    GlobalIds.PROPS,
+                    GlobalIds.USER_ADMINROLE_ASSIGN,
+                    GlobalIds.USER_ADMINROLE_DATA,
+                    SchemaConstants.POSTAL_ADDRESS_AT,
+                    SchemaConstants.L_AT,
+                    SchemaConstants.POSTALCODE_AT,
+                    SchemaConstants.POSTOFFICEBOX_AT,
+                    SchemaConstants.ST_AT,
+                    SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT,
+                    DEPARTMENT_NUMBER,
+                    ROOM_NUMBER,
+                    SchemaConstants
+                    .TELEPHONE_NUMBER_AT,
+                    MOBILE,
+                    SchemaConstants.MAIL_AT,
+                    EMPLOYEE_TYPE,
+                    SchemaConstants.TITLE_AT,
+                    SYSTEM_USER,
+                    JPEGPHOTO,
+                /*
+                            TODO: add for RFC2307Bis
+                            UID_NUMBER,
+                            GID_NUMBER,
+                            HOME_DIRECTORY,
+                            LOGIN_SHELL,
+                            GECOS
+                */};
 
             // This smaller result set of attributes are needed for user validation and authentication operations.
-            AUTHN_ATRS = new String[]{GlobalIds.FT_IID, SchemaConstants.UID_AT, SchemaConstants.USER_PASSWORD_AT,
-                SchemaConstants.DESCRIPTION_AT, SchemaConstants.OU_AT, SchemaConstants.CN_AT, SchemaConstants.SN_AT,
-                GlobalIds.CONSTRAINT, OPENLDAP_PW_RESET, OPENLDAP_PW_LOCKED_TIME, GlobalIds.PROPS};
+            AUTHN_ATRS = new String[]
+                {
+                    GlobalIds.FT_IID,
+                    SchemaConstants.UID_AT,
+                    SchemaConstants.USER_PASSWORD_AT,
+                    SchemaConstants.DESCRIPTION_AT,
+                    SchemaConstants.OU_AT,
+                    SchemaConstants.CN_AT,
+                    SchemaConstants.SN_AT,
+                    GlobalIds.CONSTRAINT,
+                    OPENLDAP_PW_RESET,
+                    OPENLDAP_PW_LOCKED_TIME,
+                    GlobalIds.PROPS };
         }
 
         else
         {
-            DEFAULT_ATRS = new String[]{GlobalIds.FT_IID, SchemaConstants.UID_AT, SchemaConstants.USER_PASSWORD_AT,
-                SchemaConstants.DESCRIPTION_AT, SchemaConstants.OU_AT, SchemaConstants.CN_AT, SchemaConstants.SN_AT,
-                GlobalIds.USER_ROLE_DATA, GlobalIds.CONSTRAINT, GlobalIds.USER_ROLE_ASSIGN, GlobalIds.PROPS,
-                GlobalIds.USER_ADMINROLE_ASSIGN, GlobalIds.USER_ADMINROLE_DATA, SchemaConstants.POSTAL_ADDRESS_AT,
-                SchemaConstants.L_AT, SchemaConstants.POSTALCODE_AT, SchemaConstants.POSTOFFICEBOX_AT,
-                SchemaConstants.ST_AT, SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT, DEPARTMENT_NUMBER,
-                ROOM_NUMBER, SchemaConstants.TELEPHONE_NUMBER_AT, MOBILE, SchemaConstants.MAIL_AT, EMPLOYEE_TYPE,
-                SchemaConstants.TITLE_AT, SYSTEM_USER, JPEGPHOTO,};
+            DEFAULT_ATRS = new String[]
+                {
+                    GlobalIds.FT_IID,
+                    SchemaConstants.UID_AT,
+                    SchemaConstants.USER_PASSWORD_AT,
+                    SchemaConstants.DESCRIPTION_AT,
+                    SchemaConstants.OU_AT,
+                    SchemaConstants.CN_AT,
+                    SchemaConstants.SN_AT,
+                    GlobalIds.USER_ROLE_DATA,
+                    GlobalIds.CONSTRAINT,
+                    GlobalIds.USER_ROLE_ASSIGN,
+                    GlobalIds.PROPS,
+                    GlobalIds.USER_ADMINROLE_ASSIGN,
+                    GlobalIds.USER_ADMINROLE_DATA,
+                    SchemaConstants.POSTAL_ADDRESS_AT,
+                    SchemaConstants.L_AT,
+                    SchemaConstants.POSTALCODE_AT,
+                    SchemaConstants.POSTOFFICEBOX_AT,
+                    SchemaConstants.ST_AT,
+                    SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT,
+                    DEPARTMENT_NUMBER,
+                    ROOM_NUMBER,
+                    SchemaConstants.TELEPHONE_NUMBER_AT,
+                    MOBILE,
+                    SchemaConstants.MAIL_AT,
+                    EMPLOYEE_TYPE,
+                    SchemaConstants.TITLE_AT,
+                    SYSTEM_USER,
+                    JPEGPHOTO, };
 
             // This smaller result set of attributes are needed for user validation and authentication operations.
-            AUTHN_ATRS = new String[]{GlobalIds.FT_IID, SchemaConstants.UID_AT, SchemaConstants.USER_PASSWORD_AT,
-                SchemaConstants.DESCRIPTION_AT, SchemaConstants.OU_AT, SchemaConstants.CN_AT, SchemaConstants.SN_AT,
-                GlobalIds.CONSTRAINT, GlobalIds.PROPS};
+            AUTHN_ATRS = new String[]
+                {
+                    GlobalIds.FT_IID,
+                    SchemaConstants.UID_AT,
+                    SchemaConstants.USER_PASSWORD_AT,
+                    SchemaConstants.DESCRIPTION_AT,
+                    SchemaConstants.OU_AT,
+                    SchemaConstants.CN_AT,
+                    SchemaConstants.SN_AT,
+                    GlobalIds.CONSTRAINT,
+                    GlobalIds.PROPS };
         }
 
-
     }
 
     // This default set of attributes contains all and is used for search operations.
-/*
-    private static final String[] DEFAULT_ATRS =
-        {
-            GlobalIds.FT_IID,
-            SchemaConstants.UID_AT, SchemaConstants.USER_PASSWORD_AT,
-            SchemaConstants.DESCRIPTION_AT,
-            SchemaConstants.OU_AT,
-            SchemaConstants.CN_AT,
-            SchemaConstants.SN_AT,
-            GlobalIds.USER_ROLE_DATA,
-            GlobalIds.CONSTRAINT,
-            GlobalIds.USER_ROLE_ASSIGN,
-            GlobalIds.IS_OPENLDAP ? OPENLDAP_PW_RESET : "",
-            GlobalIds.IS_OPENLDAP ? OPENLDAP_PW_LOCKED_TIME : "",
-            GlobalIds.IS_OPENLDAP ? OPENLDAP_POLICY_SUBENTRY : "",
-            GlobalIds.PROPS,
-            GlobalIds.USER_ADMINROLE_ASSIGN,
-            GlobalIds.USER_ADMINROLE_DATA,
-            SchemaConstants.POSTAL_ADDRESS_AT,
-            SchemaConstants.L_AT,
-            SchemaConstants.POSTALCODE_AT,
-            SchemaConstants.POSTOFFICEBOX_AT,
-            SchemaConstants.ST_AT,
-            SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT,
-            DEPARTMENT_NUMBER,
-            ROOM_NUMBER,
-            SchemaConstants.TELEPHONE_NUMBER_AT,
-            MOBILE,
-            SchemaConstants.MAIL_AT,
-            EMPLOYEE_TYPE,
-            SchemaConstants.TITLE_AT,
-            SYSTEM_USER,
-            JPEGPHOTO,
-
-*/
-/*
-            TODO: add for RFC2307Bis
-            UID_NUMBER,
-            GID_NUMBER,
-            HOME_DIRECTORY,
-            LOGIN_SHELL,
-            GECOS
-*//*
-
-    };
-*/
+    /*
+        private static final String[] DEFAULT_ATRS =
+            {
+                GlobalIds.FT_IID,
+                SchemaConstants.UID_AT, SchemaConstants.USER_PASSWORD_AT,
+                SchemaConstants.DESCRIPTION_AT,
+                SchemaConstants.OU_AT,
+                SchemaConstants.CN_AT,
+                SchemaConstants.SN_AT,
+                GlobalIds.USER_ROLE_DATA,
+                GlobalIds.CONSTRAINT,
+                GlobalIds.USER_ROLE_ASSIGN,
+                GlobalIds.IS_OPENLDAP ? OPENLDAP_PW_RESET : "",
+                GlobalIds.IS_OPENLDAP ? OPENLDAP_PW_LOCKED_TIME : "",
+                GlobalIds.IS_OPENLDAP ? OPENLDAP_POLICY_SUBENTRY : "",
+                GlobalIds.PROPS,
+                GlobalIds.USER_ADMINROLE_ASSIGN,
+                GlobalIds.USER_ADMINROLE_DATA,
+                SchemaConstants.POSTAL_ADDRESS_AT,
+                SchemaConstants.L_AT,
+                SchemaConstants.POSTALCODE_AT,
+                SchemaConstants.POSTOFFICEBOX_AT,
+                SchemaConstants.ST_AT,
+                SchemaConstants.PHYSICAL_DELIVERY_OFFICE_NAME_AT,
+                DEPARTMENT_NUMBER,
+                ROOM_NUMBER,
+                SchemaConstants.TELEPHONE_NUMBER_AT,
+                MOBILE,
+                SchemaConstants.MAIL_AT,
+                EMPLOYEE_TYPE,
+                SchemaConstants.TITLE_AT,
+                SYSTEM_USER,
+                JPEGPHOTO,
+
+    */
+    /*
+                TODO: add for RFC2307Bis
+                UID_NUMBER,
+                GID_NUMBER,
+                HOME_DIRECTORY,
+                LOGIN_SHELL,
+                GECOS
+    *//*
+
+        };
+      */
 
-    private static final String[] ROLE_ATR = {GlobalIds.USER_ROLE_DATA};
+    private static final String[] ROLE_ATR =
+        { GlobalIds.USER_ROLE_DATA };
 
-    private static final String[] AROLE_ATR = {GlobalIds.USER_ADMINROLE_DATA};
+    private static final String[] AROLE_ATR =
+        { GlobalIds.USER_ADMINROLE_DATA };
 
 
     /**
@@ -318,7 +388,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws CreateException
      */
-    final User create(User entity) throws CreateException
+    final User create( User entity ) throws CreateException
     {
         LdapConnection ld = null;
 
@@ -352,7 +422,8 @@ final class UserDAO extends ApacheDsDataProvider
 
             // guard against npe
             myEntry.add( SchemaConstants.USER_PASSWORD_AT, VUtil.isNotNullOrEmpty( entity.getPassword() ) ? new
-                String( entity.getPassword() ) : new String( new char[]{} ) );
+                String( entity.getPassword() ) : new String( new char[]
+                    {} ) );
             myEntry.add( SchemaConstants.DISPLAY_NAME_AT, entity.getCn() );
 
             if ( VUtil.isNotNullOrEmpty( entity.getTitle() ) )
@@ -365,33 +436,33 @@ final class UserDAO extends ApacheDsDataProvider
                 myEntry.add( EMPLOYEE_TYPE, entity.getEmployeeType() );
             }
 
-/*
-            TODO: add RFC2307BIS
-            if ( VUtil.isNotNullOrEmpty( entity.getUidNumber() ) )
-            {
-                myEntry.add( UID_NUMBER, entity.getUidNumber() );
-            }
+            /*
+                        TODO: add RFC2307BIS
+                        if ( VUtil.isNotNullOrEmpty( entity.getUidNumber() ) )
+                        {
+                            myEntry.add( UID_NUMBER, entity.getUidNumber() );
+                        }
 
-            if ( VUtil.isNotNullOrEmpty( entity.getGidNumber() ) )
-            {
-                myEntry.add( GID_NUMBER, entity.getGidNumber() );
-            }
+                        if ( VUtil.isNotNullOrEmpty( entity.getGidNumber() ) )
+                        {
+                            myEntry.add( GID_NUMBER, entity.getGidNumber() );
+                        }
 
-            if ( VUtil.isNotNullOrEmpty( entity.getHomeDirectory() ) )
-            {
-                myEntry.add( HOME_DIRECTORY, entity.getHomeDirectory() );
-            }
+                        if ( VUtil.isNotNullOrEmpty( entity.getHomeDirectory() ) )
+                        {
+                            myEntry.add( HOME_DIRECTORY, entity.getHomeDirectory() );
+                        }
 
-            if ( VUtil.isNotNullOrEmpty( entity.getLoginShell() ) )
-            {
-                myEntry.add( LOGIN_SHELL, entity.getLoginShell() );
-            }
+                        if ( VUtil.isNotNullOrEmpty( entity.getLoginShell() ) )
+                        {
+                            myEntry.add( LOGIN_SHELL, entity.getLoginShell() );
+                        }
 
-            if ( VUtil.isNotNullOrEmpty( entity.getGecos() ) )
-            {
-                myEntry.add( GECOS, entity.getGecos() );
-            }
-*/
+                        if ( VUtil.isNotNullOrEmpty( entity.getGecos() ) )
+                        {
+                            myEntry.add( GECOS, entity.getGecos() );
+                        }
+            */
 
             // These are multi-valued attributes, use the util function to load.
             // These items are optional.  The utility function will return quietly if item list is empty:
@@ -459,7 +530,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws UpdateException
      */
-    final User update(User entity) throws UpdateException
+    final User update( User entity ) throws UpdateException
     {
         LdapConnection ld = null;
         String userDn = getDn( entity.getUserId(), entity.getContextId() );
@@ -584,7 +655,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws UpdateException
      */
-    final User updateProps(User entity, boolean replace) throws UpdateException
+    final User updateProps( User entity, boolean replace ) throws UpdateException
     {
         LdapConnection ld = null;
         String userDn = getDn( entity.getUserId(), entity.getContextId() );
@@ -626,7 +697,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param user
      * @throws RemoveException
      */
-    final String remove(User user) throws RemoveException
+    final String remove( User user ) throws RemoveException
     {
         LdapConnection ld = null;
         String userDn = getDn( user.getUserId(), user.getContextId() );
@@ -654,7 +725,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param user
      * @throws org.apache.directory.fortress.core.UpdateException
      */
-    final void lock(User user) throws UpdateException
+    final void lock( User user ) throws UpdateException
     {
         LdapConnection ld = null;
         String userDn = getDn( user.getUserId(), user.getContextId() );
@@ -683,7 +754,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param user
      * @throws UpdateException
      */
-    final void unlock(User user) throws UpdateException
+    final void unlock( User user ) throws UpdateException
     {
         LdapConnection ld = null;
         String userDn = getDn( user.getUserId(), user.getContextId() );
@@ -718,7 +789,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws org.apache.directory.fortress.core.FinderException
      */
-    final User getUser(User user, boolean isRoles) throws FinderException
+    final User getUser( User user, boolean isRoles ) throws FinderException
     {
         User entity = null;
         LdapConnection ld = null;
@@ -789,7 +860,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws org.apache.directory.fortress.core.FinderException
      */
-    final List<UserAdminRole> getUserAdminRoles(User user) throws FinderException
+    final List<UserAdminRole> getUserAdminRoles( User user ) throws FinderException
     {
         List<UserAdminRole> roles = null;
         LdapConnection ld = null;
@@ -825,7 +896,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws org.apache.directory.fortress.core.FinderException
      */
-    final List<String> getRoles(User user) throws FinderException
+    final List<String> getRoles( User user ) throws FinderException
     {
         List<String> roles = null;
         LdapConnection ld = null;
@@ -869,11 +940,12 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws org.apache.directory.fortress.core.FinderException,  org.apache.directory.fortress.core.PasswordException
      */
-    final Session checkPassword(User user) throws FinderException, PasswordException
+    final Session checkPassword( User user ) throws FinderException, PasswordException
     {
         Session session = null;
         LdapConnection ld = null;
         String userDn = getDn( user.getUserId(), user.getContextId() );
+
         try
         {
             session = new ObjectFactory().createSession();
@@ -882,6 +954,7 @@ final class UserDAO extends ApacheDsDataProvider
             ld = getUserConnection();
             BindResponse bindResponse = bind( ld, userDn, user.getPassword() );
             String info = null;
+
             if ( bindResponse.getLdapResult().getResultCode() != ResultCodeEnum.SUCCESS )
             {
                 info = "PASSWORD INVALID for userId [" + user.getUserId() + "], resultCode [" +
@@ -889,12 +962,15 @@ final class UserDAO extends ApacheDsDataProvider
                 session.setMsg( info );
                 session.setErrorId( GlobalErrIds.USER_PW_INVLD );
             }
+
             PasswordPolicy respCtrl = getPwdRespCtrl( bindResponse );
+
             if ( respCtrl != null )
             {
                 // check IETF password policies here
                 checkPwPolicies( session, respCtrl );
             }
+
             if ( session.getErrorId() == 0 )
             {
                 session.setAuthenticated( true );
@@ -924,7 +1000,7 @@ final class UserDAO extends ApacheDsDataProvider
     }
 
 
-    private void checkPwPolicies(PwMessage pwMsg, PasswordPolicy respCtrl)
+    private void checkPwPolicies( PwMessage pwMsg, PasswordPolicy respCtrl )
     {
         int rc = 0;
         boolean result = false;
@@ -1039,7 +1115,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    final List<User> findUsers(User user) throws FinderException
+    final List<User> findUsers( User user ) throws FinderException
     {
         List<User> userList = new ArrayList<>();
         LdapConnection ld = null;
@@ -1104,7 +1180,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    final List<String> findUsers(User user, int limit) throws FinderException
+    final List<String> findUsers( User user, int limit ) throws FinderException
     {
         List<String> userList = new ArrayList<>();
         LdapConnection ld = null;
@@ -1149,7 +1225,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    final List<User> getAuthorizedUsers(Role role) throws FinderException
+    final List<User> getAuthorizedUsers( Role role ) throws FinderException
     {
         List<User> userList = new ArrayList<>();
         LdapConnection ld = null;
@@ -1158,28 +1234,31 @@ final class UserDAO extends ApacheDsDataProvider
         try
         {
             String roleVal = encodeSafeText( role.getName(), GlobalIds.USERID_LEN );
-            String filter = GlobalIds.FILTER_PREFIX + USERS_AUX_OBJECT_CLASS_NAME + ")(";
+            StringBuilder filter = new StringBuilder();
+            filter.append( GlobalIds.FILTER_PREFIX ).append( USERS_AUX_OBJECT_CLASS_NAME ).append( ")(" );
             Set<String> roles = RoleUtil.getDescendants( role.getName(), role.getContextId() );
 
             if ( VUtil.isNotNullOrEmpty( roles ) )
             {
-                filter += "|(" + GlobalIds.USER_ROLE_ASSIGN + "=" + roleVal + ")";
+                filter.append( "|(" ).append( GlobalIds.USER_ROLE_ASSIGN ).append( "=" ).append( roleVal ).append( ")" );
 
                 for ( String uRole : roles )
                 {
-                    filter += "(" + GlobalIds.USER_ROLE_ASSIGN + "=" + uRole + ")";
+                    filter.append( "(" ).append( GlobalIds.USER_ROLE_ASSIGN ).append( "=" ).append( uRole )
+                        .append( ")" );
                 }
 
-                filter += ")";
+                filter.append( ")" );
             }
             else
             {
-                filter += GlobalIds.USER_ROLE_ASSIGN + "=" + roleVal + ")";
+                filter.append( GlobalIds.USER_ROLE_ASSIGN ).append( "=" ).append( roleVal ).append( ")" );
             }
 
-            filter += ")";
+            filter.append( ")" );
             ld = getAdminConnection();
-            SearchCursor searchResults = search( ld, userRoot, SearchScope.ONELEVEL, filter, DEFAULT_ATRS, false,
+            SearchCursor searchResults = search( ld, userRoot, SearchScope.ONELEVEL, filter.toString(), DEFAULT_ATRS,
+                false,
                 GlobalIds.BATCH_SIZE );
             long sequence = 0;
 
@@ -1214,7 +1293,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    final List<User> getAssignedUsers(Role role) throws FinderException
+    final List<User> getAssignedUsers( Role role ) throws FinderException
     {
         List<User> userList = new ArrayList<>();
         LdapConnection ld = null;
@@ -1223,11 +1302,12 @@ final class UserDAO extends ApacheDsDataProvider
         try
         {
             String roleVal = encodeSafeText( role.getName(), GlobalIds.USERID_LEN );
-            String filter = GlobalIds.FILTER_PREFIX + USERS_AUX_OBJECT_CLASS_NAME + ")(" + GlobalIds.USER_ROLE_ASSIGN
-                + "=" + roleVal + "))";
+            StringBuilder filter = new StringBuilder();
+            filter.append( GlobalIds.FILTER_PREFIX ).append( USERS_AUX_OBJECT_CLASS_NAME ).append( ")(" );
+            filter.append( GlobalIds.USER_ROLE_ASSIGN ).append( "=" ).append( roleVal ).append( "))" );
             ld = getAdminConnection();
-            SearchCursor searchResults = search( ld, userRoot, SearchScope.ONELEVEL, filter, DEFAULT_ATRS, false,
-                GlobalIds.BATCH_SIZE );
+            SearchCursor searchResults = search( ld, userRoot, SearchScope.ONELEVEL, filter.toString(), DEFAULT_ATRS,
+                false, GlobalIds.BATCH_SIZE );
             long sequence = 0;
 
             while ( searchResults.next() )
@@ -1261,7 +1341,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    final Set<String> getAssignedUsers(Set<String> roles, String contextId) throws FinderException
+    final Set<String> getAssignedUsers( Set<String> roles, String contextId ) throws FinderException
     {
         Set<String> userSet = new HashSet<>();
         LdapConnection ld = null;
@@ -1318,7 +1398,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    final List<User> getAssignedUsers(AdminRole role) throws FinderException
+    final List<User> getAssignedUsers( AdminRole role ) throws FinderException
     {
         List<User> userList = new ArrayList<>();
         LdapConnection ld = null;
@@ -1366,7 +1446,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    final List<String> getAuthorizedUsers(Role role, int limit) throws FinderException
+    final List<String> getAuthorizedUsers( Role role, int limit ) throws FinderException
     {
         List<String> userList = new ArrayList<>();
         LdapConnection ld = null;
@@ -1413,7 +1493,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    final List<String> findUsersList(String searchVal, String contextId) throws FinderException
+    final List<String> findUsersList( String searchVal, String contextId ) throws FinderException
     {
         List<String> userList = new ArrayList<>();
         LdapConnection ld = null;
@@ -1458,7 +1538,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    final List<User> findUsers(OrgUnit ou, boolean limitSize) throws FinderException
+    final List<User> findUsers( OrgUnit ou, boolean limitSize ) throws FinderException
     {
         List<User> userList = new ArrayList<>();
         LdapConnection ld = null;
@@ -1517,7 +1597,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @throws SecurityException
      * @throws PasswordException
      */
-    final boolean changePassword(User entity, char[] newPassword) throws SecurityException
+    final boolean changePassword( User entity, char[] newPassword ) throws SecurityException
     {
         boolean rc = true;
         LdapConnection ld = null;
@@ -1579,7 +1659,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param user
      * @throws UpdateException
      */
-    final void resetUserPassword(User user) throws UpdateException
+    final void resetUserPassword( User user ) throws UpdateException
     {
         LdapConnection ld = null;
         String userDn = getDn( user.getUserId(), user.getContextId() );
@@ -1615,7 +1695,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @throws UpdateException
      * @throws FinderException
      */
-    final String assign(UserRole uRole) throws UpdateException, FinderException
+    final String assign( UserRole uRole ) throws UpdateException, FinderException
     {
         LdapConnection ld = null;
         String userDn = getDn( uRole.getUserId(), uRole.getContextId() );
@@ -1663,7 +1743,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @throws UpdateException
      * @throws FinderException
      */
-    final String deassign(UserRole uRole) throws UpdateException, FinderException
+    final String deassign( UserRole uRole ) throws UpdateException, FinderException
     {
         LdapConnection ld = null;
         String userDn = getDn( uRole.getUserId(), uRole.getContextId() );
@@ -1728,7 +1808,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @throws UpdateException
      * @throws FinderException
      */
-    final String assign(UserAdminRole uRole) throws UpdateException, FinderException
+    final String assign( UserAdminRole uRole ) throws UpdateException, FinderException
     {
         LdapConnection ld = null;
         String userDn = getDn( uRole.getUserId(), uRole.getContextId() );
@@ -1773,7 +1853,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @throws UpdateException
      * @throws FinderException
      */
-    final String deassign(UserAdminRole uRole) throws UpdateException, FinderException
+    final String deassign( UserAdminRole uRole ) throws UpdateException, FinderException
     {
         LdapConnection ld = null;
         String userDn = getDn( uRole.getUserId(), uRole.getContextId() );
@@ -1842,7 +1922,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @throws UpdateException
      * @throws Exception
      */
-    final String deletePwPolicy(User user) throws UpdateException
+    final String deletePwPolicy( User user ) throws UpdateException
     {
         LdapConnection ld = null;
         String userDn = getDn( user.getUserId(), user.getContextId() );
@@ -1875,7 +1955,8 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws LdapInvalidAttributeValueException
      */
-    private User unloadLdapEntry(Entry entry, long sequence, String contextId) throws LdapInvalidAttributeValueException
+    private User unloadLdapEntry( Entry entry, long sequence, String contextId )
+        throws LdapInvalidAttributeValueException
     {
         User entity = new ObjectFactory().createUser();
         entity.setSequenceId( sequence );
@@ -1902,14 +1983,14 @@ final class UserDAO extends ApacheDsDataProvider
             entity.setSystem( Boolean.valueOf( szBoolean ) );
         }
 
-/*
-        TODO: Add for RFC2307BIS
-        entity.setUidNumber( getAttribute( entry, UID_NUMBER ) );
-        entity.setGidNumber( getAttribute( entry, GID_NUMBER ) );
-        entity.setHomeDirectory( getAttribute( entry, HOME_DIRECTORY ) );
-        entity.setLoginShell( getAttribute( entry, LOGIN_SHELL ) );
-        entity.setGecos( getAttribute( entry, GECOS ) );
-*/
+        /*
+                TODO: Add for RFC2307BIS
+                entity.setUidNumber( getAttribute( entry, UID_NUMBER ) );
+                entity.setGidNumber( getAttribute( entry, GID_NUMBER ) );
+                entity.setHomeDirectory( getAttribute( entry, HOME_DIRECTORY ) );
+                entity.setLoginShell( getAttribute( entry, LOGIN_SHELL ) );
+                entity.setGecos( getAttribute( entry, GECOS ) );
+        */
 
         entity.addProperties( AttrHelper.getProperties( getAttributes( entry, GlobalIds.PROPS ) ) );
 
@@ -1945,7 +2026,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @return
      * @throws FinderException
      */
-    private List<UserRole> getUserRoles(String userId, String contextId) throws FinderException
+    private List<UserRole> getUserRoles( String userId, String contextId ) throws FinderException
     {
         List<UserRole> roles = null;
         LdapConnection ld = null;
@@ -1983,7 +2064,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param entry collection of ldap attributes containing ARBAC role assignments in raw ldap format.
      * @throws LdapException
      */
-    private void loadUserAdminRoles(List<UserAdminRole> list, Entry entry) throws LdapException
+    private void loadUserAdminRoles( List<UserAdminRole> list, Entry entry ) throws LdapException
     {
         if ( list != null )
         {
@@ -2013,7 +2094,8 @@ final class UserDAO extends ApacheDsDataProvider
      * @param mods contains ldap modification set containing RBAC role assignments in raw ldap format to be updated.
      * @throws LdapInvalidAttributeValueException
      */
-    private void loadUserRoles(List<UserRole> list, List<Modification> mods) throws LdapInvalidAttributeValueException
+    private void loadUserRoles( List<UserRole> list, List<Modification> mods )
+        throws LdapInvalidAttributeValueException
     {
         Attribute userRoleData = new DefaultAttribute( GlobalIds.USER_ROLE_DATA );
         Attribute userRoleAssign = new DefaultAttribute( GlobalIds.USER_ROLE_ASSIGN );
@@ -2043,7 +2125,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param mods contains ldap modification set containing ARBAC role assignments in raw ldap format to be updated.
      * @throws LdapInvalidAttributeValueException
      */
-    private void loadUserAdminRoles(List<UserAdminRole> list, List<Modification> mods) throws
+    private void loadUserAdminRoles( List<UserAdminRole> list, List<Modification> mods ) throws
         LdapInvalidAttributeValueException
     {
         Attribute userAdminRoleData = new DefaultAttribute( GlobalIds.USER_ADMINROLE_DATA );
@@ -2081,7 +2163,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param entry ldap entry containing attributes mapping to RBAC role assignments in raw ldap format.
      * @throws LdapException
      */
-    private void loadUserRoles(List<UserRole> list, Entry entry) throws LdapException
+    private void loadUserRoles( List<UserRole> list, Entry entry ) throws LdapException
     {
         if ( list != null )
         {
@@ -2109,7 +2191,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param entry   collection of ldap attributes containing RBAC role assignments in raw ldap format.
      * @throws org.apache.directory.api.ldap.model.exception.LdapException
      */
-    private void loadAddress(Address address, Entry entry) throws LdapException
+    private void loadAddress( Address address, Entry entry ) throws LdapException
     {
         if ( address != null )
         {
@@ -2170,7 +2252,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param address contains entity of type {@link Address} targeted for updating into ldap.
      * @param mods    contains ldap modification set contains attributes to be updated in ldap.
      */
-    private void loadAddress(Address address, List<Modification> mods)
+    private void loadAddress( Address address, List<Modification> mods )
     {
         if ( address != null )
         {
@@ -2240,7 +2322,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @throws org.apache.directory.api.ldap.model.exception.LdapInvalidAttributeValueException in the event of ldap
      * client error.
      */
-    private Address unloadAddress(Entry entry) throws LdapInvalidAttributeValueException
+    private Address unloadAddress( Entry entry ) throws LdapInvalidAttributeValueException
     {
         Address addr = new ObjectFactory().createAddress();
         List<String> pAddrs = getAttributes( entry, SchemaConstants.POSTAL_ADDRESS_AT );
@@ -2277,7 +2359,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param contextId
      * @return List of type {@link UserAdminRole} containing admin roles assigned to a particular user.
      */
-    private List<UserAdminRole> unloadUserAdminRoles(Entry entry, String userId, String contextId)
+    private List<UserAdminRole> unloadUserAdminRoles( Entry entry, String userId, String contextId )
     {
         List<UserAdminRole> uRoles = null;
         List<String> roles = getAttributes( entry, GlobalIds.USER_ADMINROLE_DATA );
@@ -2306,7 +2388,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param contextId
      * @return
      */
-    private String getDn(String userId, String contextId)
+    private String getDn( String userId, String contextId )
     {
         return SchemaConstants.UID_AT + "=" + userId + "," + getRootDn( contextId, GlobalIds.USER_ROOT );
     }
@@ -2322,7 +2404,7 @@ final class UserDAO extends ApacheDsDataProvider
      * @param contextId
      * @return List of type {@link UserRole} containing RBAC roles assigned to a particular user.
      */
-    private List<UserRole> unloadUserRoles(Entry entry, String userId, String contextId)
+    private List<UserRole> unloadUserRoles( Entry entry, String userId, String contextId )
     {
         List<UserRole> uRoles = null;
         List<String> roles = getAttributes( entry, GlobalIds.USER_ROLE_DATA );

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java b/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java
index 29646c3..cb7b4fa 100755
--- a/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java
+++ b/src/main/java/org/apache/directory/fortress/core/rbac/UserP.java
@@ -373,12 +373,7 @@ public final class UserP
         Session session;
         session = uDao.checkPassword( user );
 
-        if ( session == null )
-        { // This should not happen, ever:
-            String error = "UserP.authenticate failed - null session detected for userId [" + user.getUserId() + "]";
-            throw new SecurityException( GlobalErrIds.USER_SESS_CREATE_FAILED, error );
-        }
-        else if ( !session.isAuthenticated() )
+        if ( !session.isAuthenticated() )
         {
             String info = "UserP.authenticate failed  for userId [" + user.getUserId() + "] reason code ["
                 + session.getErrorId() + "] msg [" + session.getMsg() + "]";
@@ -630,6 +625,7 @@ public final class UserP
         return uDao.assign( uRole );
     }
 
+
     /**
      * This command deletes the assignment of the User from the Role entities. The command is
      * valid if and only if the user is a member of the USERS data set, the role is a member of
@@ -712,11 +708,11 @@ public final class UserP
      */
     private void validate( UserRole uRole ) throws ValidationException
     {
-        if(!VUtil.isNotNullOrEmpty( uRole.getUserId() ) )
+        if ( !VUtil.isNotNullOrEmpty( uRole.getUserId() ) )
         {
             throw new ValidationException( GlobalErrIds.USER_ID_NULL, CLS_NM + ".validate userId is NULL" );
         }
-        if(!VUtil.isNotNullOrEmpty( uRole.getName() ) )
+        if ( !VUtil.isNotNullOrEmpty( uRole.getName() ) )
         {
             throw new ValidationException( GlobalErrIds.ROLE_NM_NULL, CLS_NM + ".validate name is NULL" );
         }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/util/attr/VUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/attr/VUtil.java b/src/main/java/org/apache/directory/fortress/core/util/attr/VUtil.java
index b0accf8..db0268a 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/attr/VUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/attr/VUtil.java
@@ -51,7 +51,7 @@ public class VUtil
         {
             if ( lengthProp != null )
             {
-                Integer len = new Integer( lengthProp );
+                Integer len = Integer.valueOf( lengthProp );
                 maximumFieldLen = len;
             }
         }
@@ -97,7 +97,7 @@ public class VUtil
      */
     public static void orgUnit( String orgUnitId ) throws ValidationException
     {
-        if(!isNotNullOrEmpty( orgUnitId ))
+        if ( !isNotNullOrEmpty( orgUnitId ) )
         {
             String error = "orgUnit is null";
             throw new ValidationException( GlobalErrIds.ORG_NULL, error );

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/util/time/ClockTime.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/time/ClockTime.java b/src/main/java/org/apache/directory/fortress/core/util/time/ClockTime.java
index b95938b..95caf23 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/time/ClockTime.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/time/ClockTime.java
@@ -19,10 +19,12 @@
  */
 package org.apache.directory.fortress.core.util.time;
 
+
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.rbac.Session;
 
+
 /**
  * This class performs time validation for {@link Constraint}.  This validator will ensure the current time falls between {@link Constraint#getBeginTime()} and {@link Constraint#getEndTime()}
  * The format requires military time, i.e. 0800 for 8:00 am, 1700 for 5:00 pm.  The constant {@link org.apache.directory.fortress.core.GlobalIds#NONE} may be used to disable checks for a particular entity.
@@ -52,30 +54,34 @@ public class ClockTime
      * @return '0' if validation succeeds else {@link org.apache.directory.fortress.core.GlobalErrIds#ACTV_FAILED_TIME} if failed.
      */
     @Override
-    public int validate(Session session, Constraint constraint, Time time)
+    public int validate( Session session, Constraint constraint, Time time )
     {
         int rc = GlobalErrIds.ACTV_FAILED_TIME;
-        if (constraint.getBeginTime() == null || constraint.getBeginTime().compareToIgnoreCase(GlobalIds.NONE) == 0)
+
+        if ( ( constraint.getBeginTime() == null )
+            || ( constraint.getBeginTime().compareToIgnoreCase( GlobalIds.NONE ) == 0 ) )
         {
             rc = 0;
         }
         else
         {
-            Integer beginTime = new Integer(constraint.getBeginTime());
-            Integer endTime = new Integer(constraint.getEndTime());
-            if (beginTime == 0 && endTime == 0)
+            Integer beginTime = Integer.valueOf( constraint.getBeginTime() );
+            Integer endTime = Integer.valueOf( constraint.getEndTime() );
+
+            if ( ( beginTime == 0 ) && ( endTime == 0 ) )
             {
                 rc = 0;
             }
             else
             {
-                if (beginTime.compareTo(time.currentTime) <= 0
-                    && endTime.compareTo(time.currentTime) >= 0)
+                if ( beginTime.compareTo( time.currentTime ) <= 0
+                    && endTime.compareTo( time.currentTime ) >= 0 )
                 {
                     rc = 0;
                 }
             }
         }
+
         return rc;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/util/time/TUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/time/TUtil.java b/src/main/java/org/apache/directory/fortress/core/util/time/TUtil.java
index 8be2e35..3dd2bae 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/time/TUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/time/TUtil.java
@@ -19,8 +19,10 @@
  */
 package org.apache.directory.fortress.core.util.time;
 
+
 import java.util.GregorianCalendar;
 
+
 /**
  * Utility class to convert current time/date into internal format, {@link Time}, used for {@link Constraint} checks {@link CUtil#validateConstraints(org.apache.directory.fortress.core.rbac.Session, CUtil.ConstraintType, boolean)}.
  * This utility processes custom date formats and should not be used by external programs.
@@ -39,36 +41,39 @@ public class TUtil
     {
         Time time = new Time();
         GregorianCalendar gc = new GregorianCalendar();
-        String szMinute = "" + gc.get(GregorianCalendar.MINUTE);
-        String szHour = "" + gc.get(GregorianCalendar.HOUR_OF_DAY);
+        String szMinute = "" + gc.get( GregorianCalendar.MINUTE );
+        String szHour = "" + gc.get( GregorianCalendar.HOUR_OF_DAY );
 
-        time.day = "" + gc.get(GregorianCalendar.DAY_OF_WEEK);
-        String szDay = "" + gc.get(GregorianCalendar.DAY_OF_MONTH);
-        int month = gc.get(GregorianCalendar.MONTH);
-        String szMonth = "" + (month + 1);
-        String szYear = "" + gc.get(GregorianCalendar.YEAR);
+        time.day = "" + gc.get( GregorianCalendar.DAY_OF_WEEK );
+        String szDay = "" + gc.get( GregorianCalendar.DAY_OF_MONTH );
+        int month = gc.get( GregorianCalendar.MONTH );
+        String szMonth = "" + ( month + 1 );
+        String szYear = "" + gc.get( GregorianCalendar.YEAR );
 
-        if (szMinute.length() == 1)
+        if ( szMinute.length() == 1 )
         {
             szMinute = "0" + szMinute;
         }
-        if (szHour.length() == 1)
+
+        if ( szHour.length() == 1 )
         {
             szHour = "0" + szHour;
         }
-        if (szDay.length() == 1)
+
+        if ( szDay.length() == 1 )
         {
             szDay = "0" + szDay;
         }
-        if (szMonth.length() == 1)
+
+        if ( szMonth.length() == 1 )
         {
             szMonth = "0" + szMonth;
         }
+
         String szCurrentTime = szHour + szMinute;
 
-        time.currentTime = new Integer(szCurrentTime);
+        time.currentTime = Integer.valueOf( szCurrentTime );
         time.date = szYear + szMonth + szDay;
         return time;
     }
 }
-

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/77efdc6c/src/main/java/org/apache/directory/fortress/core/util/time/Timeout.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/time/Timeout.java b/src/main/java/org/apache/directory/fortress/core/util/time/Timeout.java
index a769b9b..e49a554 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/time/Timeout.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/time/Timeout.java
@@ -19,9 +19,11 @@
  */
 package org.apache.directory.fortress.core.util.time;
 
+
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.rbac.Session;
 
+
 /**
  * This class performs timeout validation for {@link Constraint}.  This validator will ensure the elapsed time an entity is active is less than {@link Constraint#getTimeout()} and {@link Constraint#getEndTime()}
  * The timeout is in minutes and is stored as integer value.  i.e. 30 for 30 minutes.  A value of '0' specifies no timeout for a particular entity.
@@ -37,8 +39,7 @@ import org.apache.directory.fortress.core.rbac.Session;
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class Timeout
-    implements Validator
+public class Timeout implements Validator
 {
     /**
      * This method is called during entity activation, {@link CUtil#validateConstraints} and ensures the elapsed time a particular entity has been activated does not exceed specified.
@@ -49,25 +50,27 @@ public class Timeout
      * @param time       contains the current timestamp.
      * @return '0' if validation succeeds else {@link org.apache.directory.fortress.core.GlobalErrIds#ACTV_FAILED_TIMEOUT} if failed.
      */
-    public int validate(Session session, Constraint constraint, Time time)
+    public int validate( Session session, Constraint constraint, Time time )
     {
         int rc = GlobalErrIds.ACTV_FAILED_TIMEOUT;
         long timeLimit;
         long lastTime = session.getLastAccess();
-        if (lastTime == 0)
+
+        if ( lastTime == 0 )
         {
             rc = 0;
         }
         else
         {
             long elapsedTime = System.currentTimeMillis() - lastTime;
-            timeLimit = constraint.getTimeout() * 60000;
-            if (elapsedTime < timeLimit || constraint.getTimeout() == 0)
+            timeLimit = constraint.getTimeout() * 60000L;
+
+            if ( ( elapsedTime < timeLimit ) || ( constraint.getTimeout() == 0 ) )
             {
                 rc = 0;
             }
         }
+
         return rc;
     }
 }
-


Mime
View raw message