From 65cf071e6e7a15eb81c7d8f9fa2984c9de74b10e Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Fri, 25 Jun 2010 09:47:13 +0000
Subject: [PATCH] This fix resolves an issue with replication between Windows and Unix systems. The GenerationID was different on the systems for the same input due to differences in line separators and an inappropriate exception handling.

---
 opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java |   16 +++++++---------
 1 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index e406d54..b52a8f1 100644
--- a/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opends/src/server/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -61,7 +61,6 @@
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
-import java.util.zip.CheckedOutputStream;
 import java.util.zip.DataFormatException;
 
 import org.opends.messages.Message;
@@ -3962,8 +3961,8 @@
   {
     long genID = 0;
     Backend backend = retrievesBackend(this.baseDn);
-    long bec = backend.numSubordinates(baseDn, true) + 1;
-    long entryCount = (bec<1000?bec:1000);
+    long numberOfEntries = backend.numSubordinates(baseDn, true) + 1;
+    long entryCount = ( (numberOfEntries < 1000 )? numberOfEntries : 1000);
 
     //  Acquire a shared lock for the backend.
     try
@@ -3989,16 +3988,16 @@
           ResultCode.OTHER, message, null);
     }
 
-    OutputStream os;
+    OutputStream os = null;
     ReplLDIFOutputStream ros = null;
 
     if (checksumOutput)
     {
-      ros = new ReplLDIFOutputStream(this, entryCount);
-      os = new CheckedOutputStream(ros, new GenerationIdChecksum());
+      os = (OutputStream)new ReplLDIFOutputStream(entryCount);
+      ros = (ReplLDIFOutputStream)os;
       try
       {
-        os.write((Long.toString(backend.numSubordinates(baseDn, true) + 1)).
+        os.write((Long.toString(numberOfEntries)).
             getBytes());
       }
       catch(Exception e)
@@ -4074,8 +4073,7 @@
 
       if (checksumOutput)
       {
-        genID =
-         ((CheckedOutputStream)os).getChecksum().getValue();
+        genID = ros.getChecksumValue();
       }
 
       //  Release the shared lock on the backend.

--
Gitblit v1.10.0