directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r797086 - in /directory: apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/ shared/trunk/ldap/src/main/java/org/apache/directory/sh...
Date Thu, 23 Jul 2009 14:37:42 GMT
Author: pamarcelot
Date: Thu Jul 23 14:37:41 2009
New Revision: 797086

URL: http://svn.apache.org/viewvc?rev=797086&view=rev
Log:
Fix for DIRSERVER-1381 (problem using apacheds-tools.jar : ClassCastException during import).

Modified:
    directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
    directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java
    directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestCodec.java

Modified: directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java?rev=797086&r1=797085&r2=797086&view=diff
==============================================================================
--- directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
(original)
+++ directory/apacheds/trunk/server-tools/src/main/java/org/apache/directory/server/tools/ImportCommand.java
Thu Jul 23 14:37:41 2009
@@ -669,7 +669,7 @@
             long t1 = System.currentTimeMillis();
 
             System.out.println( "Done!" );
-            System.out.println( nbAdd + " users added in " + ( ( t1 - t0 ) / 1000 ) + " seconds"
);
+            System.out.println( nbAdd + " entries added in " + ( ( t1 - t0 ) / 1000 ) + "
seconds" );
         }
         else
         {
@@ -718,7 +718,7 @@
             long t1 = System.currentTimeMillis();
 
             System.out.println( "Done!" );
-            System.out.println( nbMod + " users changed in " + ( ( t1 - t0 ) / 1000 ) + "
seconds" );
+            System.out.println( nbMod + " entries changed in " + ( ( t1 - t0 ) / 1000 ) +
" seconds" );
         }
 
         // Logout to the server

Modified: directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java?rev=797086&r1=797085&r2=797086&view=diff
==============================================================================
--- directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
(original)
+++ directory/shared/trunk/dsml-parser/src/main/java/org/apache/directory/shared/dsmlv2/request/AddRequestDsml.java
Thu Jul 23 14:37:41 2009
@@ -160,7 +160,18 @@
      */
     public void addAttributeValue( Object value )
     {
-        ( ( AddRequestCodec ) instance ).addAttributeValue( value );
+        if ( value instanceof Value<?> )
+        {
+            ( ( AddRequestCodec ) instance ).addAttributeValue( ( Value<?> ) value
);
+        }
+        else if ( value instanceof String )
+        {
+            ( ( AddRequestCodec ) instance ).addAttributeValue( ( String ) value );
+        }
+        else if ( value instanceof byte[] )
+        {
+            ( ( AddRequestCodec ) instance ).addAttributeValue( ( byte[] ) value );
+        }
     }
 
 

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java?rev=797086&r1=797085&r2=797086&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/actions/ValueAction.java
Thu Jul 23 14:37:41 2009
@@ -46,11 +46,13 @@
     /** Speedup for logs */
     private static final boolean IS_DEBUG = log.isDebugEnabled();
 
+
     public ValueAction()
     {
         super( "Store a value" );
     }
 
+
     /**
      * The initialization action
      */
@@ -80,15 +82,21 @@
                 {
                     log.debug( "Adding value {}", StringTools.dumpBytes( ( byte[] ) value
) );
                 }
+
+                addRequest.addAttributeValue( ( byte[] ) value );
             }
             else
             {
                 value = StringTools.utf8ToString( tlv.getValue().getData() );
 
-                log.debug( "Adding value {}" + value );
+                if ( IS_DEBUG )
+                {
+                    log.debug( "Adding value {}" + value );
+                }
+
+                addRequest.addAttributeValue( ( String ) value );
             }
 
-            addRequest.addAttributeValue( value );
         }
 
         // We can have an END transition

Modified: directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestCodec.java
URL: http://svn.apache.org/viewvc/directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestCodec.java?rev=797086&r1=797085&r2=797086&view=diff
==============================================================================
--- directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestCodec.java
(original)
+++ directory/shared/trunk/ldap/src/main/java/org/apache/directory/shared/ldap/codec/add/AddRequestCodec.java
Thu Jul 23 14:37:41 2009
@@ -176,18 +176,33 @@
     /**
      * Add a new value to the current attribute
      * 
-     * @param value The value to be added
+     * @param value The value to add
      */
-    public void addAttributeValue( Object value )
+    public void addAttributeValue( String value )
     {
-        if ( value instanceof String )
-        {
-            currentAttribute.add( ( String ) value );
-        }
-        else
-        {
-            currentAttribute.add( ( byte[] ) value );
-        }
+        currentAttribute.add( value );
+    }
+
+
+    /**
+     * Add a new value to the current attribute
+     * 
+     * @param value The value to add
+     */
+    public void addAttributeValue( org.apache.directory.shared.ldap.entry.Value<?>
value )
+    {
+        currentAttribute.add( value );
+    }
+
+
+    /**
+     * Add a new value to the current attribute
+     * 
+     * @param value The value to add
+     */
+    public void addAttributeValue( byte[] value )
+    {
+        currentAttribute.add( value );
     }
 
 



Mime
View raw message