directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r489599 - in /directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax: DSAQualitySyntaxSyntaxChecker.java Ia5StringSyntaxChecker.java PrintableStringSyntaxChecker.java
Date Fri, 22 Dec 2006 10:15:23 GMT
Author: elecharny
Date: Fri Dec 22 02:15:23 2006
New Revision: 489599

URL: http://svn.apache.org/viewvc?view=rev&rev=489599
Log:
Use the StringTools isIA5String() and isPrintableString() instead of creating stupid inheritence
schemes...

Modified:
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/DSAQualitySyntaxSyntaxChecker.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/Ia5StringSyntaxChecker.java
    directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/PrintableStringSyntaxChecker.java

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/DSAQualitySyntaxSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/DSAQualitySyntaxSyntaxChecker.java?view=diff&rev=489599&r1=489598&r2=489599
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/DSAQualitySyntaxSyntaxChecker.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/DSAQualitySyntaxSyntaxChecker.java
Fri Dec 22 02:15:23 2006
@@ -38,7 +38,7 @@
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  * @version $Rev$
  */
-public class DSAQualitySyntaxSyntaxChecker extends PrintableStringSyntaxChecker
+public class DSAQualitySyntaxSyntaxChecker extends AbstractSyntaxChecker
 {
     /** The Syntax OID, according to RFC 2252 */
     private static final String SC_OID = "1.3.6.1.4.1.1466.115.121.1.19";
@@ -163,6 +163,6 @@
         }
         
         // Check that the description is a PrintableString
-        return super.isValidSyntax( remaining.substring( 1 ) );
+        return StringTools.isPrintableString( remaining.substring( 1 ) );
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/Ia5StringSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/Ia5StringSyntaxChecker.java?view=diff&rev=489599&r1=489598&r2=489599
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/Ia5StringSyntaxChecker.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/Ia5StringSyntaxChecker.java
Fri Dec 22 02:15:23 2006
@@ -90,17 +90,6 @@
             return false;
         }
         
-        //All the chars must be in [0x00, 0x7F]
-        for ( int i = 0; i < strValue.length(); i++ )
-        {
-            char c = strValue.charAt( i );
-            
-            if ( ( c < 0 ) || ( c > 0x7F ) )
-            {
-                return false;
-            }
-        }
-
-        return true;
+        return StringTools.isIA5String( strValue );
     }
 }

Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/PrintableStringSyntaxChecker.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/PrintableStringSyntaxChecker.java?view=diff&rev=489599&r1=489598&r2=489599
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/PrintableStringSyntaxChecker.java
(original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/schema/syntax/PrintableStringSyntaxChecker.java
Fri Dec 22 02:15:23 2006
@@ -59,27 +59,6 @@
     /** The Syntax OID, according to RFC 4517, par. 3.3.29 */
     private static final String SC_OID = "1.3.6.1.4.1.1466.115.121.1.44";
     
-    /** A table containing booleans when the corresponding char is printable */
-    private static final boolean[] IS_PRINTABLE_CHAR =
-        {
-        false, false, false, false, false, false, false, false, // ---, ---, ---, ---, ---,
---, ---, ---
-        false, false, false, false, false, false, false, false, // ---, ---, ---, ---, ---,
---, ---, ---
-        false, false, false, false, false, false, false, false, // ---, ---, ---, ---, ---,
---, ---, ---
-        false, false, false, false, false, false, false, false, // ---, ---, ---, ---, ---,
---, ---, ---
-        true,  false, false, false, false, false, false, true,  // ' ', ---, ---, ---, ---,
---, ---, "'" 
-        true,  true,  false, true,  true,  true,  true,  true,  // '(', ')', ---, '+', ',',
'-', '.', '/'
-        true,  true,  true,  true,  true,  true,  true,  true,  // '0', '1', '2', '3', '4',
'5', '6', '7',  
-        true,  true,  true,  false, false, true,  false, true,  // '8', '9', ':', ---, ---,
'=', ---, '?'
-        false, true,  true,  true,  true,  true,  true,  true,  // ---, 'A', 'B', 'C', 'D',
'E', 'F', 'G', 
-        true,  true,  true,  true,  true,  true,  true,  true,  // 'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O'
-        true,  true,  true,  true,  true,  true,  true,  true,  // 'P', 'Q', 'R', 'S', 'T',
'U', 'V', 'W'
-        true,  true,  true,  false, false, false, false, false, // 'X', 'Y', 'Z', ---, ---,
---, ---, ---
-        false, true,  true,  true,  true,  true,  true,  true,  // ---, 'a', 'b', 'c', 'd',
'e', 'f', 'g' 
-        true,  true,  true,  true,  true,  true,  true,  true,  // 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o'
-        true,  true,  true,  true,  true,  true,  true,  true,  // 'p', 'q', 'r', 's', 't',
'u', 'v', 'w'
-        true,  true,  true,  false, false, false, false, false  // 'x', 'y', 'z', ---, ---,
---, ---, ---
-        };
-    
     /**
      * 
      * Creates a new instance of PrintableStringSyntaxChecker.
@@ -138,17 +117,7 @@
         {
             return false;
         }
-        
-        for ( int i = 0; i < strValue.length(); i++ )
-        {
-            char c = strValue.charAt( i );
-            
-            if ( ( c > 127 ) || !IS_PRINTABLE_CHAR[ c ] )
-            {
-                return false;
-            }
-        }
-        
-        return true;
+
+        return StringTools.isPrintableString( strValue );
     }
 }



Mime
View raw message