From a1b24afbc5101b30682f60f162871c0604c36fa6 Mon Sep 17 00:00:00 2001
From: Yannick Lecaillez <ylecaillez@forgerock.com>
Date: Fri, 06 Nov 2015 17:11:46 +0000
Subject: [PATCH] OPENDJ-2387: Include (-I) & exclude entries (-E) options are ignored during import-ldif.
---
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ImportLDIFReader.java | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ImportLDIFReader.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ImportLDIFReader.java
index 18d6348..b6c5987 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ImportLDIFReader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ImportLDIFReader.java
@@ -190,6 +190,7 @@
// Create the entry and see if it is one that should be included in the import
final Entry entry = createEntry(lines, entryDN, checkSchema);
if (entry == null
+ || !isIncludedInImport(entry, lines)
|| !invokeImportPlugins(entry, lines)
|| (checkSchema && !isValidAgainstSchema(entry, lines)))
{
@@ -229,6 +230,28 @@
return entry;
}
+ private boolean isIncludedInImport(Entry entry, LinkedList<StringBuilder> entryLines)
+ {
+ final DN entryDN = entry.getName();
+ try
+ {
+ if (!importConfig.includeEntry(entry))
+ {
+ logger.trace("Skipping entry %s because the DN is not one that "
+ + "should be included based on the include and exclude filters.", entryDN);
+ logToSkipWriter(entryLines, ERR_LDIF_SKIP.get(entryDN));
+ return false;
+ }
+ return true;
+ }
+ catch (Exception e)
+ {
+ logToSkipWriter(entryLines,
+ ERR_LDIF_COULD_NOT_EVALUATE_FILTERS_FOR_IMPORT.get(entryDN, lastEntryLineNumber, e));
+ return false;
+ }
+ }
+
private boolean invokeImportPlugins(final Entry entry, LinkedList<StringBuilder> lines)
{
if (importConfig.invokeImportPlugins())
--
Gitblit v1.10.0