This is an automated email from the ASF dual-hosted git repository.
lprimak pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/shiro.git
The following commit(s) were added to refs/heads/3.x by this push:
new e8dfd200d chore: remove some deprecated method / class usage
e8dfd200d is described below
commit e8dfd200def993391642da616cd9f9c31fb15fa2
Author: lprimak <[email protected]>
AuthorDate: Sun Jan 25 00:24:08 2026 -0600
chore: remove some deprecated method / class usage
---
.../apache/shiro/subject/support/DelegatingSubjectTest.java | 6 +++---
.../src/main/java/org/apache/shiro/tools/hasher/Hasher.java | 10 ++++++----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git
a/core/src/test/java/org/apache/shiro/subject/support/DelegatingSubjectTest.java
b/core/src/test/java/org/apache/shiro/subject/support/DelegatingSubjectTest.java
index 7eda03468..5373d4532 100644
---
a/core/src/test/java/org/apache/shiro/subject/support/DelegatingSubjectTest.java
+++
b/core/src/test/java/org/apache/shiro/subject/support/DelegatingSubjectTest.java
@@ -21,8 +21,8 @@ package org.apache.shiro.subject.support;
import org.apache.shiro.mgt.SecurityManager;
import org.apache.shiro.session.Session;
import org.apache.shiro.session.mgt.SimpleSession;
+import org.apache.shiro.subject.ImmutablePrincipalCollection;
import org.apache.shiro.subject.PrincipalCollection;
-import org.apache.shiro.subject.SimplePrincipalCollection;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
@@ -33,7 +33,7 @@ class DelegatingSubjectTest {
@Test
void subject_decorated_only_once() throws IllegalAccessException,
NoSuchFieldException {
// given
- PrincipalCollection principals = new SimplePrincipalCollection("Max
Mustermann", "realm");
+ PrincipalCollection principals =
ImmutablePrincipalCollection.ofSinglePrincipal("Max Mustermann", "realm");
boolean authenticated = true;
String host = "shiro.apache.org.invalid";
Session innereSession = new SimpleSession(host);
@@ -64,7 +64,7 @@ class DelegatingSubjectTest {
@Test
void session_is_wrapped() {
// given
- PrincipalCollection principals = new SimplePrincipalCollection("Max
Mustermann", "realm");
+ PrincipalCollection principals =
ImmutablePrincipalCollection.ofSinglePrincipal("Max Mustermann", "realm");
boolean authenticated = true;
String host = "shiro.apache.org.invalid";
Session innereSession = new SimpleSession(host);
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..6c0c0653f 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, true);
+ } catch (Exception ex) {
+ LOG.warn("Error printing help: " + ex.getMessage(), ex);
+ }
}
private static void printHelpAndExit(Options options, Exception e, boolean
debug, int exitCode) {