From 4c7057e45ba8a2f3bc1f0b02b3edf14886fd1956 Mon Sep 17 00:00:00 2001
From: Valery Kharseko <vharseko@3a-systems.ru>
Date: Tue, 04 Aug 2026 08:31:56 +0000
Subject: [PATCH] Fix CodeQL note-severity alerts: uncaught NumberFormatException in the tools, the GUI and SNMP (#829)

---
 opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java b/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
index ced85e0..0fe9db3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/tools/WaitForFileDelete.java
@@ -13,6 +13,7 @@
  *
  * Copyright 2006-2009 Sun Microsystems, Inc.
  * Portions Copyright 2013-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
  */
 package org.opends.server.tools;
 
@@ -287,9 +288,11 @@
     }
     // Figure out when to stop waiting.
     long stopWaitingTime;
+    int timeoutSeconds;
     try
     {
-      long timeoutMillis = 1000L * Integer.parseInt(timeout.getValue());
+      timeoutSeconds = Integer.parseInt(timeout.getValue());
+      long timeoutMillis = 1000L * timeoutSeconds;
       if (timeoutMillis > 0)
       {
         stopWaitingTime = System.currentTimeMillis() + timeoutMillis;
@@ -302,6 +305,7 @@
     catch (Exception e)
     {
       // This shouldn't happen, but if it does then ignore it.
+      timeoutSeconds = 60;
       stopWaitingTime = System.currentTimeMillis() + 60000;
     }
 
@@ -357,9 +361,7 @@
 
     if (targetFile.exists())
     {
-      println(ERR_TIMEOUT_DURING_STARTUP.get(
-          Integer.parseInt(timeout.getValue()),
-          timeout.getLongIdentifier()));
+      println(ERR_TIMEOUT_DURING_STARTUP.get(timeoutSeconds, timeout.getLongIdentifier()));
       return EXIT_CODE_TIMEOUT;
     }
     else

--
Gitblit v1.10.0