mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Yannick Lecaillez
05.41.2015 a1b24afbc5101b30682f60f162871c0604c36fa6
OPENDJ-2387: Include (-I) & exclude entries (-E) options are ignored
during import-ldif.
1 files modified
23 ■■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ImportLDIFReader.java 23 ●●●●● patch | view | raw | blame | history
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())