This is an automated email from the ASF dual-hosted git repository. lprimak pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/shiro.git
commit 93961833be5af6276534dfe5e0505c1e97cf826f Author: lprimak <[email protected]> AuthorDate: Thu Apr 30 19:51:18 2026 -0500 chore: fixed deprecated methods in Hasher --- .../src/main/java/org/apache/shiro/tools/hasher/Hasher.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tools/hasher/src/main/java/org/apache/shiro/tools/hasher/Hasher.java b/tools/hasher/src/main/java/org/apache/shiro/tools/hasher/Hasher.java index 7d177689b..d19fe5f0d 100644 --- a/tools/hasher/src/main/java/org/apache/shiro/tools/hasher/Hasher.java +++ b/tools/hasher/src/main/java/org/apache/shiro/tools/hasher/Hasher.java @@ -21,9 +21,9 @@ package org.apache.shiro.tools.hasher; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.DefaultParser; -import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.Option; import org.apache.commons.cli.Options; +import org.apache.commons.cli.help.HelpFormatter; import org.apache.shiro.authc.credential.DefaultPasswordService; import org.apache.shiro.crypto.SecureRandomNumberGenerator; import org.apache.shiro.crypto.UnknownAlgorithmException; @@ -396,7 +396,6 @@ public final class Hasher { @SuppressWarnings("checkstyle:MethodLength") private static void printHelp(Options options, Exception e, boolean debug) { - HelpFormatter help = new HelpFormatter(); String command = "java -jar shiro-tools-hasher-<version>.jar [options] [<value>]"; String header = "\nPrint a cryptographic hash (aka message digest) of the specified <value>.\n--\nOptions:"; String footer = "\n<value> is optional only when hashing passwords (see below). It is\n" @@ -471,8 +470,11 @@ public final class Hasher { + "shiro.ini or a properties file)."; printException(e, debug); LOG.info(""); - help.printHelp(command, header, options, null); - LOG.info(footer); + try { + HelpFormatter.builder().get().printHelp(command, header, options, footer, false); + } catch (Exception ex) { + LOG.warn("Error printing help: {}", ex.getMessage(), ex); + } } private static void printHelpAndExit(Options options, Exception e, boolean debug, int exitCode) {
