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-cli/src/main/java/com/forgerock/opendj/cli/IntegerArgument.java | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/IntegerArgument.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/IntegerArgument.java
index a17cb12..0bb59d9 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/IntegerArgument.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/IntegerArgument.java
@@ -13,6 +13,7 @@
*
* Copyright 2006-2010 Sun Microsystems, Inc.
* Portions copyright 2014-2016 ForgeRock AS.
+ * Portions Copyright 2026 3A Systems, LLC.
*/
package com.forgerock.opendj.cli;
@@ -105,6 +106,25 @@
}
/**
+ * Returns the default value of this argument as an int.
+ * <p>
+ * The default value of an integer argument is always built from an {@code int}, so the only
+ * reason for this method to return the fallback value is that this argument has no default
+ * value at all.
+ *
+ * @param fallbackValue
+ * The value to return if this argument does not have a default value.
+ * @return The default value of this argument, or {@code fallbackValue} if it does not have one.
+ */
+ public int getDefaultIntValue(final int fallbackValue) {
+ try {
+ return Integer.parseInt(getDefaultValue());
+ } catch (final NumberFormatException e) {
+ return fallbackValue;
+ }
+ }
+
+ /**
* Indicates whether the provided value is acceptable for use in this
* argument.
*
--
Gitblit v1.10.0