You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/02/04 19:36:16 UTC

(commons-vfs) branch master updated (b75c001d -> a4186edf)

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

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


    from b75c001d Bump org.apache.httpcomponents.client5:httpclient5 from 5.3 to 5.3.1 #478
     new 0f9f3e01 Use final
     new 74b31427 Move ivar to local var
     new 2bbf25da Remove redundant parens
     new 19d64d31 Remove redundant parens
     new a72cdd50 Use final
     new 4e857e4e Remove variable assignment just before returning it
     new 8ea7dc23 Use final
     new e63ef67f Move ivar to local var
     new 0b5960ae Move ivar to local var
     new 4747e535 Move ivar to local var
     new 28c2de14 Remove variable assignment just before returning it
     new e4ffba1c Use final
     new ce584e34 Use final
     new af41d23d Remove variable assignment just before returning it
     new ccb1b2e3 Use final
     new eea14622 Remove variable assignment just before returning it
     new 97023c24 Remove variable assignment just before returning it
     new 29266ee1 Use diamond notation
     new 85ff70b6 Use compact array notation
     new b141f97f Remove unused import
     new 5114546e Remove variable assignment just before returning it
     new da728b58 Use final
     new 5b4a7c90 Use final
     new 9d6147d8 Move ivar to local var
     new 76832b67 Remove unused import
     new a4186edf Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-vfs.git

The 26 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../vfs2/example/filter/AgeFileFilterExample.java  |  2 +-
 .../provider/hdfs/HdfsFileSystemConfigBuilder.java |  2 +-
 .../webdav/test/WebdavProviderTestCase.java        |  3 +-
 .../vfs2/provider/webdav4/Webdav4FileName.java     |  4 +-
 .../vfs2/provider/webdav4/Webdav4FileNameTest.java |  5 +-
 .../vfs2/provider/webdav4/test/JackrabbitMain.java | 62 +++++++++++-----------
 .../webdav4/test/Webdav4ProviderTestCase.java      |  2 +-
 .../commons/vfs2/provider/smb/SmbFileProvider.java |  2 +-
 .../vfs2/util/SharedRandomContentInputStream.java  |  4 +-
 .../provider/smb/test/SmbProviderTestCase.java     |  2 -
 .../org/apache/commons/vfs2/FileSystemOptions.java |  3 +-
 .../commons/vfs2/auth/StaticUserAuthenticator.java |  8 +--
 .../vfs2/impl/DefaultFileSystemManager.java        |  2 +-
 .../commons/vfs2/provider/HostFileNameParser.java  |  2 +-
 .../apache/commons/vfs2/provider/UriParser.java    | 26 ++++-----
 .../commons/vfs2/provider/sftp/IdentityInfo.java   |  3 +-
 .../commons/vfs2/provider/sftp/SftpFileObject.java |  2 +-
 .../commons/vfs2/provider/sftp/SftpFileSystem.java |  2 +-
 .../apache/commons/vfs2/util/DefaultCryptor.java   |  4 +-
 .../org/apache/commons/vfs2/FileIteratorTest.java  |  2 +-
 .../commons/vfs2/IPv6LocalConnectionTests.java     | 14 ++---
 .../commons/vfs2/filter/AgeFileFilterTest.java     |  4 +-
 .../vfs2/impl/DefaultFileSystemManagerTest.java    |  2 +-
 .../commons/vfs2/impl/VfsClassLoaderTests.java     |  2 +-
 .../commons/vfs2/provider/UriParserTest.java       |  2 +-
 .../vfs2/provider/ftp/FtpProviderIPv6TestCase.java |  2 +-
 .../ftps/AbstractFtpsProviderTestCase.java         |  4 +-
 .../vfs2/provider/http/HttpProviderTestCase.java   |  4 +-
 .../vfs2/provider/http4/Http4ProviderTestCase.java |  4 +-
 .../vfs2/provider/http5/Http5ProviderTestCase.java |  4 +-
 .../sftp/AbstractSftpProviderTestCase.java         |  4 +-
 .../sftp/SftpPermissionExceptionTestCase.java      |  5 +-
 .../SftpProviderClosedExecChannelTestCase.java     |  3 +-
 .../provider/sftp/SftpProviderIPv6TestCase.java    |  6 +--
 .../sftp/SftpProviderStreamProxyModeTestCase.java  |  3 +-
 .../vfs2/provider/sftp/SftpPutChannelTestCase.java |  3 +-
 .../vfs2/provider/test/GenericFileNameTest.java    |  4 +-
 .../vfs2/provider/url/UrlProviderHttpTestCase.java |  4 +-
 38 files changed, 96 insertions(+), 120 deletions(-)


(commons-vfs) 08/26: Move ivar to local var

Posted by gg...@apache.org.
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 e63ef67fa09343b4469dd4f1f6f056762e98f30e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:27:02 2024 -0500

    Move ivar to local var
---
 .../org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java
index b3269576..4897c289 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4ProviderTestCase.java
@@ -42,8 +42,6 @@ public class Http4ProviderTestCase extends AbstractProviderTestConfig {
 
     private static NHttpFileServer server;
 
-    private static int socketPort;
-
     private static final String TEST_URI = "test.http.uri";
 
     /**
@@ -62,7 +60,7 @@ public class Http4ProviderTestCase extends AbstractProviderTestConfig {
      */
     private static void setUpClass() throws Exception {
         server = NHttpFileServer.start(0, new File(getTestDirectory()), 5000);
-        socketPort = server.getPort();
+        int socketPort = server.getPort();
         connectionUri = "http4://localhost:" + socketPort;
     }
 


(commons-vfs) 09/26: Move ivar to local var

Posted by gg...@apache.org.
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 0b5960ae0bbbf6846315120715e1c25a051db86a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:27:13 2024 -0500

    Move ivar to local var
---
 .../org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java
index 693345ea..782ae4d4 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5ProviderTestCase.java
@@ -42,8 +42,6 @@ public class Http5ProviderTestCase extends AbstractProviderTestConfig {
 
     private static NHttpFileServer server;
 
-    private static int socketPort;
-
     private static final String TEST_URI = "test.http.uri";
 
     /**
@@ -62,7 +60,7 @@ public class Http5ProviderTestCase extends AbstractProviderTestConfig {
      */
     private static void setUpClass() throws Exception {
         server = NHttpFileServer.start(0, new File(getTestDirectory()), 5000);
-        socketPort = server.getPort();
+        int socketPort = server.getPort();
         connectionUri = "http5://localhost:" + socketPort;
     }
 


(commons-vfs) 11/26: Remove variable assignment just before returning it

Posted by gg...@apache.org.
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 28c2de148edb5e4db2729e7f9b16ee96094c2d52
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:27:41 2024 -0500

    Remove variable assignment just before returning it
---
 .../main/java/org/apache/commons/vfs2/provider/sftp/IdentityInfo.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/IdentityInfo.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/IdentityInfo.java
index 7d927e65..1c2c12d8 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/IdentityInfo.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/IdentityInfo.java
@@ -156,7 +156,6 @@ public class IdentityInfo implements IdentityProvider {
         final int prime = 31;
         int result = 1;
         result = prime * result + Arrays.hashCode(passphrase);
-        result = prime * result + Objects.hash(privateKey, publicKey);
-        return result;
+        return prime * result + Objects.hash(privateKey, publicKey);
     }
 }


(commons-vfs) 21/26: Remove variable assignment just before returning it

Posted by gg...@apache.org.
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 5114546e23a887191016ee3205391865daa518fa
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:32:51 2024 -0500

    Remove variable assignment just before returning it
---
 .../org/apache/commons/vfs2/auth/StaticUserAuthenticator.java     | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java
index 6ceccb81..24283fd0 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java
@@ -77,9 +77,7 @@ public class StaticUserAuthenticator implements UserAuthenticator, Comparable<St
     public int compareTo(final StaticUserAuthenticator other) {
         int result = compareStringOrNull(domain, other.domain);
         result = result == 0 ? compareStringOrNull(userName, other.userName) : result;
-        result = result == 0 ? compareStringOrNull(password, other.password) : result;
-
-        return result;
+        return result == 0 ? compareStringOrNull(password, other.password) : result;
     }
 
     /**
@@ -117,9 +115,7 @@ public class StaticUserAuthenticator implements UserAuthenticator, Comparable<St
         int result = 1;
         result = prime * result + (domain == null ? 0 : domain.hashCode());
         result = prime * result + (password == null ? 0 : password.hashCode());
-        result = prime * result + (userName == null ? 0 : userName.hashCode());
-
-        return result;
+        return prime * result + (userName == null ? 0 : userName.hashCode());
     }
 
     @Override


(commons-vfs) 24/26: Move ivar to local var

Posted by gg...@apache.org.
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 9d6147d899a3b0e230fb375014daad88057b202b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:33:50 2024 -0500

    Move ivar to local var
---
 .../org/apache/commons/vfs2/provider/url/UrlProviderHttpTestCase.java | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderHttpTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderHttpTestCase.java
index fefb13ff..70a20727 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderHttpTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/url/UrlProviderHttpTestCase.java
@@ -38,8 +38,6 @@ public class UrlProviderHttpTestCase extends AbstractProviderTestConfig {
 
     private static NHttpFileServer server;
 
-    private static int socketPort;
-
     private static final String TEST_URI = "test.http.uri";
 
     /**
@@ -58,7 +56,7 @@ public class UrlProviderHttpTestCase extends AbstractProviderTestConfig {
      */
     private static void setUpClass() throws Exception {
         server = NHttpFileServer.start(0, new File(getTestDirectory()), 5000);
-        socketPort = server.getPort();
+        int socketPort = server.getPort();
         connectionUri = "http://localhost:" + socketPort;
     }
 


(commons-vfs) 23/26: Use final

Posted by gg...@apache.org.
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 5b4a7c90935efbe77eec74daaaaf6c60c4f2ccd4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:33:44 2024 -0500

    Use final
---
 .../src/test/java/org/apache/commons/vfs2/provider/UriParserTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTest.java
index 2b9fbc7c..5ea09a65 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/UriParserTest.java
@@ -95,7 +95,7 @@ public class UriParserTest {
             assertEquals(FileType.FILE, UriParser.normalisePath(new StringBuilder("./Sub Folder/./File.")));
             assertEquals(FileType.FILE, UriParser.normalisePath(new StringBuilder("./Sub Folder/./File..")));
 
-        } catch (FileSystemException e) {
+        } catch (final FileSystemException e) {
             fail(e);
         }
     }


(commons-vfs) 12/26: Use final

Posted by gg...@apache.org.
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 e4ffba1c1892521300a880fbb76ef012f96c7ec4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:28:16 2024 -0500

    Use final
---
 .../vfs2/provider/webdav4/test/JackrabbitMain.java | 62 +++++++++++-----------
 .../commons/vfs2/IPv6LocalConnectionTests.java     | 14 ++---
 2 files changed, 37 insertions(+), 39 deletions(-)

diff --git a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/JackrabbitMain.java b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/JackrabbitMain.java
index ca187f21..239bcc42 100644
--- a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/JackrabbitMain.java
+++ b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/JackrabbitMain.java
@@ -61,7 +61,7 @@ public class JackrabbitMain {
     /**
      * @param args
      */
-    public static void main(String[] args) throws Exception {
+    public static void main(final String[] args) throws Exception {
         new JackrabbitMain(args).run();
     }
 
@@ -83,7 +83,7 @@ public class JackrabbitMain {
      * <EM>Note:</EM> Constructor is protected because other projects such as Commons VFS can extend this for some reasons
      *       (e.g, unit testing against Jackrabbit WebDAV).
      */
-    protected JackrabbitMain(String[] args) throws ParseException {
+    protected JackrabbitMain(final String[] args) throws ParseException {
         options.addOption("?", "help", false, "print this message");
         options.addOption("n", "notice", false, "print copyright notices");
         options.addOption("l", "license", false, "print license information");
@@ -110,7 +110,7 @@ public class JackrabbitMain {
         command = new DefaultParser().parse(options, args);
     }
 
-    private void backup(File sourceDir) throws Exception {
+    private void backup(final File sourceDir) throws Exception {
         RepositoryConfig source;
         if (command.hasOption("conf")) {
             source = RepositoryConfig.create(
@@ -142,38 +142,35 @@ public class JackrabbitMain {
         message("The repository has been successfully copied.");
     }
 
-    private void copyToOutput(String resource) throws IOException {
-        InputStream stream = JackrabbitMain.class.getResourceAsStream(resource);
-        try {
+    private void copyToOutput(final String resource) throws IOException {
+        try (InputStream stream = JackrabbitMain.class.getResourceAsStream(resource)) {
             IOUtils.copy(stream, System.out);
-        } finally {
-            stream.close();
         }
     }
 
-    private void message(String message) {
+    private void message(final String message) {
         if (!command.hasOption("quiet")) {
             System.out.println(message);
         }
     }
 
-    private void prepareAccessLog(File log) {
-        NCSARequestLog ncsa = new NCSARequestLog(
+    private void prepareAccessLog(final File log) {
+        final NCSARequestLog ncsa = new NCSARequestLog(
                 new File(log, "access.log.yyyy_mm_dd").getPath());
         ncsa.setFilenameDateFormat("yyyy-MM-dd");
         accessLog.setRequestLog(ncsa);
     }
 
     private void prepareConnector() {
-        String port = command.getOptionValue("port", "8080");
+        final String port = command.getOptionValue("port", "8080");
         connector.setPort(Integer.parseInt(port));
-        String host = command.getOptionValue("host");
+        final String host = command.getOptionValue("host");
         if (host != null) {
             connector.setHost(host);
         }
     }
 
-    private void prepareServerLog(File log)
+    private void prepareServerLog(final File log)
             throws IOException {
         System.setProperty(
                 "jackrabbit.log", new File(log, "jackrabbit.log").getPath());
@@ -193,23 +190,24 @@ public class JackrabbitMain {
 
     private void prepareShutdown() {
         Runtime.getRuntime().addShutdownHook(new Thread() {
+            @Override
             public void run() {
                 shutdown();
             }
         });
     }
 
-    private void prepareWebapp(File file, File repository, File tmp) {
+    private void prepareWebapp(final File file, final File repository, final File tmp) {
         webapp.setContextPath("/");
         webapp.setWar(file.getPath());
         webapp.setExtractWAR(true);
         webapp.setTempDirectory(tmp);
 
-        ServletHolder servlet =
+        final ServletHolder servlet =
             new ServletHolder(JackrabbitRepositoryServlet.class);
         servlet.setInitOrder(1);
         servlet.setInitParameter("repository.home", repository.getPath());
-        String conf = command.getOptionValue("conf");
+        final String conf = command.getOptionValue("conf");
         if (conf != null) {
             servlet.setInitParameter("repository.config", conf);
         }
@@ -224,18 +222,18 @@ public class JackrabbitMain {
      */
     public void run() throws Exception {
         String defaultFile = "jackrabbit-standalone.jar";
-        URL location =
+        final URL location =
             Main.class.getProtectionDomain().getCodeSource().getLocation();
         if (location != null && "file".equals(location.getProtocol())) {
-            File file = new File(location.getPath());
+            final File file = new File(location.getPath());
             if (file.isFile()) {
                 defaultFile = location.getPath();
             }
         }
-        File file = new File(command.getOptionValue("file", defaultFile));
+        final File file = new File(command.getOptionValue("file", defaultFile));
 
         if (command.hasOption("help")) {
-            HelpFormatter formatter = new HelpFormatter();
+            final HelpFormatter formatter = new HelpFormatter();
             formatter.printHelp("java -jar " + file.getName(), options, true);
         } else if (command.hasOption("notice")) {
             copyToOutput("/META-INF/NOTICE.txt");
@@ -244,16 +242,16 @@ public class JackrabbitMain {
         } else if (command.hasOption("cli")) {
             System.setProperty("logback.configurationFile", "logback-cli.xml");
 
-            String uri = command.getOptionValue("cli");
-            Repository repository = JcrUtils.getRepository(uri);
+            final String uri = command.getOptionValue("cli");
+            final Repository repository = JcrUtils.getRepository(uri);
 
-            Context context = new ContextBase();
+            final Context context = new ContextBase();
             CommandHelper.setRepository(context, repository, uri);
             try {
-                Session session = repository.login();
+                final Session session = repository.login();
                 CommandHelper.setSession(context, session);
                 CommandHelper.setCurrentNode(context, session.getRootNode());
-            } catch (RepositoryException ignore) {
+            } catch (final RepositoryException ignore) {
                 // anonymous login not possible
             }
 
@@ -261,20 +259,20 @@ public class JackrabbitMain {
 
             try {
                 CommandHelper.getSession(context).logout();
-            } catch (CommandException ignore) {
+            } catch (final CommandException ignore) {
                 // already logged out
             }
         } else {
             message("Welcome to Apache Jackrabbit!");
             message("-------------------------------");
 
-            File repository =
+            final File repository =
                 new File(command.getOptionValue("repo", "jackrabbit"));
             message("Using repository directory " + repository);
             repository.mkdirs();
-            File tmp = new File(repository, "tmp");
+            final File tmp = new File(repository, "tmp");
             tmp.mkdir();
-            File log = new File(repository, "log");
+            final File log = new File(repository, "log");
             log.mkdir();
 
             message("Writing log messages to " + log);
@@ -301,7 +299,7 @@ public class JackrabbitMain {
                     }
                     message("Apache Jackrabbit is now running at "
                             +"http://" + host + ":" + connector.getPort() + "/");
-                } catch (Throwable t) {
+                } catch (final Throwable t) {
                     System.err.println(
                             "Unable to start the server: " + t.getMessage());
                     System.exit(1);
@@ -324,7 +322,7 @@ public class JackrabbitMain {
             server.join();
             message("-------------------------------");
             message("Goodbye from Apache Jackrabbit!");
-        } catch (Exception e) {
+        } catch (final Exception e) {
             e.printStackTrace();
         }
     }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/IPv6LocalConnectionTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/IPv6LocalConnectionTests.java
index 6664cf85..420b1399 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/IPv6LocalConnectionTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/IPv6LocalConnectionTests.java
@@ -39,13 +39,13 @@ public class IPv6LocalConnectionTests extends AbstractProviderTestCase {
     private static List<String> getLocalIPv6Addresses() throws SocketException {
         final Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
         final List<String> result = new ArrayList<>();
-        for (NetworkInterface networkInterface : Collections.list(networkInterfaces)) {
+        for (final NetworkInterface networkInterface : Collections.list(networkInterfaces)) {
             if (!networkInterface.isUp() || networkInterface.isLoopback()
             // utun refers to VPN network interface, we don't expect this connection to work
                     || networkInterface.getName().startsWith("utun")) {
                 continue;
             }
-            for (InetAddress inetAddress : Collections.list(networkInterface.getInetAddresses())) {
+            for (final InetAddress inetAddress : Collections.list(networkInterface.getInetAddresses())) {
                 if (inetAddress instanceof Inet6Address && !inetAddress.isLoopbackAddress() && !inetAddress.isMulticastAddress()) {
                     result.add(StringUtils.substringBefore(inetAddress.getHostAddress(), "%"));
                 }
@@ -73,13 +73,13 @@ public class IPv6LocalConnectionTests extends AbstractProviderTestCase {
         super.runTest();
     }
 
-    private FileSystemOptions setupConnectionTimeoutHints(FileSystem fileSystem) {
+    private FileSystemOptions setupConnectionTimeoutHints(final FileSystem fileSystem) {
         // Unfortunately there is no common way to set up timeouts for every protocol
         // So, we use this hacky approach to make this class generic and formally independent of protocols implementations
 
-        FileSystemOptions result = (FileSystemOptions) fileSystem.getFileSystemOptions().clone();
+        final FileSystemOptions result = (FileSystemOptions) fileSystem.getFileSystemOptions().clone();
 
-        Duration timeout = Duration.ofSeconds(5);
+        final Duration timeout = Duration.ofSeconds(5);
 
         result.setOption(fileSystem.getClass(), "org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder.CONNECT_TIMEOUT", timeout);
         result.setOption(fileSystem.getClass(), "org.apache.commons.vfs2.provider.sftp.SftpFileSystemConfigBuilder.TIMEOUT", timeout);
@@ -99,14 +99,14 @@ public class IPv6LocalConnectionTests extends AbstractProviderTestCase {
     public void testConnectIPv6UrlLocal() throws Exception {
         final List<String> localIPv6Addresses = getLocalIPv6Addresses();
         boolean connected = false;
-        for (String ipv6Address : localIPv6Addresses) {
+        for (final String ipv6Address : localIPv6Addresses) {
             final String ipv6Url = StringUtils.replace(this.getReadFolder().getURL().toString(), "localhost", "[" + ipv6Address + "]");
             try {
                 final FileSystem fileSystem = getFileSystem();
 
                 final FileObject readFolderObject = getManager().resolveFile(ipv6Url, setupConnectionTimeoutHints(fileSystem));
                 connected = connected || readFolderObject.resolveFile("file1.txt").getContent().getByteArray() != null;
-            } catch (FileSystemException e) {
+            } catch (final FileSystemException e) {
                 // We don't care, if some of the discovered IPv6 addresses don't work.
                 // We just need a single one to work for testing the functionality end-to-end.
                 log.warn("Failed to connect to some of the local IPv6 network addresses", e);


(commons-vfs) 06/26: Remove variable assignment just before returning it

Posted by gg...@apache.org.
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 4e857e4e892ca2981a9d1faf3b4e640563afa4ba
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:26:17 2024 -0500

    Remove variable assignment just before returning it
---
 .../src/main/java/org/apache/commons/vfs2/FileSystemOptions.java       | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
index e52db34c..958f52b5 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileSystemOptions.java
@@ -94,8 +94,7 @@ public final class FileSystemOptions implements Cloneable, Comparable<FileSystem
         public int hashCode() {
             int result;
             result = fileSystemClass.hashCode();
-            result = HASH * result + name.hashCode();
-            return result;
+            return HASH * result + name.hashCode();
         }
 
         @Override


(commons-vfs) 03/26: Remove redundant parens

Posted by gg...@apache.org.
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 2bbf25da73ffd52ea6899e33b4605387c0995dd4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:25:11 2024 -0500

    Remove redundant parens
---
 .../org/apache/commons/vfs2/example/filter/AgeFileFilterExample.java  | 2 +-
 .../src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java    | 4 ++--
 .../test/java/org/apache/commons/vfs2/filter/AgeFileFilterTest.java   | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/AgeFileFilterExample.java b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/AgeFileFilterExample.java
index b0d15593..0e84c906 100644
--- a/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/AgeFileFilterExample.java
+++ b/commons-vfs2-examples/src/main/java/org/apache/commons/vfs2/example/filter/AgeFileFilterExample.java
@@ -41,7 +41,7 @@ public final class AgeFileFilterExample {
         final FileObject dir = fsManager.toFileObject(new File("."));
 
         // We are interested in files older than one day
-        final long cutoff = System.currentTimeMillis() - (24 * 60 * 60 * 1000);
+        final long cutoff = System.currentTimeMillis() - 24 * 60 * 60 * 1000;
         final AgeFileFilter filter = new AgeFileFilter(cutoff);
 
         final FileObject[] files = dir.findFiles(new FileFilterSelector(filter));
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java
index edf099e0..6777a0f1 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/util/DefaultCryptor.java
@@ -59,7 +59,7 @@ public class DefaultCryptor implements Cryptor {
             if (id2 == INDEX_NOT_FOUND) {
                 throw new IllegalArgumentException("Character " + chars[index - 1] + " at position " + (index - 1) + " is not a valid hexadecimal character");
             }
-            decoded[i] = (byte) ((id1 << BITS_IN_HALF_BYTE) | id2);
+            decoded[i] = (byte) (id1 << BITS_IN_HALF_BYTE | id2);
         }
         return decoded;
     }
@@ -88,7 +88,7 @@ public class DefaultCryptor implements Cryptor {
         final StringBuilder builder = new StringBuilder();
 
         for (final byte b : bytes) {
-            builder.append(HEX_CHARS[(b >> BITS_IN_HALF_BYTE) & MASK]);
+            builder.append(HEX_CHARS[b >> BITS_IN_HALF_BYTE & MASK]);
             builder.append(HEX_CHARS[b & MASK]);
         }
         return builder.toString();
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AgeFileFilterTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AgeFileFilterTest.java
index 4ac93552..714eccbf 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AgeFileFilterTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/filter/AgeFileFilterTest.java
@@ -44,9 +44,9 @@ public class AgeFileFilterTest extends BaseFilterTest {
 
     private static final long NOW_MILLIS = System.currentTimeMillis();
 
-    private static final long TWO_DAYS_AGO_MILLIS = NOW_MILLIS - (2 * DAY_MILLIS);
+    private static final long TWO_DAYS_AGO_MILLIS = NOW_MILLIS - 2 * DAY_MILLIS;
 
-    private static final long TWO_DAYS_LATER_MILLIS = NOW_MILLIS + (2 * DAY_MILLIS);
+    private static final long TWO_DAYS_LATER_MILLIS = NOW_MILLIS + 2 * DAY_MILLIS;
 
     private static File testDir;
 


(commons-vfs) 14/26: Remove variable assignment just before returning it

Posted by gg...@apache.org.
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 af41d23d2dcc771bfaf23fcea435edeb8fcb1df0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:30:37 2024 -0500

    Remove variable assignment just before returning it
---
 .../commons/vfs2/provider/sftp/SftpPermissionExceptionTestCase.java  | 5 ++---
 .../vfs2/provider/sftp/SftpProviderClosedExecChannelTestCase.java    | 3 +--
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTestCase.java
index 70169e78..d7ad3f93 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPermissionExceptionTestCase.java
@@ -38,14 +38,13 @@ public class SftpPermissionExceptionTestCase extends AbstractSftpProviderTestCas
      * Creates the test suite for the sftp file system.
      */
     public static junit.framework.Test suite() throws Exception {
-        final SftpProviderTestSuite suite = new SftpProviderTestSuite(new SftpPermissionExceptionTestCase()){
+        return new SftpProviderTestSuite(new SftpPermissionExceptionTestCase()){
             @Override
             protected void addBaseTests() throws Exception {
                 // Just tries to read
                 addTests(SftpPermissionExceptionTestCase.class);
             }
         };
-        return suite;
     }
 
     /**
@@ -100,7 +99,7 @@ public class SftpPermissionExceptionTestCase extends AbstractSftpProviderTestCas
                 Assertions.assertFalse(fileObjectCopy.isWriteable());
                 fileObjectCopy.copyFrom(localFileObject, Selectors.SELECT_SELF);
                 Assertions.fail("permission fail");
-            } catch (Exception ex) {
+            } catch (final Exception ex) {
                 // ignore no permission
             }
         }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderClosedExecChannelTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderClosedExecChannelTestCase.java
index a1fd12d5..9805e7cc 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderClosedExecChannelTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderClosedExecChannelTestCase.java
@@ -31,7 +31,7 @@ public class SftpProviderClosedExecChannelTestCase extends AbstractSftpProviderT
      * Creates the test suite for the sftp file system.
      */
     public static Test suite() throws Exception {
-        final SftpProviderTestSuite suite = new SftpProviderTestSuite(new SftpProviderClosedExecChannelTestCase()) {
+        return new SftpProviderTestSuite(new SftpProviderClosedExecChannelTestCase()) {
             @Override
             protected void addBaseTests() throws Exception {
                 addTests(ProviderReadTests.class);
@@ -43,7 +43,6 @@ public class SftpProviderClosedExecChannelTestCase extends AbstractSftpProviderT
                 addTests(PermissionsTests.class);
             }
         };
-        return suite;
     }
 
     @Override


(commons-vfs) 04/26: Remove redundant parens

Posted by gg...@apache.org.
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 19d64d3171d783e29db69076d43d370e3184b005
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:25:43 2024 -0500

    Remove redundant parens
---
 .../java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java
index d1663674..dd6e5e0a 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/impl/DefaultFileSystemManager.java
@@ -927,7 +927,7 @@ public class DefaultFileSystemManager implements FileSystemManager {
         // Reappend the removed trailing / in case of a FOLDER, so that the following calls to
         // 'provider.parseUri(realBase, fullPath)' can determine the correct FileType
         // otherwise the resulting FileType is always fileType.FILE
-        final String trailingPathPart = (fileType == FileType.FOLDER) ? FileName.SEPARATOR : "";
+        final String trailingPathPart = fileType == FileType.FOLDER ? FileName.SEPARATOR : "";
 
         final String fullPath;
         if (scheme != null) {


(commons-vfs) 25/26: Remove unused import

Posted by gg...@apache.org.
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 76832b67e741f3db8c74781d234df017c693e8b7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:35:33 2024 -0500

    Remove unused import
    
    Use final
---
 .../commons/vfs2/provider/webdav/test/WebdavProviderTestCase.java    | 3 +--
 .../org/apache/commons/vfs2/provider/webdav4/Webdav4FileName.java    | 4 ++--
 .../apache/commons/vfs2/provider/webdav4/Webdav4FileNameTest.java    | 5 +++--
 .../commons/vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java  | 2 +-
 .../test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java  | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestCase.java b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestCase.java
index 778f80b7..e552ce00 100644
--- a/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestCase.java
+++ b/commons-vfs2-jackrabbit1/src/test/java/org/apache/commons/vfs2/provider/webdav/test/WebdavProviderTestCase.java
@@ -39,7 +39,6 @@ import org.apache.commons.vfs2.AbstractProviderTestConfig;
 import org.apache.commons.vfs2.FileObject;
 import org.apache.commons.vfs2.FileSystemManager;
 import org.apache.commons.vfs2.FileSystemOptions;
-import org.apache.commons.vfs2.IPv6LocalConnectionTests;
 import org.apache.commons.vfs2.ProviderTestSuite;
 import org.apache.commons.vfs2.VFS;
 import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
@@ -286,7 +285,7 @@ public class WebdavProviderTestCase extends AbstractProviderTestConfig {
             message(e);
             try {
                 Files.delete(RepoDirectory);
-            } catch (IOException e1) {
+            } catch (final IOException e1) {
                 message("Directory will be deleted on VM exit " + RepoDirectory);
                 RepoDirectory.toFile().deleteOnExit();
             }
diff --git a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileName.java b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileName.java
index 6aefd1fe..fc2d6c9f 100644
--- a/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileName.java
+++ b/commons-vfs2-jackrabbit2/src/main/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileName.java
@@ -30,7 +30,7 @@ import org.apache.commons.vfs2.util.URIUtils;
 public class Webdav4FileName extends GenericURLFileName {
     private static final int BUFFER_SIZE = 250;
 
-    private boolean appendTrailingSlash;
+    private final boolean appendTrailingSlash;
 
     /**
      * Constructs a new instance.
@@ -67,7 +67,7 @@ public class Webdav4FileName extends GenericURLFileName {
      */
     public Webdav4FileName(final String scheme, final String hostName, final int port, final int defaultPort,
                            final String userName, final String password, final String path, final FileType type,
-                           final String queryString, boolean appendTrailingSlash) {
+                           final String queryString, final boolean appendTrailingSlash) {
         super(scheme, hostName, port, defaultPort, userName, password, path, type, queryString);
         this.appendTrailingSlash = appendTrailingSlash;
     }
diff --git a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileNameTest.java b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileNameTest.java
index 77cb58d5..63a0fafc 100644
--- a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileNameTest.java
+++ b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/Webdav4FileNameTest.java
@@ -35,8 +35,8 @@ public class Webdav4FileNameTest {
     @Test
     public void testWebdavUrlWithoutTrailingSlash() throws FileSystemException {
         @SuppressWarnings("resource")
-        FileSystemOptions fsoptsWithToutrailingSlashDefault = new FileSystemOptions();
-        FileSystemOptions fsoptsWithoutTrailingSlash = new FileSystemOptions();
+        final FileSystemOptions fsoptsWithToutrailingSlashDefault = new FileSystemOptions();
+        final FileSystemOptions fsoptsWithoutTrailingSlash = new FileSystemOptions();
         Webdav4FileSystemConfigBuilder.getInstance().setAppendTrailingSlash(fsoptsWithoutTrailingSlash, false);
         final FileSystemManager fileSystemManager = VFS.getManager();
 
@@ -195,6 +195,7 @@ public class Webdav4FileNameTest {
     @Test
     public void testWebdavUrlWithTrailingSlash() throws FileSystemException {
         @SuppressWarnings("resource")
+        final
         FileSystemOptions fsoptsWithTrailingSlash = new FileSystemOptions();
         Webdav4FileSystemConfigBuilder.getInstance().setAppendTrailingSlash(fsoptsWithTrailingSlash, true);
 
diff --git a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java
index ee52fce5..a529857a 100644
--- a/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java
+++ b/commons-vfs2-jackrabbit2/src/test/java/org/apache/commons/vfs2/provider/webdav4/test/Webdav4ProviderTestCase.java
@@ -290,7 +290,7 @@ public class Webdav4ProviderTestCase extends AbstractProviderTestConfig {
             message(e);
             try {
                 Files.delete(RepoDirectory);
-            } catch (IOException e1) {
+            } catch (final IOException e1) {
                 message("Directory will be deleted on VM exit " + RepoDirectory);
                 RepoDirectory.toFile().deleteOnExit();
             }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
index 3e6ba2f3..5f26e286 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/VfsClassLoaderTests.java
@@ -65,7 +65,7 @@ public class VfsClassLoaderTests extends AbstractProviderTestCase {
 
                 final Object testObject = testClass.getConstructor().newInstance();
                 assertEquals("**PRIVATE**", testObject.toString());
-            } catch (ReflectiveOperationException e) {
+            } catch (final ReflectiveOperationException e) {
                 throw new IllegalStateException(e);
             }
         }


(commons-vfs) 15/26: Use final

Posted by gg...@apache.org.
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 ccb1b2e3c38cff8cac5b70d3550fab6e8eef9bc3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:30:46 2024 -0500

    Use final
---
 .../apache/commons/vfs2/provider/sftp/SftpProviderIPv6TestCase.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderIPv6TestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderIPv6TestCase.java
index f7924453..016a3bd9 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderIPv6TestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderIPv6TestCase.java
@@ -37,7 +37,7 @@ public class SftpProviderIPv6TestCase extends AbstractSftpProviderTestCase {
 
     private static class MockedClientSftpFileProvider extends SftpFileProvider {
         @Override
-        protected FileSystem doCreateFileSystem(FileName name, FileSystemOptions fileSystemOptions) {
+        protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) {
             final GenericFileName rootName = (GenericFileName) name;
 
             final Session sessionMock = Mockito.mock(Session.class);
@@ -47,7 +47,7 @@ public class SftpProviderIPv6TestCase extends AbstractSftpProviderTestCase {
 
             try {
                 Mockito.when(sessionMock.openChannel(Mockito.anyString())).thenReturn(channelExecMock);
-            } catch (JSchException e) {
+            } catch (final JSchException e) {
                 throw new AssertionError("Should never happen", e);
             }
 
@@ -55,7 +55,7 @@ public class SftpProviderIPv6TestCase extends AbstractSftpProviderTestCase {
 
             try {
                 Mockito.when(channelExecMock.getInputStream()).thenReturn(new NullInputStream());
-            } catch (IOException e) {
+            } catch (final IOException e) {
                 throw new AssertionError("Should never happen", e);
             }
 


(commons-vfs) 13/26: Use final

Posted by gg...@apache.org.
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 ce584e34990f28c0a102b96827d84a360ed832f0
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:30:20 2024 -0500

    Use final
---
 .../main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java | 2 +-
 .../main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
index 681ddea0..dc58dd70 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileObject.java
@@ -214,7 +214,7 @@ public class SftpFileObject extends AbstractFileObject<SftpFileSystem> {
         final ChannelSftp channel = getAbstractFileSystem().getChannel();
         try {
             return new SftpOutputStream(channel, channel.put(relPath, bAppend ? ChannelSftp.APPEND : ChannelSftp.OVERWRITE));
-        } catch (Exception ex) {
+        } catch (final Exception ex) {
             putChannel(channel);
             throw ex;
         }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
index ccd3e80b..1d5fa41e 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java
@@ -179,7 +179,7 @@ public class SftpFileSystem extends AbstractFileSystem {
             while (!channel.isClosed()) {
                 try {
                     Thread.sleep(SLEEP_MILLIS);
-                } catch (InterruptedException e) {
+                } catch (final InterruptedException e) {
                     // Someone asked us to stop.
                     break;
                 }


(commons-vfs) 26/26: Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-vfs.git

Posted by gg...@apache.org.
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 a4186edf809581f50b8cce7efdb6513c6d9a195d
Merge: 76832b67 b75c001d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:35:49 2024 -0500

    Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-vfs.git

 pom.xml                 | 2 +-
 src/changes/changes.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


(commons-vfs) 02/26: Move ivar to local var

Posted by gg...@apache.org.
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 74b31427f3d794cebb494377f89b8751a9ac1d40
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:24:07 2024 -0500

    Move ivar to local var
---
 .../commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java      | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java
index d7d3aa54..fbc200d7 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/AbstractSftpProviderTestCase.java
@@ -421,8 +421,6 @@ abstract class AbstractSftpProviderTestCase extends AbstractProviderTestConfig {
         }
     }
 
-    private static int socketPort;
-
     private static final String DEFAULT_USER = "testtest";
 
     protected static String connectionUri;
@@ -545,7 +543,7 @@ abstract class AbstractSftpProviderTestCase extends AbstractProviderTestConfig {
         server.setFileSystemFactory(new TestFileSystemFactory());
         // HACK End
         server.start();
-        socketPort = server.getPort();
+        int socketPort = server.getPort();
         connectionUri = String.format("sftp://%s@localhost:%d", DEFAULT_USER, socketPort);
         // HACK Start
         // How do we really do simple security?


(commons-vfs) 01/26: Use final

Posted by gg...@apache.org.
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 0f9f3e01f98986fa65795f64bc3dd96d81a87e39
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:23:42 2024 -0500

    Use final
---
 .../commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java      | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
index b9018e90..c8399d96 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftps/AbstractFtpsProviderTestCase.java
@@ -157,7 +157,7 @@ abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig {
         if (embeddedFtpServer.isStopped() || embeddedFtpServer.isSuspended()) {
             try {
                 Thread.sleep(200);
-            } catch (InterruptedException e) {
+            } catch (final InterruptedException e) {
                 e.printStackTrace();
             }
         }
@@ -180,7 +180,7 @@ abstract class AbstractFtpsProviderTestCase extends AbstractProviderTestConfig {
                 System.out.println(String.format("Waiting %,d milliseconds for %s to stop", millis, embeddedFtpServer));
                 try {
                     Thread.sleep(millis);
-                } catch (InterruptedException e) {
+                } catch (final InterruptedException e) {
                     e.printStackTrace();
                 }
             }


(commons-vfs) 07/26: Use final

Posted by gg...@apache.org.
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 8ea7dc230b49a715d0f42dfe388cf56ec6e1001b
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:26:55 2024 -0500

    Use final
---
 .../commons/vfs2/provider/hdfs/HdfsFileSystemConfigBuilder.java       | 2 +-
 .../java/org/apache/commons/vfs2/provider/HostFileNameParser.java     | 2 +-
 .../org/apache/commons/vfs2/provider/ftp/FtpProviderIPv6TestCase.java | 2 +-
 .../org/apache/commons/vfs2/provider/test/GenericFileNameTest.java    | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/commons-vfs2-hdfs/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystemConfigBuilder.java b/commons-vfs2-hdfs/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystemConfigBuilder.java
index 0857126c..124292c1 100644
--- a/commons-vfs2-hdfs/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystemConfigBuilder.java
+++ b/commons-vfs2-hdfs/src/main/java/org/apache/commons/vfs2/provider/hdfs/HdfsFileSystemConfigBuilder.java
@@ -128,7 +128,7 @@ public final class HdfsFileSystemConfigBuilder extends FileSystemConfigBuilder {
         Arrays.setAll(realURLs, i -> {
             try {
                 return new URL(urls[i]);
-            } catch (MalformedURLException e) {
+            } catch (final MalformedURLException e) {
                 // This should never happen because we save it in the proper form.
                 throw new IllegalArgumentException(urls[i], e);
             }
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java
index 760bb9c9..ac275879 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/HostFileNameParser.java
@@ -155,7 +155,7 @@ public class HostFileNameParser extends AbstractFileNameParser {
                 || ch == '$' || ch == ',';
     }
 
-    private static boolean isIPv6Host(String name) {
+    private static boolean isIPv6Host(final String name) {
         return name.length() > 0 && isIPv6HostHeadingChar(name.charAt(0));
     }
 
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderIPv6TestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderIPv6TestCase.java
index c4f08712..6f3364b1 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderIPv6TestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ftp/FtpProviderIPv6TestCase.java
@@ -30,7 +30,7 @@ public class FtpProviderIPv6TestCase extends FtpProviderTestCase {
 
     private static class MockedClientFtpFileProvider extends FtpFileProvider {
         @Override
-        protected FileSystem doCreateFileSystem(FileName name, FileSystemOptions fileSystemOptions) {
+        protected FileSystem doCreateFileSystem(final FileName name, final FileSystemOptions fileSystemOptions) {
             final GenericFileName rootName = (GenericFileName) name;
             return new FtpFileSystem(rootName, Mockito.mock(FtpClient.class), fileSystemOptions);
         }
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/GenericFileNameTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/GenericFileNameTest.java
index 4280de95..d3c7284a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/GenericFileNameTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/test/GenericFileNameTest.java
@@ -105,7 +105,7 @@ public class GenericFileNameTest {
         // We don't strictly validate IPv6 host name, if it can be parsed out from URI
         // Assuming, it'll just fail on connection stage
 
-        GenericURLFileNameParser urlParser = new GenericURLFileNameParser(21);
+        final GenericURLFileNameParser urlParser = new GenericURLFileNameParser(21);
 
         // too few segments
         GenericFileName name = (GenericFileName) urlParser.parseUri(null, null, "ftp://[1:2e]:2222/test");
@@ -161,7 +161,7 @@ public class GenericFileNameTest {
 
     @Test
     public void testParseIPv6Uri() throws Exception {
-        GenericURLFileNameParser urlParser = new GenericURLFileNameParser(21);
+        final GenericURLFileNameParser urlParser = new GenericURLFileNameParser(21);
 
         // basic case
         GenericFileName name = (GenericFileName) urlParser.parseUri(


(commons-vfs) 16/26: Remove variable assignment just before returning it

Posted by gg...@apache.org.
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 eea14622103613a180da580777c4e298809e925d
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:30:52 2024 -0500

    Remove variable assignment just before returning it
---
 .../vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java        | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java
index fc5db3ba..f190d18a 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpProviderStreamProxyModeTestCase.java
@@ -35,7 +35,7 @@ public class SftpProviderStreamProxyModeTestCase extends AbstractSftpProviderTes
     // one test is run (we just test that the input/output are correctly forwarded, and
     // hence if the reading test succeeds/fails the other will also succeed/fail)
     public static Test suite() throws Exception {
-        final SftpProviderTestSuite suite = new SftpProviderTestSuite(new SftpProviderStreamProxyModeTestCase()) {
+        return new SftpProviderTestSuite(new SftpProviderStreamProxyModeTestCase()) {
             @Override
             protected void addBaseTests() throws Exception {
                 // Just tries to read
@@ -44,7 +44,6 @@ public class SftpProviderStreamProxyModeTestCase extends AbstractSftpProviderTes
                 addTests(PermissionsTests.class);
             }
         };
-        return suite;
     }
 
     @Override


(commons-vfs) 05/26: Use final

Posted by gg...@apache.org.
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 a72cdd50d16d28b42d78f03d2b57e06b2786c6b4
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:26:06 2024 -0500

    Use final
---
 .../src/test/java/org/apache/commons/vfs2/FileIteratorTest.java         | 2 +-
 .../java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java
index fd0d6769..e1fc0569 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/FileIteratorTest.java
@@ -82,7 +82,7 @@ public class FileIteratorTest {
             i++;
         }
         i = 0;
-        for (FileObject element : baseFolder) {
+        for (final FileObject element : baseFolder) {
             final FileObject expectedFile = findFiles[i];
             assertEquals(expectedFile, element);
             i++;
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java
index 646fc633..6675e31f 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java
@@ -218,7 +218,7 @@ public class DefaultFileSystemManagerTest {
             assertEquals(FileType.FILE, fileSystemManager.resolveName(baseNameFolder, "../Descendant Folder/../File.").getType());
             assertEquals(FileType.FILE, fileSystemManager.resolveName(baseNameFolder, "../Descendant Folder/../File..").getType());
 
-        } catch (FileSystemException e) {
+        } catch (final FileSystemException e) {
             fail(e);
         }
     }


(commons-vfs) 22/26: Use final

Posted by gg...@apache.org.
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 da728b586024129e306a324ff092874ce2c8f6d7
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:33:28 2024 -0500

    Use final
    
    Remove redundant parens
---
 .../apache/commons/vfs2/provider/UriParser.java    | 26 +++++++++++-----------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
index 120ef411..3df09a61 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/UriParser.java
@@ -470,7 +470,7 @@ public final class UriParser {
         private int lastSeparator;
         private int end;
 
-        PathNormalizer(StringBuilder path) {
+        PathNormalizer(final StringBuilder path) {
             this.path = path;
             this.end = path.length();
         }
@@ -482,7 +482,7 @@ public final class UriParser {
                 consumeSeparators();
                 if (readDot()) {
                     if (readDot()) {
-                        int beforeNextSeparator = cursor;
+                        final int beforeNextSeparator = cursor;
                         if (readSeparator() || cursor == end) {
                             // '/../'
                             removePreviousElement(beforeNextSeparator);
@@ -493,11 +493,11 @@ public final class UriParser {
                             readSeparator();
                         }
                     } else {
-                        int beforeNextSeparator = cursor;
+                        final int beforeNextSeparator = cursor;
                         if (readSeparator() || cursor == end) {
                             // '/./'
                             path.delete(lastSeparator, beforeNextSeparator);
-                            cursor = lastSeparator + (cursor - beforeNextSeparator);
+                            cursor = lastSeparator + cursor - beforeNextSeparator;
                             this.end = path.length();
                         } else {
                             // '/.other'
@@ -528,7 +528,7 @@ public final class UriParser {
             }
         }
 
-        private void removePreviousElement(int to) throws FileSystemException {
+        private void removePreviousElement(final int to) throws FileSystemException {
             if (lastSeparator == 0) {
                 // Previous element is missing
                 throw new FileSystemException("vfs.provider/invalid-relative-path.error");
@@ -566,7 +566,7 @@ public final class UriParser {
             if (cursor + 2 >= end) {
                 return false;
             }
-            String sub = path.substring(cursor, cursor + 3);
+            final String sub = path.substring(cursor, cursor + 3);
             if (sub.equals(URLENCODED_SLASH_LC) || sub.equals(URLENCODED_SLASH_UC)) {
                 cursor += 3;
                 return true;
@@ -585,7 +585,7 @@ public final class UriParser {
             if (cursor + 2 >= end) {
                 return false;
             }
-            String sub = path.substring(cursor, cursor + 3);
+            final String sub = path.substring(cursor, cursor + 3);
             if (sub.equals("%2e") || sub.equals("%2E")) {
                 cursor += 3;
                 return true;
@@ -594,7 +594,7 @@ public final class UriParser {
         }
 
         private boolean consumeSeparator() {
-            int from = cursor;
+            final int from = cursor;
             if (readSeparator()) {
                 path.delete(from, cursor);
                 cursor = from;
@@ -615,7 +615,7 @@ public final class UriParser {
                 cursor++;
                 return true;
             }
-            String sub = path.substring(cursor + 1, cursor + 3);
+            final String sub = path.substring(cursor + 1, cursor + 3);
             if (sub.equals(URLENCODED_SLASH_UC) || sub.equals(URLENCODED_SLASH_LC)) {
                 return false;
             }
@@ -649,8 +649,8 @@ public final class UriParser {
 
         // '/' or '.' or '..' or anyPath/..' or 'anyPath/.'  should always be a path
         if (path.charAt(path.length() - 1) != '/'
-                && path.lastIndexOf("/..") != (path.length() - 3)
-                && path.lastIndexOf("/.") != (path.length() - 2)
+                && path.lastIndexOf("/..") != path.length() - 3
+                && path.lastIndexOf("/.") != path.length() - 2
                 && path.lastIndexOf("..") != 0
                 && path.lastIndexOf(".") != 0
         ) {
@@ -665,12 +665,12 @@ public final class UriParser {
 
         // Remove trailing separator
         if (!VFS.isUriStyle()) {
-            int maxlen = path.length();
+            final int maxlen = path.length();
             if (maxlen > 1 && path.charAt(maxlen - 1) == SEPARATOR_CHAR) {
                 path.delete(maxlen - 1, maxlen);
             }
             if (maxlen > 3) {
-                String sub = path.substring(maxlen - 3);
+                final String sub = path.substring(maxlen - 3);
                 if (sub.equals(URLENCODED_SLASH_UC) || sub.equals(URLENCODED_SLASH_LC)) {
                     path.delete(maxlen - 3, maxlen);
                 }


(commons-vfs) 18/26: Use diamond notation

Posted by gg...@apache.org.
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 29266ee14dfb1a1683cba00d3ed32ce52bcbf7b3
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:32:01 2024 -0500

    Use diamond notation
    
    Remove redundant parens
---
 .../org/apache/commons/vfs2/util/SharedRandomContentInputStream.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java
index 910b8290..a43e11eb 100644
--- a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java
+++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/util/SharedRandomContentInputStream.java
@@ -42,7 +42,7 @@ public class SharedRandomContentInputStream extends BufferedInputStream implemen
     private long resetCount;
 
     public SharedRandomContentInputStream(final FileObject fo) throws FileSystemException {
-        this(new HashSet<SharedRandomContentInputStream>(), fo, 0, -1, fo.getContent().getInputStream());
+        this(new HashSet<>(), fo, 0, -1, fo.getContent().getInputStream());
     }
 
     private SharedRandomContentInputStream(final Set<SharedRandomContentInputStream> createdStreams,
@@ -69,7 +69,7 @@ public class SharedRandomContentInputStream extends BufferedInputStream implemen
     }
 
     private boolean checkEnd() {
-        return fileEnd > -1 && (getFilePosition() >= fileEnd);
+        return fileEnd > -1 && getFilePosition() >= fileEnd;
     }
 
     @Override


(commons-vfs) 17/26: Remove variable assignment just before returning it

Posted by gg...@apache.org.
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 97023c24b3979a0954c03ecefa8622811e602c06
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:31:49 2024 -0500

    Remove variable assignment just before returning it
---
 .../org/apache/commons/vfs2/provider/sftp/SftpPutChannelTestCase.java  | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPutChannelTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPutChannelTestCase.java
index aca908a0..6cbe6035 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPutChannelTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/sftp/SftpPutChannelTestCase.java
@@ -60,14 +60,13 @@ public class SftpPutChannelTestCase extends AbstractSftpProviderTestCase {
      * Creates the test suite for the sftp file system.
      */
     public static junit.framework.Test suite() throws Exception {
-        final SftpProviderTestSuite suite = new SftpProviderTestSuite(new SftpPutChannelTestCase()) {
+        return new SftpProviderTestSuite(new SftpPutChannelTestCase()) {
             @Override
             protected void addBaseTests() throws Exception {
                 // Just tries to read
                 addTests(SftpPutChannelTestCase.class);
             }
         };
-        return suite;
     }
 
     /**


(commons-vfs) 10/26: Move ivar to local var

Posted by gg...@apache.org.
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 4747e5358587155eac566dc8b2de0bf0061a5a56
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:27:22 2024 -0500

    Move ivar to local var
---
 .../org/apache/commons/vfs2/provider/http/HttpProviderTestCase.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpProviderTestCase.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpProviderTestCase.java
index 450a3078..64d49074 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpProviderTestCase.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/HttpProviderTestCase.java
@@ -43,8 +43,6 @@ public class HttpProviderTestCase extends AbstractProviderTestConfig {
 
     private static NHttpFileServer server;
 
-    private static int socketPort;
-
     private static final String TEST_URI = "test.http.uri";
 
     /**
@@ -63,7 +61,7 @@ public class HttpProviderTestCase extends AbstractProviderTestConfig {
      */
     private static void setUpClass() throws Exception {
         server = NHttpFileServer.start(0, new File(getTestDirectory()), 5000);
-        socketPort = server.getPort();
+        int socketPort = server.getPort();
         connectionUri = "http://localhost:" + socketPort;
     }
 


(commons-vfs) 19/26: Use compact array notation

Posted by gg...@apache.org.
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 85ff70b6df9bb7e031fc3d93fd67b38ce81fc6bb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:32:12 2024 -0500

    Use compact array notation
---
 .../main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java
index ffa9dace..4177592d 100644
--- a/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java
+++ b/commons-vfs2-sandbox/src/main/java/org/apache/commons/vfs2/provider/smb/SmbFileProvider.java
@@ -34,7 +34,7 @@ import org.apache.commons.vfs2.provider.FileProvider;
  */
 public class SmbFileProvider extends AbstractOriginatingFileProvider implements FileProvider {
     /** Authentication data supported by this provider. */
-    public static final UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = new UserAuthenticationData.Type[] {
+    public static final UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = {
             UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD, UserAuthenticationData.DOMAIN };
 
     static final Collection<Capability> capabilities = Collections


(commons-vfs) 20/26: Remove unused import

Posted by gg...@apache.org.
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 b141f97f2de7a1235aa01b546e3305efd445627e
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Feb 4 14:32:39 2024 -0500

    Remove unused import
---
 .../org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java  | 2 --
 1 file changed, 2 deletions(-)

diff --git a/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java b/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java
index a975bc47..58fa70a7 100644
--- a/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java
+++ b/commons-vfs2-sandbox/src/test/java/org/apache/commons/vfs2/provider/smb/test/SmbProviderTestCase.java
@@ -30,8 +30,6 @@ import org.junit.jupiter.api.Assertions;
 import junit.framework.Test;
 import junit.framework.TestSuite;
 
-import junit.framework.Test;
-
 /**
  * Tests for the SMB file system.
  */