From 4c64fa4aa80953d8c28de98d30622f9b820bec40 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 22 Sep 2026 09:22:48 +0000
Subject: [PATCH] [#1026] Close the import config on every path an import task can end on (#1028)
---
opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
index aaebe55..779a8e1 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tasks/ImportTask.java
@@ -617,6 +617,14 @@
catch (Exception e)
{
logger.error(ERR_LDIFIMPORT_CANNOT_OPEN_SKIP_FILE, skipFile, getExceptionMessage(e));
+ /*
+ * The reject file is already open and this return is the one which is above the try
+ * whose finally closes it. The two files are not opened inside that try instead: a
+ * listener told an import began puts back what it took offline when it is told the
+ * import ended - a replication domain reloads and rewinds its state - and an import
+ * which never reached a backend has nothing for it to put back.
+ */
+ importConfig.close();
return TaskState.STOPPED_BY_ERROR;
}
}
@@ -720,6 +728,11 @@
}
finally
{
+ // Close the LDIF reader and the reject and skip files whichever way the import ended.
+ // The backend closes them with its reader, but an import which fails before that reader
+ // exists - or before the import is even launched - leaves them to this task.
+ importConfig.close();
+
// Enable the backend, if it was this task which disabled it.
boolean backendLeftDisabled = false;
if (backendDisabled)
@@ -748,8 +761,6 @@
}
}
- // Clean up after the import by closing the import config.
- importConfig.close();
return getFinalTaskState();
}
--
Gitblit v1.10.0