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 2011/09/05 00:57:55 UTC

svn commit: r1165126 - in /directory/apacheds/trunk: protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java service/src/main/java/org/apache/directory/server/ApacheDsService.java

Author: elecharny
Date: Sun Sep  4 22:57:54 2011
New Revision: 1165126

URL: http://svn.apache.org/viewvc?rev=1165126&view=rev
Log:
Padding the replicaId with 0 at the beginning

Modified:
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java
    directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java?rev=1165126&r1=1165125&r2=1165126&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapProtocolUtils.java Sun Sep  4 22:57:54 2011
@@ -20,6 +20,7 @@
 package org.apache.directory.server.ldap;
 
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.directory.server.core.interceptor.context.OperationContext;
 import org.apache.directory.shared.ldap.model.csn.Csn;
 import org.apache.directory.shared.ldap.model.message.Request;
@@ -83,7 +84,8 @@ public class LdapProtocolUtils
     {
         // the syncrepl cookie format (compatible with OpenLDAP)
         // rid=nn,csn=xxxz
-        return Strings.getBytesUtf8( REPLICA_ID_PREFIX + replicaId + COOKIE_DELIM + CSN_PREFIX + csn );
+        String replicaIdStr = StringUtils.leftPad( Integer.toString( replicaId ), 3, '0' );
+        return Strings.getBytesUtf8( REPLICA_ID_PREFIX + replicaIdStr + COOKIE_DELIM + CSN_PREFIX + csn );
     }
 
 
@@ -152,6 +154,7 @@ public class LdapProtocolUtils
     public static int getReplicaId( String cookieString )
     {
         String replicaId = cookieString.substring( REPLICA_ID_PREFIX_LEN, cookieString.indexOf( COOKIE_DELIM ) );
+        
         return Integer.parseInt( replicaId );
     }
 }

Modified: directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java?rev=1165126&r1=1165125&r2=1165126&view=diff
==============================================================================
--- directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java (original)
+++ directory/apacheds/trunk/service/src/main/java/org/apache/directory/server/ApacheDsService.java Sun Sep  4 22:57:54 2011
@@ -105,20 +105,27 @@ public class ApacheDsService
     /** The Kerberos server instance */
     private KdcServer kdcServer;
 
+    /** The started HttpServer */
     private HttpServer httpServer;
 
+    /** The Schema partition */
     private LdifPartition schemaLdifPartition;
 
+    /** The SchemaManager instance */
     private SchemaManager schemaManager;
 
+    /** The configuration partition */
     private SingleFileLdifPartition configPartition;
 
+    /** The configuration reader instance */
     private ConfigPartitionReader cpReader;
 
     // variables used during the initial startup to update the mandatory operational
     // attributes
+    /** The UUID syntax checker instance */
     private UuidSyntaxChecker uuidChecker = new UuidSyntaxChecker();
 
+    /** The CSN syntax checker instance */
     private CsnSyntaxChecker csnChecker = new CsnSyntaxChecker();
 
     private GeneralizedTimeSyntaxChecker timeChecker = new GeneralizedTimeSyntaxChecker();