directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r432590 - /directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java
Date Fri, 18 Aug 2006 14:09:45 GMT
Author: akarasulu
Date: Fri Aug 18 07:09:45 2006
New Revision: 432590

URL: http://svn.apache.org/viewvc?rev=432590&view=rev
Log:
applying second set of patches for DIRSERVER-612

Modified:
    directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java

Modified: directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java?rev=432590&r1=432589&r2=432590&view=diff
==============================================================================
--- directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java
(original)
+++ directory/branches/apacheds/1.0/server-tools/src/main/java/org/apache/directory/server/tools/DumpCommand.java
Fri Aug 18 07:09:45 2006
@@ -145,49 +145,18 @@
 
             filterAttributes( dn, entry );
 
-            if ( !( entry instanceof LockableAttributesImpl ) )
+            buf.append( "# Entry: " ).append( id ).append( "\n#---------------------\n\n"
);
+            if ( !LdifUtils.isLDIFSafe( dn ) )
             {
-                Attributes tmp = entry;
-                entry = new LockableAttributesImpl();
-                NamingEnumeration attrs = tmp.getAll();
-                while ( attrs.hasMore() )
-                {
-                    Attribute attr = ( Attribute ) attrs.next();
-                    LockableAttributeImpl myattr = new LockableAttributeImpl( attr.getID()
);
-                    entry.put( myattr );
-                    for ( int ii = 0; ii < attr.size(); ii++ )
-                    {
-                    	Object value = attr.get(ii);
-                        
-                        // Checking if the value is binary
-                        if ( value instanceof byte[] )
-                        {
-                        	// It is binary, so we have to encode it using Base64 before adding
it
-                        	char[] encoded = Base64.encode( ( byte[] ) value );
-                        	
-                        	myattr.add( new String( encoded ) );                        	
-                        }
-                        else if ( value instanceof String )
-                        {
-                        	// It's a String but, we have to check if encoding isn't required
-                        	String str = (String) value;
-                        	if ( !LdifUtils.isLDIFSafe( str ) )
-                        	{
-                        		char[] encoded = Base64.encode( ( ( String ) value ).getBytes()
);
-                        		
-                        		myattr.add( new String( encoded ) );
-                        	}
-                        	else
-                        	{
-                        		myattr.add( value );
-                        	}
-                        }
-                    }
-                }
-            }
+            	// If the DN isn't LdifSafe, it needs to be Base64 encoded.
 
-            buf.append( "# Entry: " ).append( id ).append( "\n#---------------------\n\n"
);
-            buf.append( "dn: " ).append( dn ).append( "\n" ).append( entry );
+                buf.append( "dn:: " ).append( new String( Base64.encode( dn.getBytes() )
) );
+            }
+            else
+            {
+                buf.append( "dn: " ).append( dn );
+            }
+            buf.append( "\n" ).append( LdifUtils.convertToLdif( entry ) );
             if ( list.hasMore() )
             {
                 buf.append( "\n\n#---------------------\n" );



Mime
View raw message