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

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


The following commit(s) were added to refs/heads/master by this push:
     new f11dce3  Fix some compiler warnings.
f11dce3 is described below

commit f11dce3a45b5b19f24c997bdd3d1010743df7c5b
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Fri Feb 5 16:21:52 2021 -0500

    Fix some compiler warnings.
---
 .../vfs2/provider/http/GetContentInfoFunctionalTest.java    |  1 -
 .../commons/vfs2/provider/http/HttpProviderTestCase.java    |  9 ++-------
 .../vfs2/provider/http4/Http4GetContentInfoTest.java        | 13 +++++++------
 .../commons/vfs2/provider/http4/Http4ProviderTestCase.java  |  9 ++-------
 .../vfs2/provider/http5/Http5GetContentInfoTest.java        |  1 -
 .../commons/vfs2/provider/http5/Http5ProviderTestCase.java  |  9 ++-------
 .../vfs2/provider/https/GetContentInfoFunctionalTest.java   |  1 +
 7 files changed, 14 insertions(+), 29 deletions(-)

diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/GetContentInfoFunctionalTest.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/GetContentInfoFunctionalTest.java
index dc2f53a..10a3e7f 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/GetContentInfoFunctionalTest.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http/GetContentInfoFunctionalTest.java
@@ -25,7 +25,6 @@ import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileSystemManager;
 import org.apache.commons.vfs2.FileSystemOptions;
 import org.apache.commons.vfs2.VFS;
-import org.apache.commons.vfs2.provider.http.HttpFileSystemConfigBuilder;
 import org.junit.Assert;
 import org.junit.Test;
 
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 10cede7..c9108b9 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
@@ -17,7 +17,6 @@
 package org.apache.commons.vfs2.provider.http;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.vfs2.AbstractProviderTestConfig;
@@ -29,8 +28,6 @@ import org.apache.commons.vfs2.FileSystemOptions;
 import org.apache.commons.vfs2.ProviderTestSuite;
 import org.apache.commons.vfs2.VFS;
 import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.apache.commons.vfs2.provider.http.HttpFileProvider;
-import org.apache.commons.vfs2.provider.http.HttpFileSystemConfigBuilder;
 import org.apache.commons.vfs2.util.NHttpFileServer;
 import org.junit.Assert;
 
@@ -102,10 +99,8 @@ public class HttpProviderTestCase extends 
AbstractProviderTestConfig {
 
     /**
      * Stops the embedded Apache HTTP Server.
-     *
-     * @throws IOException
      */
-    private static void tearDownClass() throws IOException {
+    private static void tearDownClass() {
         if (Server != null) {
             Server.shutdown(5000, TimeUnit.SECONDS);
         }
@@ -174,7 +169,7 @@ public class HttpProviderTestCase extends 
AbstractProviderTestConfig {
     }
 
     /** Ensure VFS-453 options are present. */
-    public void testHttpTimeoutConfig() throws FileSystemException {
+    public void testHttpTimeoutConfig() {
         final FileSystemOptions opts = new FileSystemOptions();
         final HttpFileSystemConfigBuilder builder = 
HttpFileSystemConfigBuilder.getInstance();
 
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4GetContentInfoTest.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4GetContentInfoTest.java
index 1a7263d..c20f7dc 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4GetContentInfoTest.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http4/Http4GetContentInfoTest.java
@@ -25,7 +25,6 @@ import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileSystemManager;
 import org.apache.commons.vfs2.FileSystemOptions;
 import org.apache.commons.vfs2.VFS;
-import org.apache.commons.vfs2.provider.http4.Http4FileSystemConfigBuilder;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -43,13 +42,15 @@ public class Http4GetContentInfoTest extends TestCase {
      */
     @Test
     public void testGetContentInfo() throws FileSystemException, 
MalformedURLException {
+        @SuppressWarnings("resource") // getManager() returns a global.
         final FileSystemManager fsManager = VFS.getManager();
         final String uri = "http4://www.apache.org/licenses/LICENSE-2.0.txt";
-        final FileObject fo = fsManager.resolveFile(uri, 
getOptionsWithProxy());
-        final FileContent content = fo.getContent();
-        Assert.assertNotNull(content);
-        // Used to NPE before fix:
-        content.getContentInfo();
+        try (final FileObject fo = fsManager.resolveFile(uri, 
getOptionsWithProxy());
+            final FileContent content = fo.getContent()) {
+            Assert.assertNotNull(content);
+            // Used to NPE before fix:
+            content.getContentInfo();
+        }
     }
 
     FileSystemOptions getOptionsWithProxy() throws MalformedURLException {
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 0cdf3bf..05c0f5e 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
@@ -17,7 +17,6 @@
 package org.apache.commons.vfs2.provider.http4;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.vfs2.AbstractProviderTestConfig;
@@ -29,8 +28,6 @@ import org.apache.commons.vfs2.FileSystemOptions;
 import org.apache.commons.vfs2.ProviderTestSuite;
 import org.apache.commons.vfs2.VFS;
 import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.apache.commons.vfs2.provider.http4.Http4FileProvider;
-import org.apache.commons.vfs2.provider.http4.Http4FileSystemConfigBuilder;
 import org.apache.commons.vfs2.util.NHttpFileServer;
 import org.junit.Assert;
 
@@ -103,10 +100,8 @@ public class Http4ProviderTestCase extends 
AbstractProviderTestConfig {
 
     /**
      * Stops the embedded Apache HTTP Server.
-     *
-     * @throws IOException
      */
-    private static void tearDownClass() throws IOException {
+    private static void tearDownClass() {
         if (Server != null) {
             Server.shutdown(5000, TimeUnit.SECONDS);
         }
@@ -175,7 +170,7 @@ public class Http4ProviderTestCase extends 
AbstractProviderTestConfig {
     }
 
     /** Ensure VFS-453 options are present. */
-    public void testHttpTimeoutConfig() throws FileSystemException {
+    public void testHttpTimeoutConfig() {
         final FileSystemOptions opts = new FileSystemOptions();
         final Http4FileSystemConfigBuilder builder = 
Http4FileSystemConfigBuilder.getInstance();
 
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5GetContentInfoTest.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5GetContentInfoTest.java
index 5bb6954..7ea3a2e 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5GetContentInfoTest.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/http5/Http5GetContentInfoTest.java
@@ -25,7 +25,6 @@ import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileSystemManager;
 import org.apache.commons.vfs2.FileSystemOptions;
 import org.apache.commons.vfs2.VFS;
-import org.apache.commons.vfs2.provider.http5.Http5FileSystemConfigBuilder;
 import org.junit.Assert;
 import org.junit.Test;
 
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 5ceffc7..4313cb7 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
@@ -17,7 +17,6 @@
 package org.apache.commons.vfs2.provider.http5;
 
 import java.io.File;
-import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.vfs2.AbstractProviderTestConfig;
@@ -29,8 +28,6 @@ import org.apache.commons.vfs2.FileSystemOptions;
 import org.apache.commons.vfs2.ProviderTestSuite;
 import org.apache.commons.vfs2.VFS;
 import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.apache.commons.vfs2.provider.http5.Http5FileProvider;
-import org.apache.commons.vfs2.provider.http5.Http5FileSystemConfigBuilder;
 import org.apache.commons.vfs2.util.NHttpFileServer;
 import org.junit.Assert;
 
@@ -103,10 +100,8 @@ public class Http5ProviderTestCase extends 
AbstractProviderTestConfig {
 
     /**
      * Stops the embedded Apache HTTP Server.
-     *
-     * @throws IOException
      */
-    private static void tearDownClass() throws IOException {
+    private static void tearDownClass() {
         if (Server != null) {
             Server.shutdown(5000, TimeUnit.SECONDS);
         }
@@ -175,7 +170,7 @@ public class Http5ProviderTestCase extends 
AbstractProviderTestConfig {
     }
 
     /** Ensure VFS-453 options are present. */
-    public void testHttpTimeoutConfig() throws FileSystemException {
+    public void testHttpTimeoutConfig() {
         final FileSystemOptions opts = new FileSystemOptions();
         final Http5FileSystemConfigBuilder builder = 
Http5FileSystemConfigBuilder.getInstance();
 
diff --git 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/GetContentInfoFunctionalTest.java
 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/GetContentInfoFunctionalTest.java
index 0955e06..a6ad6dc 100644
--- 
a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/GetContentInfoFunctionalTest.java
+++ 
b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/https/GetContentInfoFunctionalTest.java
@@ -45,6 +45,7 @@ public class GetContentInfoFunctionalTest {
      */
     @Test
     public void testGetContentInfo() throws FileSystemException, 
MalformedURLException {
+        @SuppressWarnings("resource") // getManager() returns a global.
         final FileSystemManager fsManager = VFS.getManager();
         final String uri = "http://www.apache.org/licenses/LICENSE-2.0.txt";;
         try (final FileObject fo = fsManager.resolveFile(uri, 
getOptionsWithProxy());

Reply via email to