From a873d6d0b57a360b7ff038cf6aac11e8e7369cfa Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 13 May 2015 09:00:40 +0000
Subject: [PATCH] ImportStrategy.java: In importLDIF(), added InitializationException as a checked exception.

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/Importer.java |   34 +++++++++++-----------------------
 1 files changed, 11 insertions(+), 23 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 83413c2..f9464a5 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
@@ -144,18 +144,18 @@
 
     @Override
     public LDIFImportResult importLDIF(LDIFImportConfig importConfig, RootContainer rootContainer,
-        ServerContext serverContext) throws DirectoryException
+        ServerContext serverContext) throws DirectoryException, InitializationException
     {
       try
       {
         return new Importer(rootContainer, importConfig, backendCfg, serverContext).processImport();
       }
-      catch (DirectoryException e)
+      catch (DirectoryException | InitializationException e)
       {
         logger.traceException(e);
         throw e;
       }
-      catch (InitializationException | ConfigException e)
+      catch (ConfigException e)
       {
         logger.traceException(e);
         throw new DirectoryException(getServerErrorResultCode(), e.getMessageObject(), e);
@@ -640,8 +640,7 @@
     }
   }
 
-  private void initializeSuffixes(WriteableTransaction txn) throws StorageRuntimeException,
-      ConfigException
+  private void initializeSuffixes(WriteableTransaction txn) throws ConfigException, DirectoryException
   {
     for (EntryContainer ec : rootContainer.getEntryContainers())
     {
@@ -683,7 +682,7 @@
   }
 
   private Suffix getSuffix(WriteableTransaction txn, EntryContainer entryContainer)
-      throws ConfigException
+      throws ConfigException, DirectoryException
   {
     DN baseDN = entryContainer.getBaseDN();
     EntryContainer sourceEntryContainer = null;
@@ -754,34 +753,23 @@
             && includeBranches.get(0).equals(baseDN))
         {
           // This entire base DN is explicitly included in the import with
-          // no exclude branches that we need to migrate. Just clear the entry
-          // container.
+          // no exclude branches that we need to migrate.
+          // Just clear the entry container.
           clearSuffix(entryContainer);
         }
         else
         {
-          // Create a temp entry container
           sourceEntryContainer = entryContainer;
-          entryContainer = createEntryContainer(txn, baseDN);
+
+          // Create a temp entry container
+          DN tempDN = baseDN.child(DN.valueOf("dc=importTmp"));
+          entryContainer = rootContainer.openEntryContainer(tempDN, txn);
         }
       }
     }
     return new Suffix(entryContainer, sourceEntryContainer, includeBranches, excludeBranches);
   }
 
-  private EntryContainer createEntryContainer(WriteableTransaction txn, DN baseDN) throws ConfigException
-  {
-    try
-    {
-      DN tempDN = baseDN.child(DN.valueOf("dc=importTmp"));
-      return rootContainer.openEntryContainer(tempDN, txn);
-    }
-    catch (DirectoryException e)
-    {
-      throw new ConfigException(e.getMessageObject());
-    }
-  }
-
   private static void clearSuffix(EntryContainer entryContainer)
   {
     entryContainer.lock();

--
Gitblit v1.10.0