directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r351916 - in /directory/shared/ldap/trunk/common/src: antlr/ main/java/org/apache/ldap/common/filter/ main/java/org/apache/ldap/common/message/ main/java/org/apache/ldap/common/schema/ main/java/org/apache/ldap/common/util/ test/org/apache/...
Date Sat, 03 Dec 2005 12:14:39 GMT
Author: elecharny
Date: Sat Dec  3 04:14:23 2005
New Revision: 351916

URL: http://svn.apache.org/viewcvs?rev=351916&view=rev
Log:
Fixed DirSnickers-116 :
- The toUtf8() method has been renamed to Utf8ToString()
- Javadoc correctd for getBytesUtf8 method

Modified:
    directory/shared/ldap/trunk/common/src/antlr/dnparser.g
    directory/shared/ldap/trunk/common/src/antlr/typelexer.g
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
    directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java
    directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
    directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/DnParserTest.java

Modified: directory/shared/ldap/trunk/common/src/antlr/dnparser.g
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/antlr/dnparser.g?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/antlr/dnparser.g (original)
+++ directory/shared/ldap/trunk/common/src/antlr/dnparser.g Sat Dec  3 04:14:23 2005
@@ -93,7 +93,12 @@
                 l_lhs = l_attr.getText() ;
                 m_valueParser.setOid(false) ;
             }
-        | l_oid:OID 
+        | l_oiddn:OIDDN
+            {
+                l_lhs = l_oiddn.getText().substring( "OID.".length() ) ;
+                m_valueParser.setOid(true) ;
+            }
+        | l_oid:OID
             {
                 l_lhs = l_oid.getText() ;
                 m_valueParser.setOid(true) ;

Modified: directory/shared/ldap/trunk/common/src/antlr/typelexer.g
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/antlr/typelexer.g?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/antlr/typelexer.g (original)
+++ directory/shared/ldap/trunk/common/src/antlr/typelexer.g Sat Dec  3 04:14:23 2005
@@ -38,7 +38,7 @@
 class antlrTypeLexer extends Lexer ;
 
 options {
-	k = 2 ;
+	k = 4 ;
     caseSensitive = false ;
 	importVocab = DnCommon ;
 	exportVocab = antlrType ;
@@ -108,6 +108,9 @@
                 // Public Tokens Returned By Lexer //
                 /////////////////////////////////////
 
+
+OIDDN                   : ( 'o' | 'O' ) ( 'i' | 'I' ) ( 'd' | 'D' ) '.' OID
+    ;
 
 OID                     : ( DIGIT )+ ( '.' ( DIGIT )+ )*
                           ( OPEN_BRACKET ( DIGIT )+ CLOSE_BRACKET )?

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/ExtensibleNode.java
Sat Dec  3 04:14:23 2005
@@ -123,7 +123,7 @@
         buf.append( "-EXTENSIBLE-" );
         buf.append( this.matchingRuleId );
         buf.append( "-" );
-        buf.append( StringUtils.toUtf8( this.value ) );
+        buf.append( StringUtils.Utf8ToString( this.value ) );
         buf.append( "/" );
         buf.append( StringUtils.dumpBytes( this.value ) );
         buf.append( ')' );

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/filter/SimpleNode.java
Sat Dec  3 04:14:23 2005
@@ -39,7 +39,7 @@
      */
     public SimpleNode( String attribute, byte[] value, int type )
     {
-        this( attribute, StringUtils.toUtf8( value ), type );
+        this( attribute, StringUtils.Utf8ToString( value ), type );
     }
 
     /**

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/BindRequestImpl.java
Sat Dec  3 04:14:23 2005
@@ -316,7 +316,7 @@
             if ( isSimple )
             {
                 sb.append( "        Simple authentication : '" )
-                  .append( StringUtils.toUtf8( credentials) )
+                  .append( StringUtils.Utf8ToString( credentials) )
                   .append('/')
                   .append( StringUtils.dumpBytes( credentials ) )
                   .append( "'\n" );
@@ -329,7 +329,7 @@
                 .append( "'\n" );
                 
                 sb.append( "            Credentials : '" )
-                .append( StringUtils.toUtf8( credentials) )
+                .append( StringUtils.Utf8ToString( credentials) )
                 .append('/')
                 .append( StringUtils.dumpBytes( credentials ) )
                 .append( "'\n" );

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/CompareRequestImpl.java
Sat Dec  3 04:14:23 2005
@@ -104,7 +104,7 @@
      */
     public String getAssertionValue()
     {
-    	return StringUtils.toUtf8( attrVal );
+    	return StringUtils.Utf8ToString( attrVal );
     }
 
     /**
@@ -271,7 +271,7 @@
         sb.append( "        Attribute description : '" ).append( attrId ).append(
             "'\n" );
         sb.append( "        Attribute value : '" ).
-        	append( StringUtils.toUtf8( attrVal ) ).
+        	append( StringUtils.Utf8ToString( attrVal ) ).
         	append( '/' ).
         	append( StringUtils.dumpBytes( attrVal ) ).
             append( "'\n" );

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ExtendedRequestImpl.java
Sat Dec  3 04:14:23 2005
@@ -199,7 +199,7 @@
         if ( oid != null )
         {
             sb.append( "        Request value : '" ).
-            	append( StringUtils.toUtf8( payload ) ).
+            	append( StringUtils.Utf8ToString( payload ) ).
             	append( '/' ).
             	append( StringUtils.dumpBytes( payload ) ).
             	append( "'\n" );

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/message/ModifyRequestImpl.java
Sat Dec  3 04:14:23 2005
@@ -270,7 +270,7 @@
 	        	{
                     if (value instanceof byte[] )
                     {
-                        String sValue = StringUtils.toUtf8( (byte[])value );
+                        String sValue = StringUtils.Utf8ToString( (byte[])value );
                         
                         if ( attrHash0.contains( sValue ) == false )
                         {
@@ -359,7 +359,7 @@
 
                         if ( attributeValue instanceof byte[] )
                         {
-                        	sb.append( StringUtils.toUtf8( (byte[])attributeValue ) ).
+                        	sb.append( StringUtils.Utf8ToString( (byte[])attributeValue ) ).
                     			append( '/' ).append( StringUtils.dumpBytes( (byte[])attributeValue
) );
                         }
                         else if ( attributeValue instanceof String )

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimNormalizer.java
Sat Dec  3 04:14:23 2005
@@ -42,7 +42,7 @@
         
         if ( value instanceof byte[] )
         {
-            return StringTools.deepTrim( StringUtils.toUtf8( (byte[])value ) );
+            return StringTools.deepTrim( StringUtils.Utf8ToString( (byte[])value ) );
         }
         else
         {

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/schema/DeepTrimToLowerNormalizer.java
Sat Dec  3 04:14:23 2005
@@ -43,7 +43,7 @@
         
         if ( value instanceof byte[] )
         {
-            return StringTools.deepTrimToLower( StringUtils.toUtf8( (byte[])value ) );
+            return StringTools.deepTrimToLower( StringUtils.Utf8ToString( (byte[])value )
);
         }
         else
         {

Modified: directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java
(original)
+++ directory/shared/ldap/trunk/common/src/main/java/org/apache/ldap/common/util/AttributeUtils.java
Sat Dec  3 04:14:23 2005
@@ -254,7 +254,7 @@
                     }
                     else if (attr instanceof byte[] )
                     {
-                        String string = StringUtils.toUtf8( (byte[])attr );
+                        String string = StringUtils.Utf8ToString( (byte[])attr );
                         
                         sb.append( tabs ).append( "        Val[" ).append( j ).append( "]
: " );
                         sb.append( string ).append( '/');

Modified: directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
(original)
+++ directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/filter/FilterParserImplTest.java
Sat Dec  3 04:14:23 2005
@@ -179,7 +179,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( ou :dn :stupidMatch :=
dummyAssertion\\23\\ac )" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertTrue( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -190,7 +190,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( 1.2.3.4 :dn :1.3434.23.2
:= dummyAssertion\\23\\ac )" );
         assertEquals( "1.2.3.4", node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertTrue( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -201,7 +201,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( ou :stupidMatch := dummyAssertion\\23\\ac
)" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -228,7 +228,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( ou := dummyAssertion\\23\\ac
)" );
         assertEquals( "ou", node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( null, node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -239,7 +239,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( 1.2.3.4 :1.3434.23.2 :=
dummyAssertion\\23\\ac )" );
         assertEquals( "1.2.3.4", node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -250,7 +250,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( :dn :stupidMatch := dummyAssertion\\23\\ac
)" );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertTrue( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -277,7 +277,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( :dn :1.3434.23.2 := dummyAssertion\\23\\ac
)" );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertTrue( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -288,7 +288,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( :stupidMatch := dummyAssertion\\23\\ac
)" );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( "stupidMatch", node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -299,7 +299,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( :1.3434.23.2 := dummyAssertion\\23\\ac
)" );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( "1.3434.23.2", node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -310,7 +310,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( := dummyAssertion )" );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion", StringUtils.Utf8ToString( node.getValue() ) );
         assertEquals( null, node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );
@@ -321,7 +321,7 @@
     {
         ExtensibleNode node = ( ExtensibleNode ) parser.parse( "( := dummyAssertion\\23\\ac
)" );
         assertEquals( null, node.getAttribute() );
-        assertEquals( "dummyAssertion\\23\\ac", StringUtils.toUtf8( node.getValue() ) );
+        assertEquals( "dummyAssertion\\23\\ac", StringUtils.Utf8ToString( node.getValue()
) );
         assertEquals( null, node.getMatchingRuleId() );
         assertFalse( node.dnAttributes() );
         assertEquals( AbstractExprNode.EXTENSIBLE, node.getAssertionType() );

Modified: directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/DnParserTest.java
URL: http://svn.apache.org/viewcvs/directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/DnParserTest.java?rev=351916&r1=351915&r2=351916&view=diff
==============================================================================
--- directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/DnParserTest.java
(original)
+++ directory/shared/ldap/trunk/common/src/test/org/apache/ldap/common/name/DnParserTest.java
Sat Dec  3 04:14:23 2005
@@ -21,7 +21,9 @@
 import javax.naming.Name;
 import javax.naming.NamingException;
 
+import junit.framework.Assert;
 import junit.framework.TestCase;
+
 import org.apache.ldap.common.schema.DnNormalizer;
 
 
@@ -128,6 +130,13 @@
 
     }
 
+    public void testVsldapExtras() throws Exception
+    {
+    	DnParser dnParser = new DnParser();
+        Name name = dnParser.parse( "cn=Billy Bakers, OID.2.5.4.11=Corporate Tax, ou=Fin-Accounting,
ou=Americas, ou=Search, o=IMC, c=US" );
+        
+        Assert.assertEquals( "cn=Billy Bakers,2.5.4.11=Corporate Tax,ou=Fin-Accounting,ou=Americas,ou=Search,o=IMC,c=US",
name.toString() );
+    }
 
     /**
      * Class under test for Name parse(String)



Mime
View raw message