You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2010/05/25 23:25:21 UTC

svn commit: r948212 - in /directory/shared/trunk/ldap/src: main/antlr/ main/java/org/apache/directory/shared/ldap/schema/ test/java/org/apache/directory/shared/ldap/schema/syntax/parser/

Author: elecharny
Date: Tue May 25 21:25:21 2010
New Revision: 948212

URL: http://svn.apache.org/viewvc?rev=948212&view=rev
Log:
Remplaced the AttributeType's syntax length from int to long, to get DIRSHARED-36

Modified:
    directory/shared/trunk/ldap/src/main/antlr/schema-value.g
    directory/shared/trunk/ldap/src/main/antlr/schema.g
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
    directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java

Modified: directory/shared/trunk/ldap/src/main/antlr/schema-value.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/schema-value.g?rev=948212&r1=948211&r2=948212&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/schema-value.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/schema-value.g Tue May 25 21:25:21 2010
@@ -151,7 +151,7 @@ noidlen returns [AntlrSchemaParser.NoidL
         (WHSP)?
         (RPAR)?
         (
-            l:LEN { noidlen.len = Integer.parseInt(l.getText()); }
+            l:LEN { noidlen.len = Long.parseLong(l.getText()); }
             (QUOTE)?
             (WHSP)?
             (RPAR)?
@@ -184,7 +184,7 @@ quirksNoidlen returns [AntlrSchemaParser
         (WHSP)?
         (RPAR)?
         (
-            l:LEN { noidlen.len = Integer.parseInt(l.getText()); }
+            l:LEN { noidlen.len = Long.parseLong(l.getText()); }
             (QUOTE)?
             (WHSP)?
             (RPAR)?

Modified: directory/shared/trunk/ldap/src/main/antlr/schema.g
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/antlr/schema.g?rev=948212&r1=948211&r2=948212&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/antlr/schema.g (original)
+++ directory/shared/trunk/ldap/src/main/antlr/schema.g Tue May 25 21:25:21 2010
@@ -222,7 +222,7 @@ options    {
     static class NoidLen
     {
         String noid = "";
-        int len = 0;
+        long len = 0L;
     }
     static class ElementTracker
     {

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java?rev=948212&r1=948211&r2=948212&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java (original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/schema/AttributeType.java Tue May 25 21:25:21 2010
@@ -192,7 +192,7 @@ public class AttributeType extends Abstr
     private UsageEnum usage = UsageEnum.USER_APPLICATIONS;
 
     /** the length of this attribute in bytes */
-    private int syntaxLength = 0;
+    private long syntaxLength = 0L;
 
 
     /**
@@ -739,7 +739,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.isSingleValued = singleValued;
@@ -769,7 +769,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.canUserModify = canUserModify;
@@ -799,7 +799,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         this.isCollective = collective;
     }
 
@@ -815,7 +815,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.isCollective = collective;
@@ -850,7 +850,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.usage = usage;
@@ -874,7 +874,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         this.usage = usage;
     }
 
@@ -884,7 +884,7 @@ public class AttributeType extends Abstr
      * 
      * @return the length of the attribute
      */
-    public int getSyntaxLength()
+    public long getSyntaxLength()
     {
         return syntaxLength;
     }
@@ -896,13 +896,13 @@ public class AttributeType extends Abstr
      * 
      * @param length the new length to set
      */
-    public void setSyntaxLength( int length )
+    public void setSyntaxLength( long length )
     {
         if ( locked )
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.syntaxLength = length;
@@ -961,7 +961,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.superiorOid = superiorOid;
@@ -980,7 +980,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.superior = superior;
@@ -1000,7 +1000,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.superiorOid = superiorOid;
@@ -1019,7 +1019,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         this.superior = superior;
         this.superiorOid = superior.getOid();
     }
@@ -1076,7 +1076,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.syntaxOid = syntaxOid;
@@ -1095,7 +1095,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.syntax = syntax;
@@ -1115,7 +1115,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         this.syntax = syntax;
         this.syntaxOid = syntax.getOid();
     }
@@ -1172,7 +1172,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.equalityOid = equalityOid;
@@ -1191,7 +1191,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.equality = equality;
@@ -1211,7 +1211,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         this.equality = equality;
         this.equalityOid = equality.getOid();
     }
@@ -1268,7 +1268,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.orderingOid = orderingOid;
@@ -1287,7 +1287,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.ordering = ordering;
@@ -1307,7 +1307,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         this.ordering = ordering;
         this.orderingOid = ordering.getOid();
     }
@@ -1364,7 +1364,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.substringOid = substrOid;
@@ -1383,7 +1383,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         if ( !isReadOnly )
         {
             this.substring = substring;
@@ -1403,7 +1403,7 @@ public class AttributeType extends Abstr
         {
             throw new UnsupportedOperationException( I18n.err( I18n.ERR_04441, getName() ) );
         }
-        
+
         this.substring = substring;
         this.substringOid = substring.getOid();
     }

Modified: directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java?rev=948212&r1=948211&r2=948212&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java (original)
+++ directory/shared/trunk/ldap/src/test/java/org/apache/directory/shared/ldap/schema/syntax/parser/AttributeTypeDescriptionSchemaParserTest.java Tue May 25 21:25:21 2010
@@ -20,21 +20,22 @@
 package org.apache.directory.shared.ldap.schema.syntax.parser;
 
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import java.text.ParseException;
 
+import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.UsageEnum;
 import org.apache.directory.shared.ldap.schema.parser.ConsoleParserMonitor;
-import org.apache.directory.shared.ldap.schema.AttributeType;
 import org.apache.directory.shared.ldap.schema.parsers.AttributeTypeDescriptionSchemaParser;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import static org.junit.Assert.fail;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 
 
 /**
@@ -135,12 +136,14 @@ public class AttributeTypeDescriptionSch
         // SUP descr, no space
         value = "(1.1 SYNTAX1.1 SUPabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789)";
         attributeType = parser.parseAttributeTypeDescription( value );
-        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType.getSuperiorOid() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType
+            .getSuperiorOid() );
 
         // SUP descr, newline
         value = "\t(\t1.1\tSYNTAX\t1.1\tSUP\tabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789\t)\t";
         attributeType = parser.parseAttributeTypeDescription( value );
-        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType.getSuperiorOid() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType
+            .getSuperiorOid() );
 
         // quoted SUP value
         value = "( 1.1 SYNTAX 1.1 SUP 'name' )";
@@ -220,12 +223,14 @@ public class AttributeTypeDescriptionSch
         // EQUALITY descr, no space
         value = "(1.1 SYNTAX1.1 EQUALITYabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789)";
         attributeType = parser.parseAttributeTypeDescription( value );
-        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType.getEqualityOid() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType
+            .getEqualityOid() );
 
         // EQUALITY descr, newline
         value = "\n(\n1.1\nSYNTAX\n1.1\nEQUALITY\nabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789\n)\n";
         attributeType = parser.parseAttributeTypeDescription( value );
-        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType.getEqualityOid() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType
+            .getEqualityOid() );
 
         // quoted value
         value = "( 1.1 SYNTAX 1.1 EQUALITY 'caseExcactMatch' )";
@@ -264,12 +269,14 @@ public class AttributeTypeDescriptionSch
         // ORDERING descr, no space
         value = "(1.1 SYNTAX1.1 ORDERINGabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789)";
         attributeType = parser.parseAttributeTypeDescription( value );
-        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType.getOrderingOid() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType
+            .getOrderingOid() );
 
         // ORDERING descr, newline
         value = "\r(\r1.1\rSYNTAX\r1.1\rORDERING\rabcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789\r)\r";
         attributeType = parser.parseAttributeTypeDescription( value );
-        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType.getOrderingOid() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType
+            .getOrderingOid() );
 
         // quoted value
         value = "( 1.1 SYNTAX 1.1 ORDERING 'generalizedTimeOrderingMatch' )";
@@ -357,7 +364,7 @@ public class AttributeTypeDescriptionSch
         attributeType = parser.parseAttributeTypeDescription( value );
         assertEquals( "1.2.3.4567.8.9.0", attributeType.getSyntaxOid() );
         assertEquals( 0, attributeType.getSyntaxLength() );
-        
+
         // quoted numericoid
         value = "( 1.1 SYNTAX '1.2.3.4567.8.9.0' )";
         attributeType = parser.parseAttributeTypeDescription( value );
@@ -443,17 +450,16 @@ public class AttributeTypeDescriptionSch
         }
 
         // length overflow
-        value = "( 1.1 SYNTAX 1.2.3.4{123456789012} )";
+        value = "( 1.1 SYNTAX 1.2.3.4{123456789012234567890} )";
         try
         {
             attributeType = parser.parseAttributeTypeDescription( value );
-            fail( "Exception expected, invalid SYNTAX 1.2.3.4{123456789012} (length overflow)" );
+            fail( "Exception expected, invalid SYNTAX 1.2.3.4{12345678901234567890} (length overflow)" );
         }
         catch ( NumberFormatException nfe )
         {
             // expected
         }
-
     }
 
 
@@ -660,11 +666,13 @@ public class AttributeTypeDescriptionSch
 
         assertEquals( "1.2.3.4.5.6.7.8.9.0", attributeType.getOid() );
         assertEquals( 2, attributeType.getNames().size() );
-        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType.getNames().get( 0 ) );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType.getNames().get(
+            0 ) );
         assertEquals( "test", attributeType.getNames().get( 1 ) );
         assertEquals( "Descripton \u00E4\u00F6\u00FC\u00DF \u90E8\u9577", attributeType.getDescription() );
         assertTrue( attributeType.isObsolete() );
-        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType.getSuperiorOid() );
+        assertEquals( "abcdefghijklmnopqrstuvwxyz-ABCDEFGHIJKLMNOPQRSTUVWXYZ-0123456789", attributeType
+            .getSuperiorOid() );
         assertEquals( "2.3.4.5.6.7.8.9.0.1", attributeType.getEqualityOid() );
         assertEquals( "3.4.5.6.7.8.9.0.1.2", attributeType.getOrderingOid() );
         assertEquals( "4.5.6.7.8.9.0.1.2.3", attributeType.getSubstringOid() );