directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject directory-fortress-core git commit: FC-109 - remove move redundant utils
Date Thu, 04 Jun 2015 16:52:25 GMT
Repository: directory-fortress-core
Updated Branches:
  refs/heads/1.0-RC41 ed93614fb -> 64b23a389


FC-109 - remove move redundant utils


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

Branch: refs/heads/1.0-RC41
Commit: 64b23a389943ca9bdc632deaba447c7fb98bafc4
Parents: ed93614
Author: Shawn McKinney <smckinney@apache.org>
Authored: Thu Jun 4 11:52:07 2015 -0500
Committer: Shawn McKinney <smckinney@apache.org>
Committed: Thu Jun 4 11:52:07 2015 -0500

----------------------------------------------------------------------
 .../fortress/core/ant/FortressAntTask.java      |  6 +-
 .../directory/fortress/core/ant/UserAnt.java    |  4 +-
 .../core/cli/CommandLineInterpreter.java        | 17 ++--
 .../directory/fortress/core/impl/ConfigDAO.java |  5 +-
 .../directory/fortress/core/impl/PermDAO.java   |  7 +-
 .../directory/fortress/core/impl/UserDAO.java   | 14 +--
 .../directory/fortress/core/impl/UserP.java     |  6 +-
 .../directory/fortress/core/model/PropUtil.java | 12 +++
 .../directory/fortress/core/util/ObjUtil.java   | 89 --------------------
 .../directory/fortress/core/util/VUtil.java     |  6 +-
 .../fortress/core/GroupMgrConsole.java          |  6 +-
 11 files changed, 48 insertions(+), 124 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java b/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
index 81a0d4e..706d107 100755
--- a/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
+++ b/src/main/java/org/apache/directory/fortress/core/ant/FortressAntTask.java
@@ -28,7 +28,7 @@ import java.util.StringTokenizer;
 
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.directory.fortress.core.util.ObjUtil;
+import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 import org.apache.tools.ant.input.InputHandler;
@@ -1148,7 +1148,7 @@ public class FortressAntTask extends Task implements InputHandler
             List<Group> groups = addgroupproperty.getGroups();
             for ( Group group : groups )
             {
-                if ( ObjUtil.isNotNullOrEmpty( group.getProperties() ) )
+                if ( PropUtil.isNotEmpty( group.getProperties() ) )
                 {
                     for ( Enumeration<?> e = group.getProperties().propertyNames();
e.hasMoreElements(); )
                     {
@@ -1191,7 +1191,7 @@ public class FortressAntTask extends Task implements InputHandler
             List<Group> groups = delgroupproperty.getGroups();
             for ( Group group : groups )
             {
-                if ( ObjUtil.isNotNullOrEmpty( group.getProperties() ) )
+                if ( PropUtil.isNotEmpty( group.getProperties() ) )
                 {
                     for ( Enumeration<?> e = group.getProperties().propertyNames();
e.hasMoreElements(); )
                     {

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java b/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
index d062e32..a484a11 100755
--- a/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
+++ b/src/main/java/org/apache/directory/fortress/core/ant/UserAnt.java
@@ -21,8 +21,8 @@ package org.apache.directory.fortress.core.ant;
 
 
 import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.directory.fortress.core.util.ObjUtil;
 import org.apache.directory.fortress.core.model.PropUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -425,7 +425,7 @@ public class UserAnt extends User
         if ( StringUtils.isNotEmpty( photo ) )
         {
             byte[] jpeg = getJpegPhoto( photo );
-            if ( ObjUtil.isNotNullOrEmpty( jpeg ) )
+            if ( ArrayUtils.isNotEmpty( jpeg ) )
             {
                 setJpegPhoto( jpeg );
             }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/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 39cb196..5a547bc 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
@@ -32,6 +32,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.fortress.core.*;
 import org.apache.directory.fortress.core.SecurityException;
@@ -41,12 +42,12 @@ import org.apache.directory.fortress.core.GroupMgrFactory;
 import org.apache.directory.fortress.core.model.Address;
 import org.apache.directory.fortress.core.model.PermObj;
 import org.apache.directory.fortress.core.model.Permission;
+import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.SDSet;
 import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.model.User;
 import org.apache.directory.fortress.core.model.UserRole;
-import org.apache.directory.fortress.core.util.ObjUtil;
 import org.slf4j.LoggerFactory;
 import org.apache.directory.fortress.core.model.AdminRole;
 import org.apache.directory.fortress.core.model.OrgUnit;
@@ -990,7 +991,7 @@ public class CommandLineInterpreter
                 command = ADD_GROUP_PROP;
                 LOG.info( command );
                 Group group = options.getGroup();
-                if ( ObjUtil.isNotNullOrEmpty( group.getProperties() ) )
+                if ( PropUtil.isNotEmpty( group.getProperties() ) )
                 {
                     for ( Enumeration<?> e = group.getProperties().propertyNames();
e.hasMoreElements(); )
                     {
@@ -1005,7 +1006,7 @@ public class CommandLineInterpreter
                 command = DELETE_GROUP_PROP;
                 LOG.info( command );
                 Group group = options.getGroup();
-                if ( ObjUtil.isNotNullOrEmpty( group.getProperties() ) )
+                if ( PropUtil.isNotEmpty( group.getProperties() ) )
                 {
                     for ( Enumeration<?> e = group.getProperties().propertyNames();
e.hasMoreElements(); )
                     {
@@ -1122,7 +1123,7 @@ public class CommandLineInterpreter
     private Set<String> loadCommandSet( String[] otherArgs )
     {
         Set<String> commands = null;
-        if ( ObjUtil.isNotNullOrEmpty( otherArgs ) )
+        if ( ArrayUtils.isNotEmpty( otherArgs ) )
         {
             commands = new HashSet<>();
             Collections.addAll( commands, otherArgs );
@@ -1190,7 +1191,7 @@ public class CommandLineInterpreter
                 }
             }
 
-            if ( ObjUtil.isNotNullOrEmpty( perm.getProperties() ) )
+            if ( PropUtil.isNotEmpty( perm.getProperties() ) )
             {
                 printSeparator();
                 int ctr = 0;
@@ -1218,7 +1219,7 @@ public class CommandLineInterpreter
             printRow( type, "TYPE", permObj.getType() );
             printRow( type, "OU  ", permObj.getOu() );
         }
-        if ( ObjUtil.isNotNullOrEmpty( permObj != null ? permObj.getProperties() : null )
)
+        if ( PropUtil.isNotEmpty( permObj != null ? permObj.getProperties() : null ) )
         {
             printSeparator();
             int ctr = 0;
@@ -1306,7 +1307,7 @@ public class CommandLineInterpreter
                     printAdminRole( "A", ur );
                 }
             }
-            if ( ObjUtil.isNotNullOrEmpty( user.getProperties() ) )
+            if ( PropUtil.isNotEmpty( user.getProperties() ) )
             {
                 printSeparator();
                 int ctr = 0;
@@ -1341,7 +1342,7 @@ public class CommandLineInterpreter
                     printRow( type, "MEMBER[" + ++memctr + "]", member );
                 }
             }
-            if ( ObjUtil.isNotNullOrEmpty( group.getProperties() ) )
+            if ( PropUtil.isNotEmpty( group.getProperties() ) )
             {
                 int propctr = 0;
                 for ( Enumeration<?> e = group.getProperties().propertyNames(); e.hasMoreElements();
)

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
index b25ccda..6e036bd 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/ConfigDAO.java
@@ -33,7 +33,6 @@ import org.apache.directory.api.ldap.model.exception.LdapException;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.fortress.core.CreateException;
 import org.apache.directory.fortress.core.util.Config;
-import org.apache.directory.fortress.core.util.ObjUtil;
 import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.fortress.core.ldap.ApacheDsDataProvider;
@@ -165,7 +164,7 @@ final class ConfigDAO extends ApacheDsDataProvider
         try
         {
             List<Modification> mods = new ArrayList<Modification>();
-            if ( ObjUtil.isNotNullOrEmpty( props ) )
+            if ( PropUtil.isNotEmpty( props ) )
             {
                 loadProperties( props, mods, GlobalIds.PROPS, true );
             }
@@ -231,7 +230,7 @@ final class ConfigDAO extends ApacheDsDataProvider
         try
         {
             List<Modification> mods = new ArrayList<Modification>();
-            if ( ObjUtil.isNotNullOrEmpty( props ) )
+            if ( PropUtil.isNotEmpty( props ) )
             {
                 removeProperties( props, mods, GlobalIds.PROPS );
             }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
index b16fe73..2d20f3f 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/PermDAO.java
@@ -49,7 +49,6 @@ import org.apache.directory.fortress.core.model.Permission;
 import org.apache.directory.fortress.core.model.Role;
 import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.model.User;
-import org.apache.directory.fortress.core.util.ObjUtil;
 import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.apache.directory.fortress.core.CreateException;
@@ -246,7 +245,7 @@ final class PermDAO extends ApacheDsDataProvider
 
             // props are optional as well:
             //if the props is null don't try to load these attributes
-            if ( ObjUtil.isNotNullOrEmpty( entity.getProperties() ) )
+            if ( PropUtil.isNotEmpty( entity.getProperties() ) )
             {
                 loadProperties( entity.getProperties(), entry, GlobalIds.PROPS );
             }
@@ -305,7 +304,7 @@ final class PermDAO extends ApacheDsDataProvider
                     ModificationOperation.REPLACE_ATTRIBUTE, TYPE, entity.getType() ) );
             }
 
-            if ( ObjUtil.isNotNullOrEmpty( entity.getProperties() ) )
+            if ( PropUtil.isNotEmpty( entity.getProperties() ) )
             {
                 loadProperties( entity.getProperties(), mods, GlobalIds.PROPS, true );
             }
@@ -423,7 +422,7 @@ final class PermDAO extends ApacheDsDataProvider
 
             // props are optional as well:
             //if the props is null don't try to load these attributes
-            if ( ObjUtil.isNotNullOrEmpty( entity.getProperties() ) )
+            if ( PropUtil.isNotEmpty( entity.getProperties() ) )
             {
                 loadProperties( entity.getProperties(), entry, GlobalIds.PROPS );
             }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
index 302b7f0..2b05fbb 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
@@ -59,7 +60,6 @@ import org.apache.directory.fortress.core.model.User;
 import org.apache.directory.fortress.core.model.UserAdminRole;
 import org.apache.directory.fortress.core.model.UserRole;
 import org.apache.directory.fortress.core.model.Warning;
-import org.apache.directory.fortress.core.util.ObjUtil;
 import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.ldap.client.api.LdapConnection;
 import org.slf4j.Logger;
@@ -433,7 +433,7 @@ final class UserDAO extends ApacheDsDataProvider
             myEntry.add( SchemaConstants.SN_AT, entity.getSn() );
 
             // guard against npe
-            myEntry.add( SchemaConstants.USER_PASSWORD_AT, ObjUtil.isNotNullOrEmpty( entity.getPassword()
) ? new
+            myEntry.add( SchemaConstants.USER_PASSWORD_AT, ArrayUtils.isNotEmpty( entity.getPassword()
) ? new
                 String( entity.getPassword() ) : new String( new char[]
                     {} ) );
             myEntry.add( SchemaConstants.DISPLAY_NAME_AT, entity.getCn() );
@@ -514,7 +514,7 @@ final class UserDAO extends ApacheDsDataProvider
             myEntry.add( GlobalIds.CONSTRAINT, ConstraintUtil.setConstraint( entity ) );
             loadAddress( entity.getAddress(), myEntry );
 
-            if ( ObjUtil.isNotNullOrEmpty( entity.getJpegPhoto() ) )
+            if ( ArrayUtils.isNotEmpty( entity.getJpegPhoto() ) )
             {
                 myEntry.add( JPEGPHOTO, entity.getJpegPhoto() );
             }
@@ -569,7 +569,7 @@ final class UserDAO extends ApacheDsDataProvider
                     entity.getOu() ) );
             }
 
-            if ( ObjUtil.isNotNullOrEmpty( entity.getPassword() ) )
+            if ( ArrayUtils.isNotEmpty( entity.getPassword() ) )
             {
                 mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
SchemaConstants
                     .USER_PASSWORD_AT, new String( entity.getPassword() ) ) );
@@ -620,7 +620,7 @@ final class UserDAO extends ApacheDsDataProvider
                 }
             }
 
-            if ( ObjUtil.isNotNullOrEmpty( entity.getProperties() ) )
+            if ( PropUtil.isNotEmpty( entity.getProperties() ) )
             {
                 loadProperties( entity.getProperties(), mods, GlobalIds.PROPS, true );
             }
@@ -632,7 +632,7 @@ final class UserDAO extends ApacheDsDataProvider
             loadAttrs( entity.getMobiles(), mods, MOBILE );
             loadAttrs( entity.getEmails(), mods, SchemaConstants.MAIL_AT );
 
-            if ( ObjUtil.isNotNullOrEmpty( entity.getJpegPhoto() ) )
+            if ( ArrayUtils.isNotEmpty( entity.getJpegPhoto() ) )
             {
                 mods.add( new DefaultModification( ModificationOperation.REPLACE_ATTRIBUTE,
JPEGPHOTO, entity
                     .getJpegPhoto() ) );
@@ -676,7 +676,7 @@ final class UserDAO extends ApacheDsDataProvider
         {
             List<Modification> mods = new ArrayList<Modification>();
 
-            if ( ObjUtil.isNotNullOrEmpty( entity.getProperties() ) )
+            if ( PropUtil.isNotEmpty( entity.getProperties() ) )
             {
                 loadProperties( entity.getProperties(), mods, GlobalIds.PROPS, replace );
             }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserP.java b/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
index 0786de9..929c68c 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserP.java
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.fortress.core.model.AdminRole;
 import org.apache.directory.fortress.core.model.Administrator;
@@ -36,7 +37,6 @@ import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.model.User;
 import org.apache.directory.fortress.core.model.UserAdminRole;
 import org.apache.directory.fortress.core.model.UserRole;
-import org.apache.directory.fortress.core.util.ObjUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -760,7 +760,7 @@ final class UserP
                 VUtil.safeText( entity.getSn(), GlobalIds.SN_LEN );
             }
             // password is not required on user object but user cannot execute AccessMgr
or DelAccessMgr methods w/out pw.
-            if ( ObjUtil.isNotNullOrEmpty( entity.getPassword() ) )
+            if ( ArrayUtils.isNotEmpty( entity.getPassword() ) )
             {
                 VUtil.password( entity.getPassword() );
             }
@@ -797,7 +797,7 @@ final class UserP
             {
                 VUtil.safeText( entity.getSn(), GlobalIds.SN_LEN );
             }
-            if ( ObjUtil.isNotNullOrEmpty( entity.getPassword() ) )
+            if ( ArrayUtils.isNotEmpty( entity.getPassword() ) )
             {
                 VUtil.password( entity.getPassword() );
             }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/main/java/org/apache/directory/fortress/core/model/PropUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/model/PropUtil.java b/src/main/java/org/apache/directory/fortress/core/model/PropUtil.java
index 899c6ab..8764db6 100644
--- a/src/main/java/org/apache/directory/fortress/core/model/PropUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/model/PropUtil.java
@@ -125,4 +125,16 @@ public final class PropUtil
         }
         return props;
     }
+
+
+    /**
+     * Method will return true if props is not null or empty.
+     *
+     * @param props contains the reference to props.
+     * @return boolean if validation succeeds.
+     */
+    public static boolean isNotEmpty( Properties props )
+    {
+        return ( props != null ) && ( props.size() > 0 );
+    }
 }

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/main/java/org/apache/directory/fortress/core/util/ObjUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/ObjUtil.java b/src/main/java/org/apache/directory/fortress/core/util/ObjUtil.java
deleted file mode 100644
index cec1cf6..0000000
--- a/src/main/java/org/apache/directory/fortress/core/util/ObjUtil.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *   Licensed to the Apache Software Foundation (ASF) under one
- *   or more contributor license agreements.  See the NOTICE file
- *   distributed with this work for additional information
- *   regarding copyright ownership.  The ASF licenses this file
- *   to you under the Apache License, Version 2.0 (the
- *   "License"); you may not use this file except in compliance
- *   with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing,
- *   software distributed under the License is distributed on an
- *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *   KIND, either express or implied.  See the License for the
- *   specific language governing permissions and limitations
- *   under the License.
- *
- */
-
-package org.apache.directory.fortress.core.util;
-
-import java.util.Properties;
-
-/**
- * Contains utilities for null checks of various objects.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public final class ObjUtil
-{
-    // cannot construct
-    private ObjUtil()
-    {
-
-    }
-
-    /**
-     * Method will return true if string array reference is not null or empty.
-     *
-     * @param value contains the reference to string array.
-     * @return boolean if validation succeeds.
-     */
-    public static boolean isNotNullOrEmpty( String[] value )
-    {
-        return ( value != null ) && ( value.length > 0 );
-    }
-
-
-    /**
-     * Method will return true if string reference is not null or empty.
-     *
-     * @param value contains the reference to string.
-     * @return boolean if validation succeeds.
-     */
-    public static boolean isNotNullOrEmpty( char[] value )
-    {
-        return ( value != null ) && ( value.length > 0 );
-    }
-
-
-    /**
-     * Method will return true if props is not null or empty.
-     *
-     * @param props contains the reference to props.
-     * @return boolean if validation succeeds.
-     */
-    public static boolean isNotNullOrEmpty( Properties props )
-    {
-        return ( props != null ) && ( props.size() > 0 );
-    }
-
-
-    /**
-     * Method will return true if byte array reference is not null or empty.
-     *
-     * @param value contains the reference to byte array.
-     * @return boolean if validation succeeds.
-     */
-    public static boolean isNotNullOrEmpty( byte[] value )
-    {
-        boolean result = false;
-        if ( value != null && value.length > 0 )
-        {
-            result = true;
-        }
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/directory/fortress/core/util/VUtil.java b/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
index 069d7c4..1795441 100755
--- a/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
+++ b/src/main/java/org/apache/directory/fortress/core/util/VUtil.java
@@ -29,12 +29,14 @@ import java.util.ListIterator;
 import java.util.Properties;
 
 import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.directory.fortress.core.*;
 import org.apache.directory.fortress.core.SecurityException;
 import org.apache.directory.fortress.core.model.Constraint;
 import org.apache.directory.fortress.core.model.ConstraintValidator;
 import org.apache.directory.fortress.core.model.ObjectFactory;
+import org.apache.directory.fortress.core.model.PropUtil;
 import org.apache.directory.fortress.core.model.Session;
 import org.apache.directory.fortress.core.model.UserRole;
 import org.apache.directory.fortress.core.model.Warning;
@@ -245,7 +247,7 @@ public final class VUtil implements ConstraintValidator
      */
     public static void properties( Properties props ) throws ValidationException
     {
-        if ( ObjUtil.isNotNullOrEmpty( props ) )
+        if ( PropUtil.isNotEmpty( props ) )
         {
             for ( Enumeration<?> e = props.propertyNames(); e.hasMoreElements(); )
             {
@@ -519,7 +521,7 @@ public final class VUtil implements ConstraintValidator
     public static void assertNotNullOrEmpty( char[] value, int errorCode, String method )
         throws ValidationException
     {
-        if ( !ObjUtil.isNotNullOrEmpty( value ) )
+        if ( !ArrayUtils.isNotEmpty( value ) )
         {
             String error = "assertContext detected null entity for method [" + method + "],
error code ["
                 + errorCode + "]";

http://git-wip-us.apache.org/repos/asf/directory-fortress-core/blob/64b23a38/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java b/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java
index 9d6cf30..13f7d2e 100755
--- a/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java
+++ b/src/test/java/org/apache/directory/fortress/core/GroupMgrConsole.java
@@ -26,7 +26,7 @@ import org.apache.directory.fortress.core.model.Group;
 import java.util.Enumeration;
 import java.util.List;
 
-import org.apache.directory.fortress.core.util.ObjUtil;
+import org.apache.directory.fortress.core.model.PropUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -259,7 +259,7 @@ class GroupMgrConsole
                     System.out.println("    member[" + ctr++ + "]=" + member);
                 }
             }
-            if ( ObjUtil.isNotNullOrEmpty( outGroup.getProperties() ) )
+            if ( PropUtil.isNotEmpty( outGroup.getProperties() ) )
             {
                 int ctr = 0;
                 for (Enumeration e = outGroup.getProperties().propertyNames(); e.hasMoreElements();)
@@ -306,7 +306,7 @@ class GroupMgrConsole
                             System.out.println("    member[" + memberctr++ + "]=" + member);
                         }
                     }
-                    if ( ObjUtil.isNotNullOrEmpty( outGroup.getProperties() ) )
+                    if ( PropUtil.isNotEmpty( outGroup.getProperties() ) )
                     {
                         int propctr = 0;
                         for (Enumeration e = outGroup.getProperties().propertyNames(); e.hasMoreElements();)


Mime
View raw message