From 7b44fa6b33c5441b25e900fb906e280641ce3737 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 24 Apr 2015 09:14:28 +0000
Subject: [PATCH] (CR-6756) Fixed IllegalArgumentException when import triggers index entry limits

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
index 537299a..f3669b8 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java
@@ -811,8 +811,6 @@
   /**
    * Rebuild the indexes using the specified root container.
    *
-   * @param rootContainer
-   *          The root container to rebuild indexes in.
    * @throws ConfigException
    *           If a configuration error occurred.
    * @throws InitializationException
@@ -895,8 +893,6 @@
   /**
    * Import a LDIF using the specified root container.
    *
-   * @param rootContainer
-   *          The root container to use during the import.
    * @return A LDIF result.
    * @throws Exception
    *           If the import failed
@@ -2319,11 +2315,13 @@
    */
   private final class ScratchFileWriterTask implements Callable<Void>
   {
-    private final int DRAIN_TO = 3;
+    private static final int DRAIN_TO = 3;
+
     private final IndexManager indexMgr;
     private final BlockingQueue<IndexOutputBuffer> queue;
     /** Stream where to output insert ImportIDSet data. */
     private final ByteArrayOutputStream insertByteStream = new ByteArrayOutputStream(2 * bufferSize);
+    private final DataOutputStream insertByteDataStream = new DataOutputStream(insertByteStream);
     /** Stream where to output delete ImportIDSet data. */
     private final ByteArrayOutputStream deleteByteStream = new ByteArrayOutputStream(2 * bufferSize);
     private final DataOutputStream bufferStream;
@@ -2530,7 +2528,7 @@
         // special handling when index entry limit has been exceeded
         insertKeyCount = 1;
         insertByteStream.reset();
-        insertByteStream.write(-1);
+        insertByteDataStream.writeLong(IndexInputBuffer.UNDEFINED_SIZE);
       }
 
       int insertSize = INT_SIZE;
@@ -3695,8 +3693,7 @@
     public String toString()
     {
       return getClass().getSimpleName()
-          + "(attributeType=" + attributeType
-          + ", indexID=" + indexID
+          + "(index=" + attributeType.getNameOrOID() + "." + indexID
           + ", entryLimit=" + entryLimit
           + ")";
     }

--
Gitblit v1.10.0