directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r359114 [1/2] - in /directory/shared/ldap/branches/DN-refactoring/common/src: main/java/org/apache/ldap/common/filter/ main/java/org/apache/ldap/common/message/ main/java/org/apache/ldap/common/name/ main/java/org/apache/ldap/common/schema/...
Date Mon, 26 Dec 2005 22:40:38 GMT
Author: elecharny
Date: Mon Dec 26 14:40:09 2005
New Revision: 359114

URL: http://svn.apache.org/viewcvs?rev=359114&view=rev
Log:
- Use StringTools instead of StringUtils
- Added some tests in StringToolsTest

Modified:
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/MessageDecoder.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/AttributeTypeAndValue.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/DnParser.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/LdapDN.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/Rdn.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/RdnParser.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DnNormalizer.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/url/LdapURL.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/DNUtils.java
    directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/StringTools.java
    directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
    directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/name/DnParserTest.java
    directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/name/RdnTest.java
    directory/shared/ldap/branches/DN-refactoring/common/src/test/org/apache/ldap/common/util/StringToolsTest.java

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java Mon Dec 26 14:40:09 2005
@@ -25,7 +25,7 @@
  */
 package org.apache.ldap.common.filter;
 
-import org.apache.asn1.codec.util.StringUtils;
+import org.apache.ldap.common.util.StringTools;
 
 
 /**
@@ -57,7 +57,7 @@
     public ExtensibleNode( String attribute, String value,
         String matchingRuleId, boolean dnAttributes )
     {
-        this( attribute, StringUtils.getBytesUtf8( value ), matchingRuleId, dnAttributes );
+        this( attribute, StringTools.getBytesUtf8( value ), matchingRuleId, dnAttributes );
     }
     
     /**
@@ -123,9 +123,9 @@
         buf.append( "-EXTENSIBLE-" );
         buf.append( this.matchingRuleId );
         buf.append( "-" );
-        buf.append( StringUtils.utf8ToString( this.value ) );
+        buf.append( StringTools.utf8ToString( this.value ) );
         buf.append( "/" );
-        buf.append( StringUtils.dumpBytes( this.value ) );
+        buf.append( StringTools.dumpBytes( this.value ) );
         buf.append( ')' );
 
         if ( ( null != getAnnotations() )

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java Mon Dec 26 14:40:09 2005
@@ -16,7 +16,7 @@
  */
 package org.apache.ldap.common.filter ;
 
-import org.apache.asn1.codec.util.StringUtils;
+import org.apache.ldap.common.util.StringTools;
 
 
 /**
@@ -39,7 +39,7 @@
      */
     public SimpleNode( String attribute, byte[] value, int type )
     {
-        this( attribute, StringUtils.utf8ToString( value ), type );
+        this( attribute, StringTools.utf8ToString( value ), type );
     }
 
     /**

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java Mon Dec 26 14:40:09 2005
@@ -17,8 +17,8 @@
 package org.apache.ldap.common.message;
 
 
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.util.ArrayUtils;
+import org.apache.ldap.common.util.StringTools;
 
 
 /**
@@ -305,7 +305,7 @@
         sb.append( "    BindRequest\n" );
         sb.append( "        Version : '" ).append( isVersion3 ? "3" : "2" ).append( "'\n" );
 
-        if ( StringUtils.isEmpty( name.toString() ) )
+        if ( StringTools.isEmpty( name.toString() ) )
         {
             sb.append( "        Name : anonymous\n" );
         }
@@ -316,9 +316,9 @@
             if ( isSimple )
             {
                 sb.append( "        Simple authentication : '" )
-                  .append( StringUtils.utf8ToString( credentials) )
+                  .append( StringTools.utf8ToString( credentials) )
                   .append('/')
-                  .append( StringUtils.dumpBytes( credentials ) )
+                  .append( StringTools.dumpBytes( credentials ) )
                   .append( "'\n" );
             }
             else
@@ -329,9 +329,9 @@
                 .append( "'\n" );
                 
                 sb.append( "            Credentials : '" )
-                .append( StringUtils.utf8ToString( credentials) )
+                .append( StringTools.utf8ToString( credentials) )
                 .append('/')
-                .append( StringUtils.dumpBytes( credentials ) )
+                .append( StringTools.dumpBytes( credentials ) )
                 .append( "'\n" );
             }
         }

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java Mon Dec 26 14:40:09 2005
@@ -18,7 +18,7 @@
 
 import java.util.Arrays;
 
-import org.apache.asn1.codec.util.StringUtils;
+import org.apache.ldap.common.util.StringTools;
 
 
 /**
@@ -107,7 +107,7 @@
         super.lockCheck(
             "Attempt to alter attribute value of locked CompareRequest" );
 
-        this.attrVal = StringUtils.getBytesUtf8( attrVal );
+        this.attrVal = StringTools.getBytesUtf8( attrVal );
     }
 
     /**
@@ -254,9 +254,9 @@
         sb.append( "        Attribute description : '" ).append( attrId ).append(
             "'\n" );
         sb.append( "        Attribute value : '" ).
-        	append( StringUtils.utf8ToString( attrVal ) ).
+        	append( StringTools.utf8ToString( attrVal ) ).
         	append( '/' ).
-        	append( StringUtils.dumpBytes( attrVal ) ).
+        	append( StringTools.dumpBytes( attrVal ) ).
             append( "'\n" );
 
         return sb.toString();

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java Mon Dec 26 14:40:09 2005
@@ -17,8 +17,8 @@
 package org.apache.ldap.common.message;
 
 
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.util.ArrayUtils;
+import org.apache.ldap.common.util.StringTools;
 
 
 /**
@@ -199,9 +199,9 @@
         if ( oid != null )
         {
             sb.append( "        Request value : '" ).
-            	append( StringUtils.utf8ToString( payload ) ).
+            	append( StringTools.utf8ToString( payload ) ).
             	append( '/' ).
-            	append( StringUtils.dumpBytes( payload ) ).
+            	append( StringTools.dumpBytes( payload ) ).
             	append( "'\n" );
         }
 

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/MessageDecoder.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/MessageDecoder.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/MessageDecoder.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/MessageDecoder.java Mon Dec 26 14:40:09 2005
@@ -18,14 +18,18 @@
 
 
 import java.io.InputStream;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
 
 import org.apache.ldap.common.message.spi.Provider;
 import org.apache.ldap.common.message.spi.TransformerSpi;
 import org.apache.ldap.common.message.spi.ProviderDecoder;
+import org.apache.ldap.common.util.StringTools;
 
 import org.apache.asn1.codec.DecoderException;
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.asn1.codec.stateful.DecoderMonitor;
 import org.apache.asn1.codec.stateful.DecoderCallback;
 import org.apache.asn1.codec.stateful.StatefulDecoder;
@@ -100,13 +104,13 @@
                 String binaryIds = ( String ) val;
                 binaries = new HashSet();
 
-                if ( ! StringUtils.isEmpty( binaryIds ) )
+                if ( ! StringTools.isEmpty( binaryIds ) )
                 {
                     String[] binaryArray = binaryIds.split( " " );
 
                     for ( int i = 0; i < binaryArray.length; i++ )
                     {
-                        binaries.add( StringUtils.lowerCase( StringUtils.trim( binaryArray[i] ) ) );
+                        binaries.add( StringTools.lowerCase( StringTools.trim( binaryArray[i] ) ) );
                     }
                 }
             } // if already parsed and set as a collection use it

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java Mon Dec 26 14:40:09 2005
@@ -30,7 +30,7 @@
 import javax.naming.directory.DirContext;
 import javax.naming.directory.ModificationItem ;
 
-import org.apache.asn1.codec.util.StringUtils;
+import org.apache.ldap.common.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -270,7 +270,7 @@
 	        	{
                     if (value instanceof byte[] )
                     {
-                        String sValue = StringUtils.utf8ToString( (byte[])value );
+                        String sValue = StringTools.utf8ToString( (byte[])value );
                         
                         if ( attrHash0.contains( sValue ) == false )
                         {
@@ -359,8 +359,8 @@
 
                         if ( attributeValue instanceof byte[] )
                         {
-                        	sb.append( StringUtils.utf8ToString( (byte[])attributeValue ) ).
-                    			append( '/' ).append( StringUtils.dumpBytes( (byte[])attributeValue ) );
+                        	sb.append( StringTools.utf8ToString( (byte[])attributeValue ) ).
+                    			append( '/' ).append( StringTools.dumpBytes( (byte[])attributeValue ) );
                         }
                         else if ( attributeValue instanceof String )
                         {
@@ -368,7 +368,7 @@
                         }
                         else
                         {
-                        	sb.append( StringUtils.dumpBytes( StringUtils.getBytesUtf8( attributeValue.toString() ) ) );
+                        	sb.append( StringTools.dumpBytes( StringTools.getBytesUtf8( attributeValue.toString() ) ) );
                         }
                         
                         sb.append( "' \n" );

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/AttributeTypeAndValue.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/AttributeTypeAndValue.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/AttributeTypeAndValue.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/AttributeTypeAndValue.java Mon Dec 26 14:40:09 2005
@@ -18,7 +18,7 @@
 
 import javax.naming.InvalidNameException;
 
-import org.apache.asn1.codec.util.StringUtils;
+import org.apache.ldap.common.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -71,14 +71,14 @@
      */ 
     public AttributeTypeAndValue( String type, String value ) throws InvalidNameException
     {
-    	if ( StringUtils.isEmpty( type ) || StringUtils.isEmpty( type.trim() ) )
+    	if ( StringTools.isEmpty( type ) || StringTools.isEmpty( type.trim() ) )
     	{
     		log.error( "The type cannot be empty or null" );
     		throw new InvalidNameException( "Null or empty type is not allowed" );
     	}
     	
         this.type = type;
-        this.value = StringUtils.isEmpty( value ) ? "" : value;
+        this.value = StringTools.isEmpty( value ) ? "" : value;
     }
     
     /**
@@ -98,7 +98,7 @@
      */
     public void setType( String type ) throws InvalidNameException
     {
-        if ( StringUtils.isEmpty( type ) )
+        if ( StringTools.isEmpty( type ) )
         {
             throw new InvalidNameException( "The AttributeTypeAndValue type cannot be null : " );
         }
@@ -113,9 +113,9 @@
      */
     public void setTypeNormalized( String type ) throws InvalidNameException
     {
-        this.type = StringUtils.lowerCase( StringUtils.trim( type ) );
+        this.type = StringTools.lowerCase( StringTools.trim( type ) );
 
-        if ( StringUtils.isEmpty( this.type ) )
+        if ( StringTools.isEmpty( this.type ) )
         {
             throw new InvalidNameException( "The AttributeTypeAndValue type cannot be null : " );
         }
@@ -138,7 +138,7 @@
      */
     public void setValue( String value )
     {
-        this.value = StringUtils.isEmpty( value ) ? "" : value;
+        this.value = StringTools.isEmpty( value ) ? "" : value;
     }
 
     /**
@@ -148,9 +148,9 @@
      */
     public void setValueNormalized( String value )
     {
-    	String newValue = StringUtils.trim( value );
+    	String newValue = StringTools.trim( value );
 
-        if ( StringUtils.isEmpty( newValue ) )
+        if ( StringTools.isEmpty( newValue ) )
         {
             this.value = "";
         }
@@ -251,17 +251,17 @@
      */
     private int compareType( String val1, String val2 )
     {
-        if ( StringUtils.isEmpty( val1 ) )
+        if ( StringTools.isEmpty( val1 ) )
         {
-            return StringUtils.isEmpty( val2 ) ? 0 : -1;
+            return StringTools.isEmpty( val2 ) ? 0 : -1;
         }
-        else if ( StringUtils.isEmpty( val2 ) )
+        else if ( StringTools.isEmpty( val2 ) )
         {
             return 1;
         }
         else
         {
-            return ( StringUtils.trim( val1 ) ).compareToIgnoreCase( StringUtils.trim( val2 ) );
+            return ( StringTools.trim( val1 ) ).compareToIgnoreCase( StringTools.trim( val2 ) );
         }
     }
 
@@ -273,11 +273,11 @@
      */
     private int compareValue( String val1, String val2, boolean sensitivity )
     {
-        if ( StringUtils.isEmpty( val1 ) )
+        if ( StringTools.isEmpty( val1 ) )
         {
-            return StringUtils.isEmpty( val2 ) ? 0 : -1;
+            return StringTools.isEmpty( val2 ) ? 0 : -1;
         }
-        else if ( StringUtils.isEmpty( val2 ) )
+        else if ( StringTools.isEmpty( val2 ) )
         {
             return 1;
         }
@@ -287,11 +287,11 @@
         	
         	if ( sensitivity == CASE_SENSITIVE )
         	{
-        		res = ( StringUtils.trim( val1 ) ).compareTo( StringUtils.trim( val2 ) );
+        		res = ( StringTools.trim( val1 ) ).compareTo( StringTools.trim( val2 ) );
         	}
         	else
         	{
-        		res = ( StringUtils.trim( val1 ) ).compareToIgnoreCase( StringUtils.trim( val2 ) );
+        		res = ( StringTools.trim( val1 ) ).compareToIgnoreCase( StringTools.trim( val2 ) );
         	}
         	
     		return (res < 0 ? -1 : res > 0 ? 1 : 0 );
@@ -307,8 +307,8 @@
      */
     public String normalize()
     {
-        return StringUtils.lowerCase( StringUtils.trim( type ) ) + '=' +
-        StringUtils.trim( value );
+        return StringTools.lowerCase( StringTools.trim( type ) ) + '=' +
+        StringTools.trim( value );
     }
 
     /**
@@ -320,7 +320,7 @@
     {
         StringBuffer sb = new StringBuffer();
         
-        if ( StringUtils.isEmpty( type ) || StringUtils.isEmpty( type.trim() ) )
+        if ( StringTools.isEmpty( type ) || StringTools.isEmpty( type.trim() ) )
         {
         	return "";
         }

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/DnParser.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/DnParser.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/DnParser.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/DnParser.java Mon Dec 26 14:40:09 2005
@@ -21,8 +21,8 @@
 import javax.naming.InvalidNameException;
 import javax.naming.Name;
 
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.util.DNUtils;
+import org.apache.ldap.common.util.StringTools;
 
 import javax.naming.NameParser ;
 
@@ -107,8 +107,8 @@
                 rdns.add( rdn.clone() );
                 rdn.clear();
 
-                if ( ( StringUtils.isCharASCII( chars, pos, ',' ) == false ) &&
-                     ( StringUtils.isCharASCII( chars, pos, ';' ) == false ) )
+                if ( ( StringTools.isCharASCII( chars, pos, ',' ) == false ) &&
+                     ( StringTools.isCharASCII( chars, pos, ';' ) == false ) )
                 {
 
                     break;

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/LdapDN.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/LdapDN.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/LdapDN.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/LdapDN.java Mon Dec 26 14:40:09 2005
@@ -29,9 +29,9 @@
 import javax.naming.Name;
 import javax.naming.NamingException;
 
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.LdapString;
 import org.apache.ldap.common.schema.OidNormalizer;
+import org.apache.ldap.common.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -144,7 +144,7 @@
      */
     public LdapDN( String upName ) throws InvalidNameException
     {
-        if ( StringUtils.isNotEmpty( upName ) )
+        if ( StringTools.isNotEmpty( upName ) )
         {
             try
             {
@@ -199,7 +199,7 @@
     private void normalize( String upName )
     {
         string = toString();
-        bytes = StringUtils.getBytesUtf8( this.string );
+        bytes = StringTools.getBytesUtf8( this.string );
         this.upName = upName == null ? "" : upName ;
     }
     
@@ -656,7 +656,7 @@
         }
 
         newLdapDN.string = newLdapDN.toString();
-        newLdapDN.bytes = StringUtils.getBytesUtf8( newLdapDN.string );
+        newLdapDN.bytes = StringTools.getBytesUtf8( newLdapDN.string );
         newLdapDN.upName = getUpNamePrefix( posn );
         
         return newLdapDN;
@@ -699,7 +699,7 @@
         }
 
         newLdapDN.string = newLdapDN.toString();
-        newLdapDN.bytes = StringUtils.getBytesUtf8( newLdapDN.string );
+        newLdapDN.bytes = StringTools.getBytesUtf8( newLdapDN.string );
         newLdapDN.upName = getUpNameSuffix( posn );
 
         return newLdapDN;
@@ -983,9 +983,9 @@
     
     private static AttributeTypeAndValue atavToOid( AttributeTypeAndValue atav, Map oids ) throws InvalidNameException, NamingException
     {
-		 String type = StringUtils.trim( atav.getType() );
+		 String type = StringTools.trim( atav.getType() );
 	    	
-		 if ( StringUtils.isNotEmpty( StringUtils.lowerCase( type ) ) )
+		 if ( StringTools.isNotEmpty( StringTools.lowerCase( type ) ) )
 		 {
 			OidNormalizer oidNormalizer = (OidNormalizer)oids.get( type );
 				 
@@ -1038,9 +1038,9 @@
 		 }
 		 else
 		 {
-			 String type = StringUtils.trim( rdn.getType() );
+			 String type = StringTools.trim( rdn.getType() );
 		    	
-			 if ( StringUtils.isNotEmpty( StringUtils.lowerCase( type ) ) )
+			 if ( StringTools.isNotEmpty( StringTools.lowerCase( type ) ) )
 			 {
 				OidNormalizer oidNormalizer = (OidNormalizer)oids.get( type );
 					 

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/Rdn.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/Rdn.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/Rdn.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/Rdn.java Mon Dec 26 14:40:09 2005
@@ -28,8 +28,8 @@
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.commons.collections.MultiHashMap;
+import org.apache.ldap.common.util.StringTools;
 
 /**
  * This class store the name-component part or the following BNF grammar (as of RFC2253, par. 3, 
@@ -156,7 +156,7 @@
      */
     public Rdn( String rdn ) throws InvalidNameException
     {
-        if ( StringUtils.isNotEmpty( rdn ) )
+        if ( StringTools.isNotEmpty( rdn ) )
         {
             try
             {
@@ -283,8 +283,8 @@
             case 1:
                 // We have a single AttributeTypeAndValue
                 // We will trim and lowercase type and value.
-                string = StringUtils.lowerCase( StringUtils.trim( atav.getType() ) ) +
-                                '=' + StringUtils.trim( atav.getValue() );
+                string = StringTools.lowerCase( StringTools.trim( atav.getType() ) ) +
+                                '=' + StringTools.trim( atav.getValue() );
                 break;
                 
             default :
@@ -329,8 +329,8 @@
     /* Unspecified protection */ void addAttributeTypeAndValue( String type, String value) throws InvalidNameException
     {
         // First, let's normalize the type
-        String normalizedType = StringUtils.lowerCase( StringUtils.trim( type ) );
-        String normalizedValue = StringUtils.trim( value );
+        String normalizedType = StringTools.lowerCase( StringTools.trim( type ) );
+        String normalizedValue = StringTools.trim( value );
         
         switch ( nbAtavs )
         {
@@ -389,7 +389,7 @@
     public String getValue( String type ) throws InvalidNameException
     {
         // First, let's normalize the type
-        String normalizedType = StringUtils.lowerCase( StringUtils.trim( type ) );
+        String normalizedType = StringTools.lowerCase( StringTools.trim( type ) );
         
         switch ( nbAtavs )
         {
@@ -397,7 +397,7 @@
                 return "";
                 
             case 1:
-                if ( StringUtils.equals( atav.getType(), normalizedType ) )
+                if ( StringTools.equals( atav.getType(), normalizedType ) )
                 {
                     return atav.getValue();
                 }
@@ -461,7 +461,7 @@
     public AttributeTypeAndValue getAttributeTypeAndValue( String type )
     {
         // First, let's normalize the type
-        String normalizedType = StringUtils.lowerCase( StringUtils.trim( type ) );
+        String normalizedType = StringTools.lowerCase( StringTools.trim( type ) );
 
         switch ( nbAtavs )
         {
@@ -877,7 +877,7 @@
 	 */
 	public static Object unescapeValue( String value ) throws IllegalArgumentException
 	{
-		if ( StringUtils.isEmpty( value ) )
+		if ( StringTools.isEmpty( value ) )
 		{
 			return "";
 		}
@@ -889,7 +889,7 @@
 			if ( chars.length == 1 )
 			{
 				// The value is only containing a #
-				return StringUtils.EMPTY_BYTES;
+				return StringTools.EMPTY_BYTES;
 			}
 			
 			if ( ( chars.length % 2 ) != 1 )
@@ -903,9 +903,9 @@
 			
 			for ( int i = 1; i < chars.length; i += 2 )
 			{
-				if ( StringUtils.isHex( chars, i ) && StringUtils.isHex( chars, i + 1 ) ) 
+				if ( StringTools.isHex( chars, i ) && StringTools.isHex( chars, i + 1 ) ) 
 				{
-					hexValue[ pos++ ] = (byte)((StringUtils.HEX_VALUE[ chars[i] ] << 4) + StringUtils.HEX_VALUE[ chars[i + 1] ]);
+					hexValue[ pos++ ] = (byte)((StringTools.HEX_VALUE[ chars[i] ] << 4) + StringTools.HEX_VALUE[ chars[i + 1] ]);
 				}
 				else
 				{
@@ -946,10 +946,10 @@
 						break;
 						
 					default :
-						if ( StringUtils.isHex( chars, i ) )
+						if ( StringTools.isHex( chars, i ) )
 						{
 							isHex = true;
-							pair = ((byte)(StringUtils.HEX_VALUE[ chars[i] ] << 4));
+							pair = ((byte)(StringTools.HEX_VALUE[ chars[i] ] << 4));
 						}
 					}
 				}
@@ -957,9 +957,9 @@
 				{
 					if ( isHex )
 					{
-						if ( StringUtils.isHex( chars, i ) )
+						if ( StringTools.isHex( chars, i ) )
 						{
-							pair += (byte)StringUtils.HEX_VALUE[ chars[i] ];
+							pair += (byte)StringTools.HEX_VALUE[ chars[i] ];
 							bytes[pos++] = pair;
 						}
 					}
@@ -985,7 +985,7 @@
 							throw new IllegalArgumentException( "Unescaped special characters are not allowed" );
 							
 						default :
-							byte[] result = StringUtils.charToBytes( chars[i] );
+							byte[] result = StringTools.charToBytes( chars[i] );
 							
 							for ( int j = 0; j < result.length; j++ )
 							{
@@ -996,7 +996,7 @@
 				}
 			}
 			
-			return StringUtils.utf8ToString( bytes, pos );
+			return StringTools.utf8ToString( bytes, pos );
 		}
 	}
 	
@@ -1008,12 +1008,12 @@
 	 */
 	public static String escapeValue( Object attrValue)
 	{
-		if (StringUtils.isEmpty( (byte[])attrValue) )
+		if (StringTools.isEmpty( (byte[])attrValue) )
 		{
 			return "";
 		}
 		
-		String value = StringUtils.utf8ToString( (byte[])attrValue );
+		String value = StringTools.utf8ToString( (byte[])attrValue );
 		
 		char[] chars = value.toCharArray();
 		char[] newChars = new char[chars.length * 3];
@@ -1049,7 +1049,7 @@
 				case 0x0C :	case 0x0D :	case 0x0E :	case 0x0F :
 					newChars[pos++] = '\\';
 					newChars[pos++] = '0';
-					newChars[pos++] = StringUtils.dumpHex( (byte)(chars[i] & 0x0F) );
+					newChars[pos++] = StringTools.dumpHex( (byte)(chars[i] & 0x0F) );
 					break;
 					
 				case 0x10 :	case 0x11 :	case 0x12 :	case 0x13 :
@@ -1058,7 +1058,7 @@
 				case 0x1C :	case 0x1D :	case 0x1E :	case 0x1F :
 					newChars[pos++] = '\\';
 					newChars[pos++] = '1';
-					newChars[pos++] = StringUtils.dumpHex( (byte)(chars[i] & 0x0F) );
+					newChars[pos++] = StringTools.dumpHex( (byte)(chars[i] & 0x0F) );
 					break;
 					
 

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/RdnParser.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/RdnParser.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/RdnParser.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/name/RdnParser.java Mon Dec 26 14:40:09 2005
@@ -18,8 +18,8 @@
 
 import javax.naming.InvalidNameException;
 
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.util.DNUtils;
+import org.apache.ldap.common.util.StringTools;
 
 /**
  * This class parse the name-component part or the following BNF grammar (as of RFC2253, par. 3, 
@@ -91,7 +91,7 @@
     private static int parseOidValue(char[] chars, int pos)
     {
         // <attributType> ::= [0-9] <digits> <oids>
-        if ( StringUtils.isDigit( chars, pos ) == false )
+        if ( StringTools.isDigit( chars, pos ) == false )
         {
             // Nope... An error
             return DNUtils.PARSING_ERROR;
@@ -101,13 +101,13 @@
             // Let's process an oid
             pos++;
 
-            while ( StringUtils.isDigit( chars, pos ) )
+            while ( StringTools.isDigit( chars, pos ) )
             {
                 pos++;
             }
 
             // <oids> ::= '.' [0-9] <digits> <oids> | e
-            if ( StringUtils.isCharASCII( chars, pos, '.' ) == false )
+            if ( StringTools.isCharASCII( chars, pos, '.' ) == false )
             {
                 return pos;
             }
@@ -117,7 +117,7 @@
                 {
                     pos++;
 
-                    if ( StringUtils.isDigit( chars, pos ) == false )
+                    if ( StringTools.isDigit( chars, pos ) == false )
                     {
                         return DNUtils.PARSING_ERROR;
                     }
@@ -125,13 +125,13 @@
                     {
                         pos++;
 
-                        while ( StringUtils.isDigit( chars, pos ) )
+                        while ( StringTools.isDigit( chars, pos ) )
                         {
                             pos++;
                         }
                     }
                 }
-                while ( StringUtils.isCharASCII( chars, pos, '.' ) );
+                while ( StringTools.isCharASCII( chars, pos, '.' ) );
 
                 return pos;
             }
@@ -150,8 +150,8 @@
      */
     private static int parseOidPrefix( char[] chars, int pos )
     {
-        if ( ( StringUtils.areEquals( chars, pos, DNUtils.OID_LOWER ) == DNUtils.PARSING_ERROR ) &&
-             ( StringUtils.areEquals( chars, pos, DNUtils.OID_UPPER ) == DNUtils.PARSING_ERROR ) )
+        if ( ( StringTools.areEquals( chars, pos, DNUtils.OID_LOWER ) == DNUtils.PARSING_ERROR ) &&
+             ( StringTools.areEquals( chars, pos, DNUtils.OID_UPPER ) == DNUtils.PARSING_ERROR ) )
         {
             return DNUtils.PARSING_ERROR;
         }
@@ -181,7 +181,7 @@
     {
         // <attributType> ::= [a-zA-Z] <keychars> | <oidPrefix> [0-9] <digits> <oids> | [0-9] <digits> <oids>
         
-        if ( StringUtils.isAlphaASCII( chars, pos ))
+        if ( StringTools.isAlphaASCII( chars, pos ))
         {
             // <attributType> ::= [a-zA-Z] <keychars> | <oidPrefix> [0-9] <digits> <oids> 
 
@@ -199,7 +199,7 @@
                 // <keychars>       ::= [a-zA-Z] <keychar> | [0-9] <keychar> | '-' <keychar> | e
                 pos = oldPos + 1;
 
-                while ( StringUtils.isAlphaDigitMinus( chars, pos ) )
+                while ( StringTools.isAlphaDigitMinus( chars, pos ) )
                 {
                     pos++;
                 }
@@ -230,7 +230,7 @@
      */
     private static int parseAttributeValue( char[] chars, int pos )
     {
-        if ( StringUtils.isCharASCII( chars, pos, '#' ) )
+        if ( StringTools.isCharASCII( chars, pos, '#' ) )
         {
             pos++;
 
@@ -241,9 +241,9 @@
                 return DNUtils.PARSING_ERROR;
             }
 
-            return StringUtils.trimLeft( chars, pos );
+            return StringTools.trimLeft( chars, pos );
         }
-        else if ( StringUtils.isCharASCII( chars, pos, '"' ) )
+        else if ( StringTools.isCharASCII( chars, pos, '"' ) )
         {
             pos++;
             int nbBytes = 0;
@@ -252,7 +252,7 @@
             // <quotechar-or-pairs>    ::= <quotechar> <quotechar-or-pairs> | '\' <pairchar> <quotechar-or-pairs> | e
             while ( true )
             {
-                if ( StringUtils.isCharASCII( chars, pos, '\\' ) )
+                if ( StringTools.isCharASCII( chars, pos, '\\' ) )
                 {
                     pos++;
 
@@ -275,11 +275,11 @@
                 }
             }
 
-            if ( StringUtils.isCharASCII( chars, pos, '"' ) )
+            if ( StringTools.isCharASCII( chars, pos, '"' ) )
             {
                 pos++;
 
-                return StringUtils.trimLeft( chars, pos );
+                return StringTools.trimLeft( chars, pos );
             }
             else
             {
@@ -290,7 +290,7 @@
         {
             while ( true )
             {
-                if ( StringUtils.isCharASCII( chars, pos, '\\' ) )
+                if ( StringTools.isCharASCII( chars, pos, '\\' ) )
                 {
                     // '\' <pairchar> <pairs-or-strings>
                     pos++;
@@ -313,12 +313,12 @@
                     {
                         // A special case : if we have some spaces before the '+' character,
                         // we MUST skip them.
-                        if ( StringUtils.isCharASCII( chars, pos, ' ') )
+                        if ( StringTools.isCharASCII( chars, pos, ' ') )
                         {
-                            pos = StringUtils.trimLeft( chars, pos );
+                            pos = StringTools.trimLeft( chars, pos );
 
                             if ( ( DNUtils.isStringChar( chars, pos ) == DNUtils.PARSING_ERROR ) &&
-                                    ( StringUtils.isCharASCII( chars, pos, '\\' ) == false ) )
+                                    ( StringTools.isCharASCII( chars, pos, '\\' ) == false ) )
                             {
                                 // Ok, we are done with the stringchar.
                                 return pos;
@@ -357,9 +357,9 @@
 
         while ( true )
         {
-            pos = StringUtils.trimLeft( chars, pos );
+            pos = StringTools.trimLeft( chars, pos );
 
-            if ( StringUtils.isCharASCII( chars, pos, '+' ) )
+            if ( StringTools.isCharASCII( chars, pos, '+' ) )
             {
                 pos++;
             }
@@ -369,7 +369,7 @@
                 return pos;
             }
 
-            pos = StringUtils.trimLeft( chars, pos );
+            pos = StringTools.trimLeft( chars, pos );
 
             if ( ( newPos = parseAttributeType( chars, pos ) ) == DNUtils.PARSING_ERROR )
             {
@@ -381,9 +381,9 @@
                 type = new String( chars, pos, newPos - pos );
             }
 
-            pos = StringUtils.trimLeft( chars, newPos );
+            pos = StringTools.trimLeft( chars, newPos );
 
-            if ( StringUtils.isCharASCII( chars, pos, '=' ) )
+            if ( StringTools.isCharASCII( chars, pos, '=' ) )
             {
                 pos++;
             }
@@ -392,7 +392,7 @@
                 return DNUtils.PARSING_ERROR;
             }
 
-            pos = StringUtils.trimLeft( chars, pos );
+            pos = StringTools.trimLeft( chars, pos );
 
             newPos = parseAttributeValue( chars, pos );
             
@@ -400,7 +400,7 @@
             {
                 if ( rdn != null )
                 {
-                    newPos = StringUtils.trimRight( chars, newPos );
+                    newPos = StringTools.trimRight( chars, newPos );
                     value = new String( chars, pos, newPos - pos );
                     
                     rdn.addAttributeTypeAndValue( type, value );
@@ -428,7 +428,7 @@
     	char[] chars = value.toCharArray();
     	int pos = 0;
     	
-        if ( StringUtils.isCharASCII( chars, pos, '#' ) )
+        if ( StringTools.isCharASCII( chars, pos, '#' ) )
         {
             pos++;
 
@@ -439,9 +439,9 @@
                 throw new IllegalArgumentException();
             }
 
-            return StringUtils.trimLeft( chars, pos );
+            return StringTools.trimLeft( chars, pos );
         }
-        else if ( StringUtils.isCharASCII( chars, pos, '"' ) )
+        else if ( StringTools.isCharASCII( chars, pos, '"' ) )
         {
             pos++;
             int nbBytes = 0;
@@ -450,7 +450,7 @@
             // <quotechar-or-pairs>    ::= <quotechar> <quotechar-or-pairs> | '\' <pairchar> <quotechar-or-pairs> | e
             while ( true )
             {
-                if ( StringUtils.isCharASCII( chars, pos, '\\' ) )
+                if ( StringTools.isCharASCII( chars, pos, '\\' ) )
                 {
                     pos++;
 
@@ -473,11 +473,11 @@
                 }
             }
 
-            if ( StringUtils.isCharASCII( chars, pos, '"' ) )
+            if ( StringTools.isCharASCII( chars, pos, '"' ) )
             {
                 pos++;
 
-                return StringUtils.trimLeft( chars, pos );
+                return StringTools.trimLeft( chars, pos );
             }
             else
             {
@@ -488,7 +488,7 @@
         {
             while ( true )
             {
-                if ( StringUtils.isCharASCII( chars, pos, '\\' ) )
+                if ( StringTools.isCharASCII( chars, pos, '\\' ) )
                 {
                     // '\' <pairchar> <pairs-or-strings>
                     pos++;
@@ -511,12 +511,12 @@
                     {
                         // A special case : if we have some spaces before the '+' character,
                         // we MUST skip them.
-                        if ( StringUtils.isCharASCII( chars, pos, ' ') )
+                        if ( StringTools.isCharASCII( chars, pos, ' ') )
                         {
-                            pos = StringUtils.trimLeft( chars, pos );
+                            pos = StringTools.trimLeft( chars, pos );
 
                             if ( ( DNUtils.isStringChar( chars, pos ) == DNUtils.PARSING_ERROR ) &&
-                                    ( StringUtils.isCharASCII( chars, pos, '\\' ) == false ) )
+                                    ( StringTools.isCharASCII( chars, pos, '\\' ) == false ) )
                             {
                                 // Ok, we are done with the stringchar.
                                 return pos;
@@ -554,7 +554,7 @@
         String value = null;
         int start = pos;
         
-        pos = StringUtils.trimLeft( chars, pos );
+        pos = StringTools.trimLeft( chars, pos );
         
         if ( ( newPos = parseAttributeType( chars, pos ) ) == DNUtils.PARSING_ERROR )
         {
@@ -566,9 +566,9 @@
             type = new String( chars, pos, newPos - pos );
         }
         
-        pos = StringUtils.trimLeft( chars, newPos );
+        pos = StringTools.trimLeft( chars, newPos );
 
-        if ( StringUtils.isCharASCII( chars, pos, '=' ) == false )
+        if ( StringTools.isCharASCII( chars, pos, '=' ) == false )
         {
             return DNUtils.PARSING_ERROR;
         }
@@ -577,7 +577,7 @@
             pos++;
         }
 
-        pos = StringUtils.trimLeft( chars, pos );
+        pos = StringTools.trimLeft( chars, pos );
 
         if ( ( newPos = parseAttributeValue( chars, pos ) ) == DNUtils.PARSING_ERROR )
         {
@@ -586,7 +586,7 @@
         
         if ( rdn != null )
         {
-            newPos = StringUtils.trimRight( chars, newPos );
+            newPos = StringTools.trimRight( chars, newPos );
             value = new String( chars, pos, newPos - pos );
             
             rdn.addAttributeTypeAndValue( type, value );

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java Mon Dec 26 14:40:09 2005
@@ -19,7 +19,6 @@
 
 import javax.naming.NamingException;
 
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.util.StringTools;
 
 
@@ -42,7 +41,7 @@
         
         if ( value instanceof byte[] )
         {
-            return StringTools.deepTrim( StringUtils.utf8ToString( (byte[])value ) );
+            return StringTools.deepTrim( StringTools.utf8ToString( (byte[])value ) );
         }
         else
         {

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java Mon Dec 26 14:40:09 2005
@@ -19,7 +19,6 @@
 
 import javax.naming.NamingException;
 
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.util.StringTools;
 
 
@@ -43,7 +42,7 @@
         
         if ( value instanceof byte[] )
         {
-            return StringTools.deepTrimToLower( StringUtils.utf8ToString( (byte[])value ) );
+            return StringTools.deepTrimToLower( StringTools.utf8ToString( (byte[])value ) );
         }
         else
         {

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DnNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DnNormalizer.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DnNormalizer.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/schema/DnNormalizer.java Mon Dec 26 14:40:09 2005
@@ -35,7 +35,7 @@
  */
 public class DnNormalizer implements Normalizer
 {
-	private static DnOidContainer oidContainer;
+	private static DnOidContainer oidContainer = DnOidContainer.getInstance();
 	
 	public static void setOidContainer( DnOidContainer oidContainer )
 	{

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/url/LdapURL.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/url/LdapURL.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/url/LdapURL.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/url/LdapURL.java Mon Dec 26 14:40:09 2005
@@ -17,7 +17,6 @@
 package org.apache.ldap.common.url;
 
 import org.apache.asn1.codec.DecoderException;
-import org.apache.asn1.codec.util.StringUtils;
 
 import org.apache.commons.httpclient.URIException;
 import org.apache.commons.httpclient.util.URIUtil;
@@ -25,6 +24,7 @@
 import org.apache.ldap.common.LdapString;
 import org.apache.ldap.common.filter.FilterParserImpl;
 import org.apache.ldap.common.name.LdapDN;
+import org.apache.ldap.common.util.StringTools;
 
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -145,8 +145,8 @@
         int pos = 0;
 
         // The scheme
-        if ( ( ( pos = StringUtils.areEquals( chars, 0, "ldap://" ) ) == StringUtils.NOT_EQUAL )
-             && ( ( pos = StringUtils.areEquals( chars, 0, "ldaps://" ) ) == StringUtils.NOT_EQUAL ) )
+        if ( ( ( pos = StringTools.areEquals( chars, 0, "ldap://" ) ) == StringTools.NOT_EQUAL )
+             && ( ( pos = StringTools.areEquals( chars, 0, "ldaps://" ) ) == StringTools.NOT_EQUAL ) )
         {
             throw new LdapURLEncodingException( "A LdapUrl must start with \"ldap://\" or \"ldaps://\"" );
         }
@@ -167,7 +167,7 @@
         }
 
         // An optional '/'
-        if ( StringUtils.isCharASCII( chars, pos, '/' ) == false )
+        if ( StringTools.isCharASCII( chars, pos, '/' ) == false )
         {
             throw new LdapURLEncodingException( "Bad character, position " + pos + ", '" + chars[pos] +
                 "', '/' expected" );
@@ -192,7 +192,7 @@
         }
 
         // Optionals attributes
-        if ( StringUtils.isCharASCII( chars, pos, '?' ) == false )
+        if ( StringTools.isCharASCII( chars, pos, '?' ) == false )
         {
             throw new LdapURLEncodingException( "Bad character, position " + pos + ", '" + chars[pos] +
                 "', '?' expected" );
@@ -211,7 +211,7 @@
         }
 
         // Optional scope
-        if ( StringUtils.isCharASCII( chars, pos, '?' ) == false )
+        if ( StringTools.isCharASCII( chars, pos, '?' ) == false )
         {
             throw new LdapURLEncodingException( "Bad character, position " + pos + ", '" + chars[pos] +
                 "', '?' expected" );
@@ -230,7 +230,7 @@
         }
 
         // Optional filter
-        if ( StringUtils.isCharASCII( chars, pos, '?' ) == false )
+        if ( StringTools.isCharASCII( chars, pos, '?' ) == false )
         {
             throw new LdapURLEncodingException( "Bad character, position " + pos + ", '" + chars[pos] +
                 "', '?' expected" );
@@ -254,7 +254,7 @@
         }
 
         // Optional extensions
-        if ( StringUtils.isCharASCII( chars, pos, '?' ) == false )
+        if ( StringTools.isCharASCII( chars, pos, '?' ) == false )
         {
             throw new LdapURLEncodingException( "Bad character, position " + pos + ", '" + chars[pos] +
                 "', '?' expected" );
@@ -355,7 +355,7 @@
         // the end.
         // We will search the end of the host part, and we will check some
         // elements.
-        if ( StringUtils.isCharASCII( chars, pos, '-' ) )
+        if ( StringTools.isCharASCII( chars, pos, '-' ) )
         {
 
             // We can't have a '-' on first position
@@ -365,7 +365,7 @@
         while ( ( pos < chars.length ) && ( chars[pos] != ':' ) && ( chars[pos] != '/' ) )
         {
 
-            if ( StringUtils.isCharASCII( chars, pos, '.' ) )
+            if ( StringTools.isCharASCII( chars, pos, '.' ) )
             {
 
                 if ( ( hadMinus ) || ( hadDot ) )
@@ -399,7 +399,7 @@
             else
             {
 
-                if ( hadDot && StringUtils.isCharASCII( chars, pos, '-' ) )
+                if ( hadDot && StringTools.isCharASCII( chars, pos, '-' ) )
                 {
 
                     // We can't have a '-' just after a '.'
@@ -409,7 +409,7 @@
                 hadDot = false;
             }
 
-            if ( StringUtils.isDigit( chars, pos ) )
+            if ( StringTools.isDigit( chars, pos ) )
             {
 
                 if ( isHostNumber && ( nbDots < 4 ) )
@@ -424,11 +424,11 @@
 
                 hadMinus = false;
             }
-            else if ( StringUtils.isAlphaDigitMinus( chars, pos ) )
+            else if ( StringTools.isAlphaDigitMinus( chars, pos ) )
             {
                 isHostNumber = false;
 
-                if ( StringUtils.isCharASCII( chars, pos, '-' ) )
+                if ( StringTools.isCharASCII( chars, pos, '-' ) )
                 {
                     hadMinus = true;
                 }
@@ -497,7 +497,7 @@
     private int parsePort( char[] chars, int pos )
     {
 
-        if ( StringUtils.isDigit( chars, pos ) == false )
+        if ( StringTools.isDigit( chars, pos ) == false )
         {
             return -1;
         }
@@ -506,7 +506,7 @@
 
         pos++;
 
-        while ( StringUtils.isDigit( chars, pos ) )
+        while ( StringTools.isDigit( chars, pos ) )
         {
             port = ( port * 10 ) + ( chars[pos] - '0' );
 
@@ -540,7 +540,7 @@
         }
 
         // We may have a port.
-        if ( StringUtils.isCharASCII( chars, pos, ':' ) )
+        if ( StringTools.isCharASCII( chars, pos, ':' ) )
         {
             pos++;
         }
@@ -613,7 +613,7 @@
             for ( int i = pos; ( i < chars.length ) && ( chars[i] != '?' ); i++ )
             {
 
-                if ( StringUtils.isCharASCII( chars, i, ',' ) )
+                if ( StringTools.isCharASCII( chars, i, ',' ) )
                 {
                     hadComma = true;
 
@@ -749,23 +749,23 @@
     private int parseScope( char[] chars, int pos )
     {
 
-        if ( StringUtils.isCharASCII( chars, pos, 'b' ) ||
-                StringUtils.isCharASCII( chars, pos, 'B' ) )
+        if ( StringTools.isCharASCII( chars, pos, 'b' ) ||
+                StringTools.isCharASCII( chars, pos, 'B' ) )
         {
             pos++;
 
-            if ( StringUtils.isCharASCII( chars, pos, 'a' ) ||
-                    StringUtils.isCharASCII( chars, pos, 'A' ) )
+            if ( StringTools.isCharASCII( chars, pos, 'a' ) ||
+                    StringTools.isCharASCII( chars, pos, 'A' ) )
             {
                 pos++;
 
-                if ( StringUtils.isCharASCII( chars, pos, 's' ) ||
-                        StringUtils.isCharASCII( chars, pos, 'S' ) )
+                if ( StringTools.isCharASCII( chars, pos, 's' ) ||
+                        StringTools.isCharASCII( chars, pos, 'S' ) )
                 {
                     pos++;
 
-                    if ( StringUtils.isCharASCII( chars, pos, 'e' ) ||
-                            StringUtils.isCharASCII( chars, pos, 'E' ) )
+                    if ( StringTools.isCharASCII( chars, pos, 'e' ) ||
+                            StringTools.isCharASCII( chars, pos, 'E' ) )
                     {
                         pos++;
                         scope = SearchControls.OBJECT_SCOPE;
@@ -774,18 +774,18 @@
                 }
             }
         }
-        else if ( StringUtils.isCharASCII( chars, pos, 'o' ) ||
-                StringUtils.isCharASCII( chars, pos, 'O' ) )
+        else if ( StringTools.isCharASCII( chars, pos, 'o' ) ||
+                StringTools.isCharASCII( chars, pos, 'O' ) )
         {
             pos++;
 
-            if ( StringUtils.isCharASCII( chars, pos, 'n' ) ||
-                    StringUtils.isCharASCII( chars, pos, 'N' ) )
+            if ( StringTools.isCharASCII( chars, pos, 'n' ) ||
+                    StringTools.isCharASCII( chars, pos, 'N' ) )
             {
                 pos++;
 
-                if ( StringUtils.isCharASCII( chars, pos, 'e' ) ||
-                        StringUtils.isCharASCII( chars, pos, 'E' ) )
+                if ( StringTools.isCharASCII( chars, pos, 'e' ) ||
+                        StringTools.isCharASCII( chars, pos, 'E' ) )
                 {
                     pos++;
 
@@ -794,18 +794,18 @@
                 }
             }
         }
-        else if ( StringUtils.isCharASCII( chars, pos, 's' ) ||
-                StringUtils.isCharASCII( chars, pos, 'S' ) )
+        else if ( StringTools.isCharASCII( chars, pos, 's' ) ||
+                StringTools.isCharASCII( chars, pos, 'S' ) )
         {
             pos++;
 
-            if ( StringUtils.isCharASCII( chars, pos, 'u' ) ||
-                    StringUtils.isCharASCII( chars, pos, 'U' ) )
+            if ( StringTools.isCharASCII( chars, pos, 'u' ) ||
+                    StringTools.isCharASCII( chars, pos, 'U' ) )
             {
                 pos++;
 
-                if ( StringUtils.isCharASCII( chars, pos, 'b' ) ||
-                        StringUtils.isCharASCII( chars, pos, 'B' ) )
+                if ( StringTools.isCharASCII( chars, pos, 'b' ) ||
+                        StringTools.isCharASCII( chars, pos, 'B' ) )
                 {
                     pos++;
 
@@ -814,7 +814,7 @@
                 }
             }
         }
-        else if ( StringUtils.isCharASCII( chars, pos, '?' ) )
+        else if ( StringTools.isCharASCII( chars, pos, '?' ) )
         {
 
             // An empty scope. This is valid
@@ -857,7 +857,7 @@
             for ( int i = pos; ( i < chars.length ); i++ )
             {
 
-                if ( StringUtils.isCharASCII( chars, i, ',' ) )
+                if ( StringTools.isCharASCII( chars, i, ',' ) )
                 {
 
                     if ( isNewExtension )
@@ -893,7 +893,7 @@
                         value          = null;
                     }
                 }
-                else if ( StringUtils.isCharASCII( chars, i, '=' ) )
+                else if ( StringTools.isCharASCII( chars, i, '=' ) )
                 {
 
                     if ( hasValue )
@@ -918,7 +918,7 @@
                     hasValue       = true;
                     start          = i + 1;
                 }
-                else if ( StringUtils.isCharASCII( chars, i, '!' ) )
+                else if ( StringTools.isCharASCII( chars, i, '!' ) )
                 {
 
                     if ( isNewExtension == false )

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java Mon Dec 26 14:40:09 2005
@@ -17,7 +17,6 @@
 package org.apache.ldap.common.util;
 
 
-import org.apache.asn1.codec.util.StringUtils;
 import org.apache.ldap.common.message.LockableAttributeImpl;
 import org.apache.ldap.common.schema.AttributeType;
 import org.apache.ldap.common.schema.Normalizer;
@@ -254,11 +253,11 @@
                     }
                     else if (attr instanceof byte[] )
                     {
-                        String string = StringUtils.utf8ToString( (byte[])attr );
+                        String string = StringTools.utf8ToString( (byte[])attr );
                         
                         sb.append( tabs ).append( "        Val[" ).append( j ).append( "] : " );
                         sb.append( string ).append( '/');
-                        sb.append( StringUtils.dumpBytes( (byte[]) attr ) );
+                        sb.append( StringTools.dumpBytes( (byte[]) attr ) );
                         sb.append( " \n" );
                     }
                     else

Modified: directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/DNUtils.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/DNUtils.java?rev=359114&r1=359113&r2=359114&view=diff
==============================================================================
--- directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/DNUtils.java (original)
+++ directory/shared/ldap/branches/DN-refactoring/common/src/main/java/org/apache/ldap/common/util/DNUtils.java Mon Dec 26 14:40:09 2005
@@ -16,8 +16,6 @@
  */
 package org.apache.ldap.common.util;
 
-import org.apache.asn1.codec.util.StringUtils;
-
 /**
  * Utility class used by the LdapDN Parser.
  *
@@ -184,7 +182,7 @@
         {
             byte c = byteArray[index++];
 
-            if ( ( c > 127 ) || ( StringUtils.ALPHA[c] == false ) )
+            if ( ( c > 127 ) || ( StringTools.ALPHA[c] == false ) )
             {
                 return -1;
             }
@@ -215,7 +213,7 @@
         {
             char c = charArray[index++];
 
-            if ( ( c > 127 ) || ( StringUtils.ALPHA[c] == false ) )
+            if ( ( c > 127 ) || ( StringTools.ALPHA[c] == false ) )
             {
                 return PARSING_ERROR;
             }
@@ -252,9 +250,9 @@
             }
             else
             {
-                if ( StringUtils.isHex( byteArray, index++ ) )
+                if ( StringTools.isHex( byteArray, index++ ) )
                 {
-                    return StringUtils.isHex( byteArray, index );
+                    return StringTools.isHex( byteArray, index );
                 }
                 else
                 {
@@ -290,9 +288,9 @@
             }
             else
             {
-                if ( StringUtils.isHex( charArray, index++ ) )
+                if ( StringTools.isHex( charArray, index++ ) )
                 {
-                    return StringUtils.isHex( charArray, index );
+                    return StringTools.isHex( charArray, index );
                 }
                 else
                 {
@@ -338,7 +336,7 @@
             }
             else
             {
-                return StringUtils.countBytesPerChar(byteArray, index);
+                return StringTools.countBytesPerChar(byteArray, index);
             }
         }
     }
@@ -411,7 +409,7 @@
             }
             else
             {
-                return StringUtils.countBytesPerChar(byteArray, index);
+                return StringTools.countBytesPerChar(byteArray, index);
             }
         }
     }
@@ -460,9 +458,9 @@
      */
     public static int parseHexPair( byte[] byteArray, int index )
     {
-        if ( StringUtils.isHex( byteArray, index ) )
+        if ( StringTools.isHex( byteArray, index ) )
         {
-            if ( StringUtils.isHex( byteArray, index + 1 ) )
+            if ( StringTools.isHex( byteArray, index + 1 ) )
             {
                 return index + 2;
             }
@@ -489,9 +487,9 @@
      */
     public static int parseHexPair( char[] charArray, int index )
     {
-        if ( StringUtils.isHex( charArray, index ) )
+        if ( StringTools.isHex( charArray, index ) )
         {
-            if ( StringUtils.isHex( charArray, index + 1 ) )
+            if ( StringTools.isHex( charArray, index + 1 ) )
             {
                 return index + TWO_CHARS;
             }



Mime
View raw message