From 76159518846a6aee0d205624b00f93a83f4aeff2 Mon Sep 17 00:00:00 2001
From: Fabio Pistolesi <fabio.pistolesi@forgerock.com>
Date: Wed, 17 Jun 2015 09:49:32 +0000
Subject: [PATCH] OPENDJ-2148 CR-7287 "NullPointerException" when running import-ldif online with exclude branch

---
 opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java b/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
index 159926e..168fecf 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/Backend.java
@@ -975,6 +975,22 @@
   }
 
   /**
+   * Returns if <tt>exclude</tt> contains at least a DN or <tt>include</tt> contains anything else than one of
+   * <tt>baseDNs</tt>.
+   *
+   * @param baseDNs the baseDNs of a backend
+   * @param includeBranches a set of include DNs
+   * @param excludeBranches a set of exclude DNs
+   * @return true if <tt>exclude</tt> contains at least a DN or <tt>include</tt> contains anything else than one of
+   *         <tt>baseDNs</tt>
+   */
+  public static boolean importIncludesOrExcludesBranches(Collection<DN> baseDNs, Collection<DN> includeBranches,
+      Collection<DN> excludeBranches)
+  {
+    return !excludeBranches.isEmpty() || includeBranches.size() != 1 || !baseDNs.containsAll(includeBranches);
+  }
+
+  /**
    * Indicates whether a backend should be used to handle operations
    * for the provided entry given the set of base DNs and exclude DNs.
    *

--
Gitblit v1.10.0