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-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
index bd119ef..fde226f 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
@@ -13,6 +13,7 @@
  *
  * Copyright 2010 Sun Microsystems, Inc.
  * Portions Copyright 2011-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
  */
 package com.forgerock.opendj.ldap.tools;
 
@@ -481,13 +482,18 @@
 
     double[] getPercentiles() {
         if (percentilesArgument.isPresent()) {
-            double[] percentiles = new double[percentilesArgument.getValues().size()];
-            int index = 0;
-            for (final String percentile : percentilesArgument.getValues()) {
-                percentiles[index++] = Double.parseDouble(percentile);
+            try {
+                final double[] percentiles = new double[percentilesArgument.getValues().size()];
+                int index = 0;
+                for (final String percentile : percentilesArgument.getValues()) {
+                    percentiles[index++] = Double.parseDouble(percentile);
+                }
+                Arrays.sort(percentiles);
+                return percentiles;
+            } catch (final NumberFormatException e) {
+                // The argument parser only accepts integers in the [0, 100] range, so this cannot
+                // happen. Fall back to the default percentiles rather than failing the run.
             }
-            Arrays.sort(percentiles);
-            return percentiles;
         }
 
         return DEFAULT_PERCENTILES;

--
Gitblit v1.10.0