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

commit 1048388517b3fc295c6ce42fd3d6e4efb301c70c
Author: Gary Gregory <[email protected]>
AuthorDate: Mon Mar 2 08:26:59 2026 -0500

    Deprecate UserAuthenticatorUtils.toString(String).
    
    - Use ternary expressions
    - Javadoc
    - Inline single-use local variable
---
 .../vfs2/provider/webdav/WebdavFileProvider.java   |   5 +-
 .../commons/vfs2/provider/smb/SmbFileObject.java   |   3 +-
 .../commons/vfs2/FileSystemConfigBuilder.java      | 238 ++++++++++-----------
 .../vfs2/provider/ftp/FtpClientFactory.java        |   5 +-
 .../vfs2/provider/http/HttpClientFactory.java      |   4 +-
 .../vfs2/provider/http/HttpFileProvider.java       |   5 +-
 .../vfs2/provider/http4/Http4FileProvider.java     |   8 +-
 .../vfs2/provider/http5/Http5FileProvider.java     |   4 +-
 .../commons/vfs2/util/UserAuthenticatorUtils.java  |  30 +--
 src/changes/changes.xml                            |   1 +
 10 files changed, 149 insertions(+), 154 deletions(-)

diff --git 
a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
 
b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
index c3df5132e..4e9b013a1 100644
--- 
a/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
+++ 
b/commons-vfs2-jackrabbit1/src/main/java/org/apache/commons/vfs2/provider/webdav/WebdavFileProvider.java
@@ -22,6 +22,7 @@ import java.util.Collections;
 
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.lang3.CharSequenceUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.vfs2.Capability;
 import org.apache.commons.vfs2.FileName;
 import org.apache.commons.vfs2.FileObject;
@@ -90,9 +91,9 @@ public class WebdavFileProvider extends HttpFileProvider {
 
             httpClient = 
HttpClientFactory.createConnection(WebdavFileSystemConfigBuilder.getInstance(), 
"http",
                     rootName.getHostName(), rootName.getPort(),
-                    
UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+                    
StringUtils.valueOf(UserAuthenticatorUtils.getData(authData,
                             UserAuthenticationData.USERNAME, 
CharSequenceUtils.toCharArray(rootName.getUserName()))),
-                    
UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+                    
StringUtils.valueOf(UserAuthenticatorUtils.getData(authData,
                             UserAuthenticationData.PASSWORD, 
CharSequenceUtils.toCharArray(rootName.getPassword()))),
                     fsOpts);
         } finally {
diff --git 
a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
 
b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
index 25b749221..752aaec42 100644
--- 
a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
+++ 
b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileObject.java
@@ -24,6 +24,7 @@ import java.nio.file.FileSystemException;
 import javax.tools.FileObject;
 
 import org.apache.commons.lang3.CharSequenceUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.vfs2.FileName;
 import org.apache.commons.vfs2.FileType;
 import org.apache.commons.vfs2.FileTypeHasNoContentException;
@@ -76,7 +77,7 @@ public class SmbFileObject extends 
AbstractFileObject<SmbFileSystem> {
             NtlmPasswordAuthentication auth = null;
             if (authData != null) {
                 auth = new NtlmPasswordAuthentication(
-                        
UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+                        
StringUtils.valueOf(UserAuthenticatorUtils.getData(authData,
                                 UserAuthenticationData.DOMAIN, 
CharSequenceUtils.toCharArray(smbFileName.getDomain()))),
                         UserAuthenticatorUtils
                                 
.toString(UserAuthenticatorUtils.getData(authData, 
UserAuthenticationData.USERNAME,
diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
index 6fb4894ac..3b0224fa6 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemConfigBuilder.java
@@ -29,13 +29,13 @@ import org.apache.commons.lang3.time.DurationUtils;
  */
 public abstract class FileSystemConfigBuilder {
 
-    /** Default prefix to use when resolving system properties */
+    /** Default prefix to use when resolving system properties. */
     private static final String PREFIX = "vfs.";
 
-    /** The root URI of the file system */
+    /** The root URI of the file system. */
     private static final String ROOTURI = "rootURI";
 
-    /** The prefix to use when resolving system properties */
+    /** The prefix to use when resolving system properties. */
     private final String prefix;
 
     /**
@@ -50,7 +50,7 @@ public abstract class FileSystemConfigBuilder {
     /**
      * Constructs builder with specified component name.
      *
-     * @param component component name to be used in prefix
+     * @param component component name to be used in prefix.
      * @since 2.0
      */
     protected FileSystemConfigBuilder(final String component) {
@@ -61,8 +61,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Boolean.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getBoolean(FileSystemOptions, String, Boolean)
      * @since 2.0
      */
@@ -74,9 +74,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Boolean.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getBoolean(FileSystemOptions, String, Boolean)
      * @since 2.0
      */
@@ -89,9 +89,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Boolean.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getBoolean(FileSystemOptions, String, Boolean)
      * @since 2.0
      */
@@ -104,8 +104,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Byte.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getByte(FileSystemOptions, String, Byte)
      * @since 2.0
      */
@@ -117,9 +117,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Byte.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getByte(FileSystemOptions, String, Byte)
      * @since 2.0
      */
@@ -131,9 +131,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Byte.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @since 2.0
      */
     protected Byte getByte(final FileSystemOptions fileSystemOptions, final 
String name, final Byte defaultValue) {
@@ -144,8 +144,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Character.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getCharacter(FileSystemOptions, String, Character)
      * @since 2.0
      */
@@ -157,9 +157,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Character.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getCharacter(FileSystemOptions, String, Character)
      * @since 2.0
      */
@@ -171,9 +171,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Character.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @since 2.0
      */
     protected Character getCharacter(final FileSystemOptions 
fileSystemOptions, final String name,
@@ -193,8 +193,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Charset.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getCharset(FileSystemOptions, String, Charset)
      * @since 2.11.0
      */
@@ -206,9 +206,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Charset.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @since 2.11.0
      */
     protected Charset getCharset(final FileSystemOptions fileSystemOptions, 
final String name, final Charset defaultValue) {
@@ -218,7 +218,7 @@ public abstract class FileSystemConfigBuilder {
     /**
      * Gets the target of this configuration.
      *
-     * @return the specific file system class
+     * @return the specific file system class.
      * @since 1.0
      */
     protected abstract Class<? extends FileSystem> getConfigClass();
@@ -227,8 +227,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Double.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getDouble(FileSystemOptions, String, Double)
      * @since 2.0
      */
@@ -240,9 +240,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Double.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getDouble(FileSystemOptions, String, Double)
      * @since 2.0
      */
@@ -255,9 +255,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Double.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @since 2.0
      */
     protected Double getDouble(final FileSystemOptions fileSystemOptions, 
final String name,
@@ -269,8 +269,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Duration.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getLong(FileSystemOptions, String, Long)
      * @since 2.8.0
      */
@@ -282,9 +282,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Duration.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @since 2.8.0
      */
     protected Duration getDuration(final FileSystemOptions fileSystemOptions, 
final String name,
@@ -296,8 +296,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Duration bound to the integer range.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getLong(FileSystemOptions, String, Long)
      * @since 2.8.0
      */
@@ -309,9 +309,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Duration bound to the integer range.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @since 2.8.0
      */
     protected Integer getDurationInteger(final FileSystemOptions 
fileSystemOptions, final String name,
@@ -322,11 +322,11 @@ public abstract class FileSystemConfigBuilder {
     /**
      *Gets a named option as a Double.
      *
-     * @param <E> enumeration type
-     * @param enumClass class of enumeration type
+     * @param <E> enumeration type.
+     * @param enumClass class of enumeration type.
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name *
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getEnum(Class, FileSystemOptions, String, Enum)
      * @throws IllegalArgumentException if option value is not a known 
enumeration.
      * @since 2.1
@@ -339,12 +339,12 @@ public abstract class FileSystemConfigBuilder {
     /**
      * Gets a named option as an Enum.
      *
-     * @param <E> enumeration type
-     * @param enumClass class of enumeration type
+     * @param <E> enumeration type.
+     * @param enumClass class of enumeration type.
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getEnum(Class, FileSystemOptions, String, Enum)
      * @throws IllegalArgumentException if option value is not a known 
enumeration.
      * @since 2.1
@@ -366,8 +366,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Float.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getFloat(FileSystemOptions, String, Float)
      * @throws NumberFormatException if option value is not a valid float.
      * @since 2.0
@@ -380,9 +380,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Float.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getFloat(FileSystemOptions, String, Float)
      * @throws NumberFormatException if option value is not a valid float.
      * @since 2.0
@@ -395,9 +395,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Float.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @throws NumberFormatException if option value is not a valid float.
      * @since 2.0
      */
@@ -409,8 +409,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as an Integer.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getInteger(FileSystemOptions, String, Integer)
      * @throws NumberFormatException if option value is not a valid integer.
      * @since 2.0
@@ -423,9 +423,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as an Integer.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getInteger(FileSystemOptions, String, Integer)
      * @throws NumberFormatException if option value is not a valid integer.
      * @since 2.0
@@ -438,9 +438,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as an Integer.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @throws NumberFormatException if option value is not a valid integer.
      * @since 2.0
      */
@@ -453,8 +453,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Long.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getLong(FileSystemOptions, String, Long)
      * @throws NumberFormatException if option value is not a valid long.
      * @since 2.0
@@ -467,9 +467,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Long.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getLong(FileSystemOptions, String, Long)
      * @throws NumberFormatException if option value is not a valid long.
      * @since 2.0
@@ -482,9 +482,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Long.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @throws NumberFormatException if option value is not a valid long.
      * @since 2.0
      */
@@ -497,8 +497,8 @@ public abstract class FileSystemConfigBuilder {
      *
      * @param <T> The expected return type.
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name get option with this name
-     * @return the named option or null
+     * @param name get option with this name.
+     * @return the named option or null.
      * @since 1.0
      */
     protected <T> T getParam(final FileSystemOptions fileSystemOptions, final 
String name) {
@@ -510,11 +510,11 @@ public abstract class FileSystemConfigBuilder {
      *
      * @param <T> The expected return type.
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name get option with this name
+     * @param name get option with this name.
      * @param defaultValue value to use if the system property value is null.
      * @param function Builds an instance of T from a system property String 
value.
-     * @param returnType TODO
-     * @return the named option or null
+     * @param returnType The return type.
+     * @return the named option or null.
      * @since 2.8.0
      */
     private <T> T getParam(final FileSystemOptions fileSystemOptions, final 
String name, final T defaultValue, final Function<String, T> function,
@@ -535,7 +535,7 @@ public abstract class FileSystemConfigBuilder {
      *
      * @param <T> The expected return type.
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name get option with this name
+     * @param name get option with this name.
      * @param defaultValue The default value if absent.
      * @return the named option or {@code defaultValue}.
      * @since 2.10.0
@@ -548,7 +548,7 @@ public abstract class FileSystemConfigBuilder {
      * Gets the system property for the given name.
      *
      * @param name The name to lookup combined with the prefix.
-     * @return a system property or null
+     * @return a system property or null.
      * @since 2.1
      */
     private String getProperty(final String name) {
@@ -570,7 +570,7 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Short.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
+     * @param name the option name.
      * @return the option in {@code opts} or system properties, otherwise null
      * @see #getShort(FileSystemOptions, String, Short)
      * @throws NumberFormatException if option value is not a valid short.
@@ -584,11 +584,11 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Short.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @see #getShort(FileSystemOptions, String, Short)
-     * @throws NumberFormatException if option value is not a valid short
+     * @throws NumberFormatException if option value is not a valid short.
      * @since 2.0
      */
     protected short getShort(final FileSystemOptions fileSystemOptions, final 
String name, final short defaultValue) {
@@ -599,10 +599,10 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a Short.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
-     * @throws NumberFormatException if option value is not a valid short
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
+     * @throws NumberFormatException if option value is not a valid short.
      * @since 2.0
      */
     protected Short getShort(final FileSystemOptions fileSystemOptions, final 
String name, final Short defaultValue) {
@@ -613,8 +613,8 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a String.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @return the option in {@code opts} or system properties, otherwise null
+     * @param name the option name.
+     * @return the option in {@code opts} or system properties, otherwise null.
      * @see #getString(FileSystemOptions, String, String)
      * @since 2.0
      */
@@ -626,9 +626,9 @@ public abstract class FileSystemConfigBuilder {
      * Gets a named option as a String.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option name
-     * @param defaultValue value to return if option is not present
-     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}
+     * @param name the option name.
+     * @param defaultValue value to return if option is not present.
+     * @return the option in {@code opts} or system properties, otherwise 
{@code defaultValue}.
      * @since 2.0
      */
     protected String getString(final FileSystemOptions fileSystemOptions, 
final String name,
@@ -640,8 +640,8 @@ public abstract class FileSystemConfigBuilder {
      * Checks the named setting specified.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the option to check in {@code opts} or system properties
-     * @return true if option exists
+     * @param name the option to check in {@code opts} or system properties.
+     * @return true if option exists.
      * @since 2.0
      */
     protected boolean hasObject(final FileSystemOptions fileSystemOptions, 
final String name) {
@@ -652,8 +652,8 @@ public abstract class FileSystemConfigBuilder {
      * Checks if option exists.
      *
      * @param fileSystemOptions file system options to query, may be null.
-     * @param name the name to look up in {@code opts}
-     * @return true if opts have the named parameter
+     * @param name the name to look up in {@code opts}.
+     * @return true if opts have the named parameter.
      * @since 1.0
      */
     protected boolean hasParam(final FileSystemOptions fileSystemOptions, 
final String name) {
@@ -663,9 +663,9 @@ public abstract class FileSystemConfigBuilder {
     /**
      * Sets the named parameter.
      *
-     * @param fileSystemOptions the file system options to modify
-     * @param name set option with this name
-     * @param value boolean value to set
+     * @param fileSystemOptions the file system options to modify.
+     * @param name set option with this name.
+     * @param value boolean value to set.
      * @since 2.1
      */
     protected void setParam(final FileSystemOptions fileSystemOptions, final 
String name, final boolean value) {
@@ -675,9 +675,9 @@ public abstract class FileSystemConfigBuilder {
     /**
      * Sets the named parameter.
      *
-     * @param fileSystemOptions the file system options to modify
-     * @param name set option with this name
-     * @param value object value to set
+     * @param fileSystemOptions the file system options to modify.
+     * @param name set option with this name.
+     * @param value object value to set.
      * @since 1.0
      */
     protected void setParam(final FileSystemOptions fileSystemOptions, final 
String name, final Object value) {
@@ -687,7 +687,7 @@ public abstract class FileSystemConfigBuilder {
     /**
      * Sets the root URI of the file system.
      *
-     * @param fileSystemOptions the file system options to modify
+     * @param fileSystemOptions the file system options to modify.
      * @param rootURI The creator name to be associated with the file.
      * @since 2.0
      */
@@ -709,8 +709,8 @@ public abstract class FileSystemConfigBuilder {
     /**
      * Converts the given name into a System property key.
      *
-     * @param name a name to combine with the builder prefix
-     * @return name of system property
+     * @param name a name to combine with the builder prefix.
+     * @return name of system property.
      * @since 2.1
      */
     private String toPropertyKey(final String name) {
diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java
index 09268c015..f6415bc75 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpClientFactory.java
@@ -36,7 +36,6 @@ import org.apache.commons.net.ftp.FTPReply;
 import org.apache.commons.net.ftp.parser.FTPFileEntryParserFactory;
 import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileSystemOptions;
-import org.apache.commons.vfs2.util.UserAuthenticatorUtils;
 
 /**
  * Creates {@link FtpClient} instances.
@@ -185,8 +184,8 @@ public final class FtpClientFactory {
                         throw new 
FileSystemException("vfs.provider.ftp/connect-rejected.error", hostname);
                     }
                     // Login
-                    if 
(!client.login(UserAuthenticatorUtils.toString(username), 
UserAuthenticatorUtils.toString(password))) {
-                        throw new 
FileSystemException("vfs.provider.ftp/login.error", hostname, 
UserAuthenticatorUtils.toString(username));
+                    if (!client.login(StringUtils.valueOf(username), 
StringUtils.valueOf(password))) {
+                        throw new 
FileSystemException("vfs.provider.ftp/login.error", hostname, 
StringUtils.valueOf(username));
                     }
                     FtpFileType fileType = 
builder.getFileType(fileSystemOptions);
                     if (fileType == null) {
diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java
index afa9169f2..02823ac3c 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpClientFactory.java
@@ -84,9 +84,9 @@ public final class HttpClientFactory {
 
                     if (authData != null) {
                         final UsernamePasswordCredentials proxyCreds = new 
UsernamePasswordCredentials(
-                            UserAuthenticatorUtils.toString(
+                            StringUtils.valueOf(
                                 UserAuthenticatorUtils.getData(authData, 
UserAuthenticationData.USERNAME, null)),
-                            UserAuthenticatorUtils.toString(
+                            StringUtils.valueOf(
                                 UserAuthenticatorUtils.getData(authData, 
UserAuthenticationData.PASSWORD, null)));
 
                         final AuthScope scope = new AuthScope(proxyHost, 
AuthScope.ANY_PORT);
diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileProvider.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileProvider.java
index 624646bb0..5af5ed504 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileProvider.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http/HttpFileProvider.java
@@ -22,6 +22,7 @@ import java.util.Collections;
 
 import org.apache.commons.httpclient.HttpClient;
 import org.apache.commons.lang3.CharSequenceUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.vfs2.Capability;
 import org.apache.commons.vfs2.FileName;
 import org.apache.commons.vfs2.FileSystem;
@@ -75,9 +76,9 @@ public class HttpFileProvider extends 
AbstractOriginatingFileProvider {
             final String internalScheme = lastChar == 's' || lastChar == 'S' ? 
"https" : "http";
             httpClient = HttpClientFactory.createConnection(internalScheme, 
rootName.getHostName(),
                     rootName.getPort(),
-                    
UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+                    
StringUtils.valueOf(UserAuthenticatorUtils.getData(authData,
                             UserAuthenticationData.USERNAME, 
CharSequenceUtils.toCharArray(rootName.getUserName()))),
-                    
UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+                    
StringUtils.valueOf(UserAuthenticatorUtils.getData(authData,
                             UserAuthenticationData.PASSWORD, 
CharSequenceUtils.toCharArray(rootName.getPassword()))),
                     fileSystemOptions);
         } finally {
diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java
index 54a6a94da..2f7da5307 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http4/Http4FileProvider.java
@@ -241,9 +241,9 @@ public class Http4FileProvider extends 
AbstractOriginatingFileProvider {
         final CredentialsProvider credsProvider = new 
BasicCredentialsProvider();
         clientContext.setCredentialsProvider(credsProvider);
 
-        final String username = 
UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+        final String username = 
StringUtils.valueOf(UserAuthenticatorUtils.getData(authData,
                 UserAuthenticationData.USERNAME, 
CharSequenceUtils.toCharArray(rootName.getUserName())));
-        final String password = 
UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+        final String password = 
StringUtils.valueOf(UserAuthenticatorUtils.getData(authData,
                 UserAuthenticationData.PASSWORD, 
CharSequenceUtils.toCharArray(rootName.getPassword())));
 
         if (!StringUtils.isEmpty(username)) {
@@ -262,9 +262,9 @@ public class Http4FileProvider extends 
AbstractOriginatingFileProvider {
 
                 if (proxyAuthData != null) {
                     final UsernamePasswordCredentials proxyCreds = new 
UsernamePasswordCredentials(
-                            UserAuthenticatorUtils.toString(
+                            StringUtils.valueOf(
                                     
UserAuthenticatorUtils.getData(proxyAuthData, UserAuthenticationData.USERNAME, 
null)),
-                            UserAuthenticatorUtils.toString(
+                            StringUtils.valueOf(
                                     
UserAuthenticatorUtils.getData(proxyAuthData, UserAuthenticationData.PASSWORD, 
null)));
 
                     credsProvider.setCredentials(new 
AuthScope(proxyHost.getHostName(), proxyHost.getPort()),
diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
index 27a711528..aff0121fe 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/http5/Http5FileProvider.java
@@ -232,7 +232,7 @@ public class Http5FileProvider extends 
AbstractOriginatingFileProvider {
         final BasicCredentialsProvider credsProvider = new 
BasicCredentialsProvider();
         clientContext.setCredentialsProvider(credsProvider);
 
-        final String username = 
UserAuthenticatorUtils.toString(UserAuthenticatorUtils.getData(authData,
+        final String username = 
StringUtils.valueOf(UserAuthenticatorUtils.getData(authData,
                 UserAuthenticationData.USERNAME, 
CharSequenceUtils.toCharArray(rootName.getUserName())));
         final char[] password = UserAuthenticatorUtils.getData(authData,
                 UserAuthenticationData.PASSWORD, 
CharSequenceUtils.toCharArray(rootName.getPassword()));
@@ -254,7 +254,7 @@ public class Http5FileProvider extends 
AbstractOriginatingFileProvider {
 
                 if (proxyAuthData != null) {
                     final UsernamePasswordCredentials proxyCreds = new 
UsernamePasswordCredentials(
-                            UserAuthenticatorUtils.toString(
+                            StringUtils.valueOf(
                                     
UserAuthenticatorUtils.getData(proxyAuthData, UserAuthenticationData.USERNAME, 
null)),
                             UserAuthenticatorUtils.getData(proxyAuthData, 
UserAuthenticationData.PASSWORD, null));
 
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 ef997243e..07ce7f386 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
@@ -17,6 +17,7 @@
 package org.apache.commons.vfs2.util;
 
 import org.apache.commons.lang3.CharSequenceUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.vfs2.FileSystemOptions;
 import org.apache.commons.vfs2.UserAuthenticationData;
 import org.apache.commons.vfs2.UserAuthenticator;
@@ -34,10 +35,8 @@ public final class UserAuthenticatorUtils {
      * @param authenticatorTypes An array of types describing the data to be 
retrieved.
      * @return A UserAuthenticationData object containing the data requested.
      */
-    public static UserAuthenticationData authenticate(final FileSystemOptions 
options,
-        final UserAuthenticationData.Type[] authenticatorTypes) {
-        final UserAuthenticator auth = 
DefaultFileSystemConfigBuilder.getInstance().getUserAuthenticator(options);
-        return authenticate(auth, authenticatorTypes);
+    public static UserAuthenticationData authenticate(final FileSystemOptions 
options, final UserAuthenticationData.Type[] authenticatorTypes) {
+        return 
authenticate(DefaultFileSystemConfigBuilder.getInstance().getUserAuthenticator(options),
 authenticatorTypes);
     }
 
     /**
@@ -49,10 +48,7 @@ public final class UserAuthenticatorUtils {
      */
     public static UserAuthenticationData authenticate(final UserAuthenticator 
auth,
             final UserAuthenticationData.Type[] authenticatorTypes) {
-        if (auth == null) {
-            return null;
-        }
-        return auth.requestAuthentication(authenticatorTypes);
+        return auth != null ? auth.requestAuthentication(authenticatorTypes) : 
null;
     }
 
     /**
@@ -78,18 +74,15 @@ public final class UserAuthenticatorUtils {
         if (overriddenValue != null) {
             return overriddenValue;
         }
-        if (data == null) {
-            return null;
-        }
-        return data.getData(type);
+        return data != null ? data.getData(type) : null;
     }
 
     /**
      * Converts a string to a char array (null-safe).
      *
      * @param string The String to convert.
-     * @return The character array.
-     * @deprecated Use {@link CharSequenceUtils#toCharArray(CharSequence)} 
instead.
+     * @return A new character array.
+     * @deprecated Use {@link CharSequenceUtils#toCharArray(CharSequence)}.
      */
     @Deprecated
     public static char[] toChar(final String string) {
@@ -100,13 +93,12 @@ public final class UserAuthenticatorUtils {
      * Converts the given data to a string (null-safe).
      *
      * @param data A character array containing the data to convert to a 
String.
-     * @return The String.
+     * @return A new String.
+     * @deprecated Use {@link StringUtils#valueOf(char[])}.
      */
+    @Deprecated
     public static String toString(final char[] data) {
-        if (data == null) {
-            return null;
-        }
-        return new String(data);
+        return StringUtils.valueOf(data);
     }
 
     private UserAuthenticatorUtils() {
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7cac4c559..e236301c3 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -62,6 +62,7 @@ The <action> type attribute can be add,update,fix,remove.
       <action type="fix" dev="ggregory" due-to="Gary 
Gregory">SftpFileSystem.executeCommand(String, StringBuilder) now restores the 
current thread's interrupt flag when catching InterruptedException.</action>
       <action type="fix" dev="ggregory" due-to="Vaishnavi Kumbhar, Gary 
Gregory" issue="VFS-861">Http5FileProvider Basic authentication fails: 
UserAuthenticationData.setData(Type, char[]) should clone its array 
input.</action>
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate 
UserAuthenticatorUtils.toChar(String).</action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate 
UserAuthenticatorUtils.toString(String).</action>
       <!-- ADD -->
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
org.apache.commons.vfs2.provider.ftp.FTPClientWrapper.sendOptions(String, 
String).</action>
       <action type="add" dev="ggregory" due-to="Gary Gregory">Add 
FtpFileSystemConfigBuilder.getControlEncodingCharset(FileSystemOptions) and 
deprecate getControlEncoding(FileSystemOptions).</action>


Reply via email to