This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch activemq-6.2.x
in repository https://gitbox.apache.org/repos/asf/activemq.git
The following commit(s) were added to refs/heads/activemq-6.2.x by this push:
new 2aae118a01 [AMQ-9830] Replaces commons-io usage in activemq-jaas with
Java nio (#1629)
2aae118a01 is described below
commit 2aae118a0176e1ea156ddbbddaf129d9b9bd78a9
Author: Matt Pavlovich <[email protected]>
AuthorDate: Sat Jan 24 10:37:01 2026 -0600
[AMQ-9830] Replaces commons-io usage in activemq-jaas with Java nio (#1629)
---
activemq-jaas/pom.xml | 5 -----
.../activemq/jaas/PropertiesLoginModuleTest.java | 21 ++++++++++++---------
2 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/activemq-jaas/pom.xml b/activemq-jaas/pom.xml
index 34f1552de3..a7baf0250a 100644
--- a/activemq-jaas/pom.xml
+++ b/activemq-jaas/pom.xml
@@ -58,11 +58,6 @@
<dependencies>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>org.apache.directory.server</groupId>
<artifactId>apacheds-core-integ</artifactId>
diff --git
a/activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java
b/activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java
index 81dab16270..d6c3849356 100644
---
a/activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java
+++
b/activemq-jaas/src/test/java/org/apache/activemq/jaas/PropertiesLoginModuleTest.java
@@ -19,6 +19,11 @@ package org.apache.activemq.jaas;
import java.io.File;
import java.io.IOException;
import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.LinkOption;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.FileTime;
+import java.time.Instant;
import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
@@ -30,11 +35,8 @@ import javax.security.auth.login.FailedLoginException;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
-import org.apache.commons.io.FileUtils;
-
import junit.framework.TestCase;
-
/**
* @version $Rev: $ $Date: $
*/
@@ -73,8 +75,9 @@ public class PropertiesLoginModuleTest extends TestCase {
File groupsFile = new File(targetPropDir, "groups.properties");
//Set up initial properties
- FileUtils.copyFile(new File(sourcePropDir, "users.properties"),
usersFile);
- FileUtils.copyFile(new File(sourcePropDir, "groups.properties"),
groupsFile);
+ targetPropDir.mkdirs();
+ Files.copy(new File(sourcePropDir, "users.properties").toPath(),
usersFile.toPath(), StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.COPY_ATTRIBUTES, LinkOption.NOFOLLOW_LINKS);
+ Files.copy(new File(sourcePropDir, "groups.properties").toPath(),
groupsFile.toPath(), StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.COPY_ATTRIBUTES, LinkOption.NOFOLLOW_LINKS);
LoginContext context = new LoginContext("PropertiesLoginReload",
new UserPassHandler("first", "secret"));
@@ -92,10 +95,10 @@ public class PropertiesLoginModuleTest extends TestCase {
//Modify the file and test that the properties are reloaded
Thread.sleep(1000);
- FileUtils.copyFile(new File(sourcePropDir, "usersReload.properties"),
usersFile);
- FileUtils.copyFile(new File(sourcePropDir, "groupsReload.properties"),
groupsFile);
- FileUtils.touch(usersFile);
- FileUtils.touch(groupsFile);
+ Files.copy(new File(sourcePropDir, "usersReload.properties").toPath(),
usersFile.toPath(), StandardCopyOption.REPLACE_EXISTING,
StandardCopyOption.COPY_ATTRIBUTES, LinkOption.NOFOLLOW_LINKS);
+ Files.copy(new File(sourcePropDir,
"groupsReload.properties").toPath(), groupsFile.toPath(),
StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.COPY_ATTRIBUTES,
LinkOption.NOFOLLOW_LINKS);
+ Files.setLastModifiedTime(usersFile.toPath(),
FileTime.from(Instant.now()));
+ Files.setLastModifiedTime(groupsFile.toPath(),
FileTime.from(Instant.now()));
//Use new password to verify users file was reloaded
context = new LoginContext("PropertiesLoginReload", new
UserPassHandler("first", "secrets"));
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact