directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1697165 - in /directory/shared/trunk: ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/ ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/ ldap/model/src/main/java/org/apache/directory/api/ld...
Date Sun, 23 Aug 2015 10:59:50 GMT
Author: elecharny
Date: Sun Aug 23 10:59:50 2015
New Revision: 1697165

URL: http://svn.apache.org/r1697165
Log:
o Using new GregorianCalendar( GMT, Locale.ROOT ) in GeneralizedTime (DIRAPI-219)
o Using toUpperCaseAscii() instead of toUpperCase() for schema elements
o Using toLowerCaseAscii() instead of lowerCase() for schema elements
o Deprecating Strings.toLowerCase() and Strings.toUpperCase(), created toLowerCaseAscii()
and toUpperCaseAscii()

Modified:
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java
    directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/CountrySyntaxChecker.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
    directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java?rev=1697165&r1=1697164&r2=1697165&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/AbstractSchemaObject.java
Sun Aug 23 10:59:50 2015
@@ -539,7 +539,7 @@ public abstract class AbstractSchemaObje
                 valueList.add( value );
             }
 
-            extensions.put( Strings.toUpperCase( key ), valueList );
+            extensions.put( Strings.toUpperCaseAscii( key ), valueList );
         }
     }
 
@@ -558,7 +558,7 @@ public abstract class AbstractSchemaObje
 
         if ( !isReadOnly )
         {
-            extensions.put( Strings.toUpperCase( key ), values );
+            extensions.put( Strings.toUpperCaseAscii( key ), values );
         }
     }
 
@@ -588,7 +588,7 @@ public abstract class AbstractSchemaObje
                     values.add( value );
                 }
 
-                this.extensions.put( Strings.toUpperCase( entry.getKey() ), values );
+                this.extensions.put( Strings.toUpperCaseAscii( entry.getKey() ), values );
             }
 
         }

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java?rev=1697165&r1=1697164&r2=1697165&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/SchemaObjectSorter.java
Sun Aug 23 10:59:50 2015
@@ -133,12 +133,12 @@ public final class SchemaObjectSorter
 
             for ( T schemaObject : schemaObjects )
             {
-                String oid = Strings.lowerCase( schemaObject.getOid() );
+                String oid = Strings.toLowerCaseAscii( schemaObject.getOid() );
                 oid2numericOid.put( oid, oid );
                 
                 for ( String name : schemaObject.getNames() )
                 {
-                    oid2numericOid.put( Strings.lowerCase( name ), oid );
+                    oid2numericOid.put( Strings.toLowerCaseAscii( name ), oid );
                 }
                 
                 numericOid2schemaObject.put( oid, schemaObject );
@@ -183,7 +183,7 @@ public final class SchemaObjectSorter
                             continue;
                         }
 
-                        String superiorNumeridOid = oid2numericOid.get( Strings.lowerCase(
superiorOid ) );
+                        String superiorNumeridOid = oid2numericOid.get( Strings.toLowerCaseAscii(
superiorOid ) );
 
                         // AT's superior is not within the processed AT list
                         if ( superiorNumeridOid == null )
@@ -191,7 +191,7 @@ public final class SchemaObjectSorter
                             continue;
                         }
 
-                        T superiorSchemaObject = numericOid2schemaObject.get( Strings.lowerCase(
superiorNumeridOid ) );
+                        T superiorSchemaObject = numericOid2schemaObject.get( Strings.toLowerCaseAscii(
superiorNumeridOid ) );
 
                         // AT's superior was already removed
                         if ( superiorSchemaObject == null )

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java?rev=1697165&r1=1697164&r2=1697165&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/registries/AbstractSchemaLoader.java
Sun Aug 23 10:59:50 2015
@@ -63,7 +63,7 @@ public abstract class AbstractSchemaLoad
         @Override
         public Schema put( String key, Schema value )
         {
-            return super.put( Strings.lowerCase( key ), value );
+            return super.put( Strings.toLowerCaseAscii( key ), value );
         }
 
 

Modified: directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/CountrySyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/CountrySyntaxChecker.java?rev=1697165&r1=1697164&r2=1697165&view=diff
==============================================================================
--- directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/CountrySyntaxChecker.java
(original)
+++ directory/shared/trunk/ldap/model/src/main/java/org/apache/directory/api/ldap/model/schema/syntaxCheckers/CountrySyntaxChecker.java
Sun Aug 23 10:59:50 2015
@@ -352,7 +352,7 @@ public class CountrySyntaxChecker extend
             return false;
         }
 
-        boolean result = COUNTRIES.contains( Strings.toUpperCase( strValue ) );
+        boolean result = COUNTRIES.contains( Strings.toUpperCaseAscii( strValue ) );
 
         if ( result )
         {

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java?rev=1697165&r1=1697164&r2=1697165&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
(original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/GeneralizedTime.java
Sun Aug 23 10:59:50 2015
@@ -187,7 +187,7 @@ public class GeneralizedTime implements
      */
     public GeneralizedTime( Date date )
     {
-        calendar = GregorianCalendar.getInstance( Locale.ENGLISH );
+        calendar = new GregorianCalendar( GMT, Locale.ROOT );
         calendar.setTime( date );
         setUp( calendar );
     }
@@ -239,7 +239,7 @@ public class GeneralizedTime implements
 
         this.upGeneralizedTime = generalizedTime;
 
-        calendar = GregorianCalendar.getInstance( Locale.ENGLISH );
+        calendar = new GregorianCalendar( GMT, Locale.ROOT );
         calendar.setTimeInMillis( 0 );
         calendar.setLenient( false );
 

Modified: directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java?rev=1697165&r1=1697164&r2=1697165&view=diff
==============================================================================
--- directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java (original)
+++ directory/shared/trunk/util/src/main/java/org/apache/directory/api/util/Strings.java Sun
Aug 23 10:59:50 2015
@@ -1897,6 +1897,7 @@ public final class Strings
      *
      * @param value The String to lowercase
      * @return The lowercase string
+     * @deprecated Use {@link #toLowerCaseAscii(String)}
      */
     public static String toLowerCase( String value )
     {
@@ -1921,6 +1922,32 @@ public final class Strings
      * In Ldap, attributesType are supposed to use ASCII chars :
      * 'a'-'z', 'A'-'Z', '0'-'9', '.' and '-' only.
      *
+     * @param value The String to lowercase
+     * @return The lowercase string
+     */
+    public static String toLowerCaseAscii( String value )
+    {
+        if ( ( null == value ) || ( value.length() == 0 ) )
+        {
+            return "";
+        }
+
+        char[] chars = value.toCharArray();
+
+        for ( int i = 0; i < chars.length; i++ )
+        {
+            chars[i] = TO_LOWER_CASE[chars[i]];
+        }
+
+        return new String( chars );
+    }
+
+
+    /**
+     * Rewrote the toLowercase method to improve performances.
+     * In Ldap, attributesType are supposed to use ASCII chars :
+     * 'a'-'z', 'A'-'Z', '0'-'9', '.' and '-' only.
+     *
      * @param value The byte[] to lowercase
      * @return The lowercase string
      */
@@ -1947,6 +1974,7 @@ public final class Strings
      *
      * @param value The String to uppercase
      * @return The uppercase string
+     * @deprecated Use {@link toUpperCaseAscii(String)}
      */
     public static String toUpperCase( String value )
     {
@@ -1967,6 +1995,32 @@ public final class Strings
 
 
     /**
+     * Rewrote the toLowercase method to improve performances.
+     * In Ldap, attributesType are supposed to use ASCII chars :
+     * 'a'-'z', 'A'-'Z', '0'-'9', '.' and '-' only.
+     *
+     * @param value The String to uppercase
+     * @return The uppercase string
+     */
+    public static String toUpperCaseAscii( String value )
+    {
+        if ( ( null == value ) || ( value.length() == 0 ) )
+        {
+            return "";
+        }
+
+        char[] chars = value.toCharArray();
+
+        for ( int i = 0; i < chars.length; i++ )
+        {
+            chars[i] = UPPER_CASE[chars[i]];
+        }
+
+        return new String( chars );
+    }
+
+
+    /**
      * <p>
      * Converts a String to upper case as per {@link String#toUpperCase()}.
      * </p>
@@ -1990,7 +2044,7 @@ public final class Strings
             return null;
         }
 
-        return str.toUpperCase();
+        return str.toUpperCase( Locale.ROOT );
     }
 
 



Mime
View raw message