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 37a15d5  Add @SuppressWarnings and use avoid naming confusion b/w File 
and FileObject.
37a15d5 is described below

commit 37a15d583c9bfe3d1bab5ebfcd86d8b1fbe30629
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sun Feb 28 09:08:25 2021 -0500

    Add @SuppressWarnings and use avoid naming confusion b/w File and
    FileObject.
---
 .../src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java
index 76b8ae9..0fa6a7b 100644
--- 
a/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java
+++ 
b/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java
@@ -78,11 +78,12 @@ public class LRUFilesCache extends AbstractFilesCache {
         @Override
         protected boolean removeLRU(final 
AbstractLinkedMap.LinkEntry<FileName, FileObject> linkEntry) {
             synchronized (LRUFilesCache.this) {
-                final FileObject file = linkEntry.getValue();
+                @SuppressWarnings("resource") // FileObject allocated 
elsewhere.
+                final FileObject fileObject = linkEntry.getValue();
 
                 // System.err.println(">>> " + size() + " check removeLRU:" + 
linkEntry.getKey().toString());
 
-                if (file.isAttached() || file.isContentOpen()) {
+                if (fileObject.isAttached() || fileObject.isContentOpen()) {
                     // do not allow open or attached files to be removed
                     // System.err.println(">>> " + size() + " VETO removeLRU:" 
+
                     // linkEntry.getKey().toString() + " (" + 
file.isAttached() + "/" +
@@ -94,7 +95,7 @@ public class LRUFilesCache extends AbstractFilesCache {
                 if (super.removeLRU(linkEntry)) {
                     try {
                         // force detach
-                        file.close();
+                        fileObject.close();
                     } catch (final FileSystemException e) {
                         VfsLog.warn(getLogger(), log, 
Messages.getString("vfs.impl/LRUFilesCache-remove-ex.warn"), e);
                     }

Reply via email to