directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject [11/20] git commit: o Used Strings.isEmpty
Date Wed, 05 Nov 2014 17:33:18 GMT
o Used Strings.isEmpty

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/800ffdec
Tree: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/tree/800ffdec
Diff: http://git-wip-us.apache.org/repos/asf/directory-fortress-core/diff/800ffdec

Branch: refs/heads/master
Commit: 800ffdec86866cfbd92cfa244a56d9ede15d0dc5
Parents: 056ce2b
Author: Emmanuel L├ęcharny <elecharny@symas.com>
Authored: Sun Nov 2 17:05:55 2014 +0100
Committer: Emmanuel L├ęcharny <elecharny@symas.com>
Committed: Sun Nov 2 17:06:25 2014 +0100

----------------------------------------------------------------------
 .../fortress/core/ldap/group/GroupMgrFactory.java        |  9 +++++++--
 .../directory/fortress/core/ldap/group/GroupP.java       | 11 ++++++++---
 2 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/800ffdec/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java
b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java
index 102587c..4a3bfd3 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupMgrFactory.java
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.fortress.core.ldap.group;
 
+import org.apache.directory.api.util.Strings;
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.cfg.Config;
@@ -41,6 +42,7 @@ public class GroupMgrFactory
 {
     private static String groupClassName = Config.getProperty( GlobalIds.GROUP_IMPLEMENTATION
);
     private static final String CLS_NM = GroupMgrFactory.class.getName();
+    private static final String CREATE_INSTANCE_METHOD = CLS_NM + ".createInstance";
 
     /**
      * Create and return a reference to {@link GroupMgr} object using HOME context.
@@ -64,14 +66,16 @@ public class GroupMgrFactory
     public static GroupMgr createInstance(String contextId)
         throws SecurityException
     {
-        VUtil.assertNotNull( contextId, GlobalErrIds.CONTEXT_NULL, CLS_NM + ".createInstance"
);
-        if (!VUtil.isNotNullOrEmpty(groupClassName))
+        VUtil.assertNotNull( contextId, GlobalErrIds.CONTEXT_NULL, CREATE_INSTANCE_METHOD
);
+        
+        if ( Strings.isEmpty( groupClassName ) )
         {
             groupClassName = GroupMgrImpl.class.getName();
         }
 
         GroupMgr groupMgr = (GroupMgr) ClassUtil.createInstance(groupClassName);
         groupMgr.setContextId(contextId);
+        
         return groupMgr;
     }
 
@@ -102,6 +106,7 @@ public class GroupMgrFactory
     {
         GroupMgr groupMgr = createInstance(contextId);
         groupMgr.setAdmin(adminSess);
+        
         return groupMgr;
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/800ffdec/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java
index c311443..5588d20 100755
--- a/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/group/GroupP.java
@@ -20,11 +20,11 @@
 package org.apache.directory.fortress.core.ldap.group;
 
 
+import org.apache.directory.api.util.Strings;
 import org.apache.directory.fortress.core.ValidationException;
 import org.apache.directory.fortress.core.rbac.User;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import org.apache.directory.fortress.core.GlobalErrIds;
 import org.apache.directory.fortress.core.GlobalIds;
 import org.apache.directory.fortress.core.SecurityException;
@@ -55,6 +55,7 @@ final class GroupP
     final Group add( Group group ) throws SecurityException
     {
         validate( group );
+        
         return gDao.create( group );
     }
 
@@ -68,6 +69,7 @@ final class GroupP
     final Group update( Group group ) throws SecurityException
     {
         validate( group );
+        
         return gDao.update( group );
     }
 
@@ -185,12 +187,13 @@ final class GroupP
      */
     private void validate( Group entity ) throws SecurityException
     {
-        if ( !VUtil.isNotNullOrEmpty( entity.getName() ) )
+        if ( Strings.isEmpty( entity.getName() ) )
         {
             String error = "validate name validation failed, null or empty value";
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.GROUP_NAME_NULL, error );
         }
+        
         if ( entity.getName().length() > GlobalIds.OU_LEN )
         {
             String name = entity.getName();
@@ -198,6 +201,7 @@ final class GroupP
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.GROUP_NAME_INVLD, error );
         }
+        
         if ( entity.getProtocol().length() > GlobalIds.OU_LEN )
         {
             String error = "validate protocol [" + entity.getProtocol() + "] invalid length
[" + entity.getProtocol()
@@ -205,7 +209,8 @@ final class GroupP
             LOG.warn( error );
             throw new ValidationException( GlobalErrIds.GROUP_PROTOCOL_INVLD, error );
         }
-        if ( VUtil.isNotNullOrEmpty( entity.getDescription() ) )
+        
+        if ( !Strings.isEmpty( entity.getDescription() ) )
         {
             VUtil.description( entity.getDescription() );
         }


Mime
View raw message