This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git


The following commit(s) were added to refs/heads/master by this push:
     new fdde32b81 Simplify internals
fdde32b81 is described below

commit fdde32b81ee1516c5a15482378675946954814a9
Author: Gary D. Gregory <[email protected]>
AuthorDate: Sat Feb 15 10:40:52 2025 -0500

    Simplify internals
---
 .../org/apache/commons/vfs2/UserAuthenticationData.java   | 11 ++++-------
 .../apache/commons/vfs2/util/UserAuthenticatorUtils.java  | 15 ++++-----------
 2 files changed, 8 insertions(+), 18 deletions(-)

diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java
index 9bb8c60f2..e899e8853 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java
@@ -16,11 +16,12 @@
  */
 package org.apache.commons.vfs2;
 
-import java.util.Arrays;
 import java.util.Map;
 import java.util.Objects;
 import java.util.TreeMap;
 
+import org.apache.commons.lang3.ArrayFill;
+
 /**
  * Contains various authentication data.
  */
@@ -103,13 +104,9 @@ public class UserAuthenticationData {
     public void cleanup() {
         // step 1: nullify character buffers
         for (final char[] data : authenticationData.values()) {
-            if (data == null) {
-                continue;
-            }
-
-            Arrays.fill(data, (char) 0);
+            ArrayFill.fill(data, (char) 0);
         }
-        // step 2: allow data itself to gc
+        // step 2: allow data itself to GC
         authenticationData.clear();
     }
 
diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/UserAuthenticatorUtils.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/UserAuthenticatorUtils.java
index 7625cbe61..bf5280563 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/UserAuthenticatorUtils.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/UserAuthenticatorUtils.java
@@ -51,7 +51,6 @@ public final class UserAuthenticatorUtils {
         if (auth == null) {
             return null;
         }
-
         return auth.requestAuthentication(authenticatorTypes);
     }
 
@@ -67,24 +66,20 @@ public final class UserAuthenticatorUtils {
     }
 
     /**
-     * Gets data of given type from the UserAuthenticationData or null if 
there is no data or data of this type
-     * available.
+     * Gets a copy of the data of a given type from the UserAuthenticationData 
or null if there is no data or data of this type available.
      *
-     * @param data The UserAuthenticationData.
-     * @param type The type of the element to retrieve.
+     * @param data            The UserAuthenticationData.
+     * @param type            The type of the element to retrieve.
      * @param overriddenValue The default value.
      * @return The data of the given type as a character array or null if the 
data is not available.
      */
-    public static char[] getData(final UserAuthenticationData data, final 
UserAuthenticationData.Type type,
-            final char[] overriddenValue) {
+    public static char[] getData(final UserAuthenticationData data, final 
UserAuthenticationData.Type type, final char[] overriddenValue) {
         if (overriddenValue != null) {
             return overriddenValue;
         }
-
         if (data == null) {
             return null;
         }
-
         return data.getData(type);
     }
 
@@ -98,7 +93,6 @@ public final class UserAuthenticatorUtils {
         if (string == null) {
             return null;
         }
-
         return string.toCharArray();
     }
 
@@ -112,7 +106,6 @@ public final class UserAuthenticatorUtils {
         if (data == null) {
             return null;
         }
-
         return new String(data);
     }
 

Reply via email to