From 7af51501d5a70e6cdff45d7c1c804f0e820d1d3a Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 04 Aug 2026 11:53:39 +0000
Subject: [PATCH] Fix CodeQL note-severity alerts: Thread.run() calls and getters leaking internal state (#847)

---
 opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
index b80f5d4..548cb3c 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
@@ -582,10 +582,20 @@
      * Retrieves the set of unnamed trailing arguments that were provided on the
      * command line.
      *
-     * @return The set of unnamed trailing arguments that were provided on the
+     * @return A copy of the set of unnamed trailing arguments that were provided on the
      *         command line.
      */
     public ArrayList<String> getTrailingArguments() {
+        return new ArrayList<>(trailingArguments);
+    }
+
+    /**
+     * Returns the live list of unnamed trailing arguments, so that a sub-class parsing the
+     * command line can fill it in. Unlike {@link #getTrailingArguments()}, this does not copy.
+     *
+     * @return The list of unnamed trailing arguments held by this parser.
+     */
+    List<String> trailingArguments() {
         return trailingArguments;
     }
 

--
Gitblit v1.10.0