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 2017/09/14 19:26:44 UTC

svn commit: r1808381 [3/25] - in /commons/proper/vfs/trunk/commons-vfs2/src: main/java/org/apache/commons/vfs2/ main/java/org/apache/commons/vfs2/auth/ main/java/org/apache/commons/vfs2/cache/ main/java/org/apache/commons/vfs2/events/ main/java/org/apa...

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileTypeSelector.java Thu Sep 14 19:26:39 2017
@@ -19,44 +19,39 @@ package org.apache.commons.vfs2;
 /**
  * A {@link FileSelector} that selects files of a particular type.
  */
-public class FileTypeSelector
-    implements FileSelector
-{
+public class FileTypeSelector implements FileSelector {
     /** The FileType */
     private final FileType type;
 
     /**
      * Creates a new selector for the given file type.
      *
-     * @param type
-     *            The file type to select
+     * @param type The file type to select
      */
-    public FileTypeSelector(final FileType type)
-    {
+    public FileTypeSelector(final FileType type) {
         this.type = type;
     }
 
     /**
      * Determines if a file or folder should be selected.
+     * 
      * @param fileInfo The file selection information.
      * @return true if the file or folder should be selected.
      * @throws FileSystemException if an error occurs
      */
     @Override
-    public boolean includeFile(final FileSelectInfo fileInfo)
-        throws FileSystemException
-    {
+    public boolean includeFile(final FileSelectInfo fileInfo) throws FileSystemException {
         return fileInfo.getFile().getType() == type;
     }
 
     /**
      * Determines whether a folder should be traversed.
+     * 
      * @param fileInfo The file selection information.
      * @return true if the file or folder should be traversed.
      */
     @Override
-    public boolean traverseDescendents(final FileSelectInfo fileInfo)
-    {
+    public boolean traverseDescendents(final FileSelectInfo fileInfo) {
         return true;
     }
 }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FileUtil.java Thu Sep 14 19:26:39 2017
@@ -23,11 +23,9 @@ import java.io.OutputStream;
 /**
  * Utility methods for dealing with FileObjects.
  */
-public final class FileUtil
-{
+public final class FileUtil {
 
-    private FileUtil()
-    {
+    private FileUtil() {
     }
 
     /**
@@ -37,24 +35,18 @@ public final class FileUtil
      * @return The content as a byte array.
      * @throws IOException if the file content cannot be accessed.
      */
-    public static byte[] getContent(final FileObject file)
-        throws IOException
-    {
+    public static byte[] getContent(final FileObject file) throws IOException {
         final FileContent content = file.getContent();
         final int size = (int) content.getSize();
         final byte[] buf = new byte[size];
 
         final InputStream in = content.getInputStream();
-        try
-        {
+        try {
             int read = 0;
-            for (int pos = 0; pos < size && read >= 0; pos += read)
-            {
+            for (int pos = 0; pos < size && read >= 0; pos += read) {
                 read = in.read(buf, pos, size - pos);
             }
-        }
-        finally
-        {
+        } finally {
             in.close();
         }
 
@@ -63,30 +55,26 @@ public final class FileUtil
 
     /**
      * Writes the content of a file to an OutputStream.
+     * 
      * @param file The FileObject to write.
      * @param output The OutputStream to write to.
      * @throws IOException if an error occurs writing the file.
      * @see FileContent#write(OutputStream)
      */
-    public static void writeContent(final FileObject file,
-                                    final OutputStream output)
-        throws IOException
-    {
+    public static void writeContent(final FileObject file, final OutputStream output) throws IOException {
         file.getContent().write(output);
     }
 
     /**
      * Copies the content from a source file to a destination file.
+     * 
      * @param srcFile The source FileObject.
      * @param destFile The target FileObject
      * @throws IOException If an error occurs copying the file.
      * @see FileContent#write(FileContent)
      * @see FileContent#write(FileObject)
      */
-    public static void copyContent(final FileObject srcFile,
-                                   final FileObject destFile)
-        throws IOException
-    {
+    public static void copyContent(final FileObject srcFile, final FileObject destFile) throws IOException {
         srcFile.getContent().write(destFile);
     }
 

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FilesCache.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FilesCache.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FilesCache.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/FilesCache.java Thu Sep 14 19:26:39 2017
@@ -16,12 +16,10 @@
  */
 package org.apache.commons.vfs2;
 
-
 /**
  * The fileCache interface. Implementations of this interface are expected to be thread safe.
  */
-public interface FilesCache
-{
+public interface FilesCache {
     /**
      * Adds a FileObject to the cache.
      *
@@ -62,13 +60,12 @@ public interface FilesCache
      * Removes a file from cache.
      *
      * @param filesystem filesystem
-     * @param name       filename
+     * @param name filename
      */
     void removeFile(final FileSystem filesystem, final FileName name);
 
     /**
-     * If the cache uses timestamps it could use this method to handle
-     * updates of them.
+     * If the cache uses timestamps it could use this method to handle updates of them.
      *
      * @param file filename
      */

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/NameScope.java Thu Sep 14 19:26:39 2017
@@ -17,74 +17,64 @@
 package org.apache.commons.vfs2;
 
 /**
- * An enumerated type for file name scope, used when resolving a name relative
- * to a file.
+ * An enumerated type for file name scope, used when resolving a name relative to a file.
  */
-public enum NameScope
-{
+public enum NameScope {
     /**
-     * Resolve against the children of the base file.  The name is resolved
-     * as described by {@link #FILE_SYSTEM}.  However, an exception is
-     * thrown if the resolved file is not a direct child of the base file.
+     * Resolve against the children of the base file. The name is resolved as described by {@link #FILE_SYSTEM}.
+     * However, an exception is thrown if the resolved file is not a direct child of the base file.
      */
     CHILD("child"),
 
     /**
-     * Resolve against the descendants of the base file.  The name is resolved
-     * as described by {@link #FILE_SYSTEM}.  However, an exception is thrown
-     * if the resolved file is not a descendent of the base file.
+     * Resolve against the descendants of the base file. The name is resolved as described by {@link #FILE_SYSTEM}.
+     * However, an exception is thrown if the resolved file is not a descendent of the base file.
      */
     DESCENDENT("descendent"),
 
     /**
-     * Resolve against the descendants of the base file.  The name is resolved
-     * as described by {@link #FILE_SYSTEM}.  However, an exception is thrown
-     * if the resolved file is not a descendent of the base file, or the base
-     * files itself.
+     * Resolve against the descendants of the base file. The name is resolved as described by {@link #FILE_SYSTEM}.
+     * However, an exception is thrown if the resolved file is not a descendent of the base file, or the base files
+     * itself.
      */
     DESCENDENT_OR_SELF("descendent_or_self"),
 
     /**
      * Resolve against files in the same file system as the base file.
      * <p>
-     * If the supplied name is an absolute path, then it is resolved
-     * relative to the root of the file system that the base file belongs to.
-     * If a relative name is supplied, then it is resolved relative to the base
-     * file.
+     * If the supplied name is an absolute path, then it is resolved relative to the root of the file system that the
+     * base file belongs to. If a relative name is supplied, then it is resolved relative to the base file.
      * <p>
-     * The path may use any mix of {@code /}, {@code \}, or file
-     * system specific separators to separate elements in the path.  It may
-     * also contain {@code .} and {@code ..} elements.
+     * The path may use any mix of {@code /}, {@code \}, or file system specific separators to separate elements in the
+     * path. It may also contain {@code .} and {@code ..} elements.
      * <p>
-     * A path is considered absolute if it starts with a separator character,
-     * and relative if it does not.
+     * A path is considered absolute if it starts with a separator character, and relative if it does not.
      */
     FILE_SYSTEM("filesystem");
 
     /** The name */
     private final String realName;
 
-    private NameScope(final String name)
-    {
+    private NameScope(final String name) {
         this.realName = name;
     }
 
     /**
      * Returns the name of the scope.
+     * 
      * @return The name of the scope.
      */
     @Override
-    public String toString()
-    {
+    public String toString() {
         return realName;
     }
 
     /**
      * Returns the name of the scope.
+     * 
      * @return The name of the scope.
      */
-    public String getName()
-    {
+    public String getName() {
         return realName;
     }
 }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/PatternFileSelector.java Thu Sep 14 19:26:39 2017
@@ -23,8 +23,7 @@ import java.util.regex.Pattern;
  *
  * @since 2.1
  */
-public class PatternFileSelector implements FileSelector
-{
+public class PatternFileSelector implements FileSelector {
 
     /**
      * The extensions to select.
@@ -34,70 +33,58 @@ public class PatternFileSelector impleme
     /**
      * Creates a new selector for the given pattern.
      *
-     * @param pattern
-     *            The regular expressed used by this selector.
+     * @param pattern The regular expressed used by this selector.
      */
-    public PatternFileSelector(final Pattern pattern)
-    {
+    public PatternFileSelector(final Pattern pattern) {
         this.pattern = pattern;
     }
 
     /**
      * Creates a new selector for the given pattern.
      *
-     * @param regex
-     *            The regular expressed used by this selector.
+     * @param regex The regular expressed used by this selector.
      */
-    public PatternFileSelector(final String regex)
-    {
+    public PatternFileSelector(final String regex) {
         this(Pattern.compile(regex));
     }
 
     /**
      * Creates a new selector for the given Pattern and flags.
      *
-     * @param regex
-     *            The expression to be compiled
+     * @param regex The expression to be compiled
      *
-     * @param flags
-     *            Match flags, a bit mask.
+     * @param flags Match flags, a bit mask.
      *
      * @see Pattern#compile(String, int)
      */
-    public PatternFileSelector(final String regex, final int flags)
-    {
+    public PatternFileSelector(final String regex, final int flags) {
         this(Pattern.compile(regex, flags));
     }
 
     /**
      * Determines if a file or folder should be selected.
      *
-     * @param fileInfo
-     *            The file selection information.
+     * @param fileInfo The file selection information.
      * @return true if the file should be selected, false otherwise.
      */
     @Override
-    public boolean includeFile(final FileSelectInfo fileInfo)
-    {
+    public boolean includeFile(final FileSelectInfo fileInfo) {
         return this.pattern.matcher(fileInfo.getFile().getName().getPath()).matches();
     }
 
     @Override
-    public String toString()
-    {
+    public String toString() {
         return this.pattern.toString();
     }
 
     /**
      * Determines whether a folder should be traversed.
      *
-     * @param fileInfo
-     *            The file selection information.
+     * @param fileInfo The file selection information.
      * @return true if descendants should be traversed, false otherwise.
      */
     @Override
-    public boolean traverseDescendents(final FileSelectInfo fileInfo)
-    {
+    public boolean traverseDescendents(final FileSelectInfo fileInfo) {
         return true;
     }
 }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/RandomAccessContent.java Thu Sep 14 19:26:39 2017
@@ -24,8 +24,7 @@ import java.io.InputStream;
 /**
  * Provides random access over content.
  */
-public interface RandomAccessContent extends DataOutput, DataInput
-{
+public interface RandomAccessContent extends DataOutput, DataInput {
     /**
      * Closes this random access file stream and releases any system resources associated with the stream.
      * <p>
@@ -35,8 +34,7 @@ public interface RandomAccessContent ext
      * If this file has an associated channel then the channel is closed as well.
      * <p>
      *
-     * @throws IOException
-     *             if an I/O error occurs.
+     * @throws IOException if an I/O error occurs.
      */
     void close() throws IOException;
 
@@ -44,8 +42,7 @@ public interface RandomAccessContent ext
      * Returns the current offset in this file.
      *
      * @return the offset from the beginning of the file, in bytes, at which the next read or write occurs.
-     * @throws IOException
-     *             if an I/O error occurs.
+     * @throws IOException if an I/O error occurs.
      */
     long getFilePointer() throws IOException;
 
@@ -56,8 +53,7 @@ public interface RandomAccessContent ext
      * </p>
      *
      * @return the InputStream.
-     * @throws IOException
-     *             if an I/O error occurs.
+     * @throws IOException if an I/O error occurs.
      */
     InputStream getInputStream() throws IOException;
 
@@ -65,8 +61,7 @@ public interface RandomAccessContent ext
      * Returns the length of this file.
      *
      * @return the length of this file, measured in bytes.
-     * @throws IOException
-     *             if an I/O error occurs.
+     * @throws IOException if an I/O error occurs.
      */
     long length() throws IOException;
 
@@ -82,11 +77,9 @@ public interface RandomAccessContent ext
      * {@link #seek(long)}</b>
      * </p>
      *
-     * @param pos
-     *            the offset position, measured in bytes from the beginning of the file, at which to set the file
+     * @param pos the offset position, measured in bytes from the beginning of the file, at which to set the file
      *            pointer.
-     * @throws IOException
-     *             if {@code pos} is less than {@code 0} or if an I/O error occurs.
+     * @throws IOException if {@code pos} is less than {@code 0} or if an I/O error occurs.
      */
     void seek(long pos) throws IOException;
 
@@ -101,10 +94,8 @@ public interface RandomAccessContent ext
      * If the the {@code newLength} argument is greater than {@link #length()}, the content grows with undefined data.
      * </p>
      *
-     * @param newLength
-     *            The desired content length
-     * @throws IOException
-     *                If an I/O error occurs
+     * @param newLength The desired content length
+     * @throws IOException If an I/O error occurs
      * @since 2.1
      */
     void setLength(long newLength) throws IOException;

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/Selectors.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/Selectors.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/Selectors.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/Selectors.java Thu Sep 14 19:26:39 2017
@@ -19,28 +19,25 @@ package org.apache.commons.vfs2;
 /**
  * Several standard file selectors.
  */
-public final class Selectors
-{
+public final class Selectors {
     /**
      * A {@link FileSelector} that selects only the base file/folder.
      */
     public static final FileSelector SELECT_SELF = new FileDepthSelector();
 
     /**
-     * A {@link FileSelector} that selects the base file/folder and its
-     * direct children.
+     * A {@link FileSelector} that selects the base file/folder and its direct children.
      */
     public static final FileSelector SELECT_SELF_AND_CHILDREN = new FileDepthSelector(0, 1);
 
     /**
-     * A {@link FileSelector} that selects only the direct children
-     * of the base folder.
+     * A {@link FileSelector} that selects only the direct children of the base folder.
      */
     public static final FileSelector SELECT_CHILDREN = new FileDepthSelector(1);
 
     /**
-     * A {@link FileSelector} that selects all the descendants of the
-     * base folder, but does not select the base folder itself.
+     * A {@link FileSelector} that selects all the descendants of the base folder, but does not select the base folder
+     * itself.
      */
     public static final FileSelector EXCLUDE_SELF = new FileDepthSelector(1, Integer.MAX_VALUE);
 
@@ -55,15 +52,13 @@ public final class Selectors
     public static final FileSelector SELECT_FOLDERS = new FileTypeSelector(FileType.FOLDER);
 
     /**
-     * A {@link FileSelector} that selects the base file/folder, plus all
-     * its descendants.
+     * A {@link FileSelector} that selects the base file/folder, plus all its descendants.
      */
     public static final FileSelector SELECT_ALL = new AllFileSelector();
 
     /**
      * Prevent the class from being instantiated.
      */
-    private Selectors()
-    {
+    private Selectors() {
     }
 }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java Thu Sep 14 19:26:39 2017
@@ -23,13 +23,11 @@ import java.util.TreeMap;
 /**
  * Contains various authentication data.
  */
-public class UserAuthenticationData
-{
+public class UserAuthenticationData {
     /**
      * Represents a user authentication item.
      */
-    public static class Type implements Comparable<Type>
-    {
+    public static class Type implements Comparable<Type> {
         /** The type name */
         private final String type;
 
@@ -38,27 +36,22 @@ public class UserAuthenticationData
          *
          * @param type the type
          */
-        public Type(final String type)
-        {
+        public Type(final String type) {
             this.type = type;
         }
 
         @Override
-        public boolean equals(final Object o)
-        {
-            if (this == o)
-            {
+        public boolean equals(final Object o) {
+            if (this == o) {
                 return true;
             }
-            if (o == null || getClass() != o.getClass())
-            {
+            if (o == null || getClass() != o.getClass()) {
                 return false;
             }
 
             final Type type1 = (Type) o;
 
-            if (type != null ? !type.equals(type1.type) : type1.type != null)
-            {
+            if (type != null ? !type.equals(type1.type) : type1.type != null) {
                 return false;
             }
 
@@ -66,28 +59,25 @@ public class UserAuthenticationData
         }
 
         @Override
-        public int compareTo(final Type o)
-        {
+        public int compareTo(final Type o) {
             return type.compareTo(o.type);
         }
 
         /**
          * @return The hash code.
          * @since 2.0
-         * */
+         */
         @Override
-        public int hashCode()
-        {
+        public int hashCode() {
             return type != null ? type.hashCode() : 0;
         }
 
         /**
          * @return The type.
          * @since 2.0
-         * */
+         */
         @Override
-        public String toString()
-        {
+        public String toString() {
             return type;
         }
     }
@@ -107,48 +97,43 @@ public class UserAuthenticationData
     /**
      * Creates a new uninitialized instance.
      */
-    public UserAuthenticationData()
-    {
+    public UserAuthenticationData() {
         // do nothing
     }
 
     /**
      * Sets a data to this collection.
+     * 
      * @param type The Type to add
      * @param data The data associated with the Type
      */
-    public void setData(final Type type, final char[] data)
-    {
+    public void setData(final Type type, final char[] data) {
         authenticationData.put(type, data);
     }
 
     /**
      * Gets a data from the collection.
+     * 
      * @param type The Type to retrieve.
      * @return a character array containing the data associated with the type.
      */
-    public char[] getData(final Type type)
-    {
+    public char[] getData(final Type type) {
         return authenticationData.get(type);
     }
 
     /**
      * Deletes all data stored within this authenticator.
      */
-    public void cleanup()
-    {
+    public void cleanup() {
         // step 1: nullify character buffers
         final Iterator<char[]> iterAuthenticationData = authenticationData.values().iterator();
-        while (iterAuthenticationData.hasNext())
-        {
+        while (iterAuthenticationData.hasNext()) {
             final char[] data = iterAuthenticationData.next();
-            if (data == null || data.length < 0)
-            {
+            if (data == null || data.length < 0) {
                 continue;
             }
 
-            for (int i = 0; i < data.length; i++)
-            {
+            for (int i = 0; i < data.length; i++) {
                 data[i] = 0;
             }
         }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticator.java Thu Sep 14 19:26:39 2017
@@ -17,14 +17,14 @@
 package org.apache.commons.vfs2;
 
 /**
- * The user authenticator is used to query credentials from the user. Since a UserAuthenticator
- * is provided with the {@link FileSystemOptions} to a {@link FileSystem} it should also implement
- * reasonable equals and hashCode functions if the FileSystem should be shared.
+ * The user authenticator is used to query credentials from the user. Since a UserAuthenticator is provided with the
+ * {@link FileSystemOptions} to a {@link FileSystem} it should also implement reasonable equals and hashCode functions
+ * if the FileSystem should be shared.
  */
-public interface UserAuthenticator
-{
+public interface UserAuthenticator {
     /**
      * Queries the given type from the user.
+     * 
      * @param types An array containing the user's credentials
      * @return The UserAuthenticationData.
      */

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/VFS.java Thu Sep 14 19:26:39 2017
@@ -20,35 +20,28 @@ import java.lang.reflect.InvocationTarge
 import java.lang.reflect.Method;
 
 /**
- * The main entry point for the VFS.  Used to create {@link FileSystemManager}
- * instances.
+ * The main entry point for the VFS. Used to create {@link FileSystemManager} instances.
  */
-public final class VFS
-{
+public final class VFS {
     /** The URI style */
     private static Boolean uriStyle;
 
     /** The FileSystemManager */
     private static FileSystemManager instance;
 
-    private VFS()
-    {
+    private VFS() {
     }
 
     /**
      * Returns the default {@link FileSystemManager} instance.
      * <p>
-     * Warning, if you close this instance you may affect all current
-     * and future users of this manager singleton.
+     * Warning, if you close this instance you may affect all current and future users of this manager singleton.
      *
      * @return The FileSystemManager.
      * @throws FileSystemException if an error occurs creating the manager.
      */
-    public static synchronized FileSystemManager getManager()
-        throws FileSystemException
-    {
-        if (instance == null)
-        {
+    public static synchronized FileSystemManager getManager() throws FileSystemException {
+        if (instance == null) {
             instance = createManager("org.apache.commons.vfs2.impl.StandardFileSystemManager");
         }
         return instance;
@@ -56,59 +49,42 @@ public final class VFS
 
     /**
      * Creates a file system manager instance.
+     * 
      * @param managerClassName The specific manager impelmentation class name.
      * @return The FileSystemManager.
      * @throws FileSystemException if an error occurs creating the manager.
      */
-    private static FileSystemManager createManager(final String managerClassName)
-        throws FileSystemException
-    {
-        try
-        {
+    private static FileSystemManager createManager(final String managerClassName) throws FileSystemException {
+        try {
             // Create instance
             final Class<?> mgrClass = Class.forName(managerClassName);
             final FileSystemManager mgr = (FileSystemManager) mgrClass.newInstance();
 
-            try
-            {
+            try {
                 // Initialize
                 final Method initMethod = mgrClass.getMethod("init", (Class[]) null);
                 initMethod.invoke(mgr, (Object[]) null);
-            }
-            catch (final NoSuchMethodException ignored)
-            {
+            } catch (final NoSuchMethodException ignored) {
                 /* Ignore; don't initialize. */
             }
 
             return mgr;
-        }
-        catch (final InvocationTargetException e)
-        {
-            throw new FileSystemException("vfs/create-manager.error",
-                managerClassName,
-                e.getTargetException());
-        }
-        catch (final Exception e)
-        {
-            throw new FileSystemException("vfs/create-manager.error",
-                managerClassName,
-                e);
+        } catch (final InvocationTargetException e) {
+            throw new FileSystemException("vfs/create-manager.error", managerClassName, e.getTargetException());
+        } catch (final Exception e) {
+            throw new FileSystemException("vfs/create-manager.error", managerClassName, e);
         }
     }
 
-    public static boolean isUriStyle()
-    {
-        if (uriStyle == null)
-        {
+    public static boolean isUriStyle() {
+        if (uriStyle == null) {
             uriStyle = Boolean.FALSE;
         }
         return uriStyle.booleanValue();
     }
 
-    public static void setUriStyle(final boolean uriStyle)
-    {
-        if (VFS.uriStyle != null && VFS.uriStyle.booleanValue() != uriStyle)
-        {
+    public static void setUriStyle(final boolean uriStyle) {
+        if (VFS.uriStyle != null && VFS.uriStyle.booleanValue() != uriStyle) {
             throw new IllegalStateException("VFS.uriStyle was already set differently.");
         }
         VFS.uriStyle = Boolean.valueOf(uriStyle);

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/VfsLog.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/VfsLog.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/VfsLog.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/VfsLog.java Thu Sep 14 19:26:39 2017
@@ -19,198 +19,165 @@ package org.apache.commons.vfs2;
 import org.apache.commons.logging.Log;
 
 /**
- * This class is to keep the old logging behaviour (for ant-task) and to be able to
- * correctly use commons-logging.<br>
+ * This class is to keep the old logging behaviour (for ant-task) and to be able to correctly use commons-logging.<br>
  * I hope i could remove it sometimes.
  */
-public final class VfsLog
-{
+public final class VfsLog {
     // static utility class
-    private VfsLog()
-    {
+    private VfsLog() {
     }
 
     /**
      * warning.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      * @param t The exception, if any.
      */
-    public static void warn(final Log vfslog, final Log commonslog, final String message, final Throwable t)
-    {
-        if (vfslog != null)
-        {
+    public static void warn(final Log vfslog, final Log commonslog, final String message, final Throwable t) {
+        if (vfslog != null) {
             vfslog.warn(message, t);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.warn(message, t);
         }
     }
 
     /**
      * warning.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      */
-    public static void warn(final Log vfslog, final Log commonslog, final String message)
-    {
-        if (vfslog != null)
-        {
+    public static void warn(final Log vfslog, final Log commonslog, final String message) {
+        if (vfslog != null) {
             vfslog.warn(message);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.warn(message);
         }
     }
 
     /**
      * debug.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      */
-    public static void debug(final Log vfslog, final Log commonslog, final String message)
-    {
-        if (vfslog != null)
-        {
+    public static void debug(final Log vfslog, final Log commonslog, final String message) {
+        if (vfslog != null) {
             vfslog.debug(message);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.debug(message);
         }
     }
 
     /**
      * debug.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      * @param t The exception, if any.
      */
-    public static void debug(final Log vfslog, final Log commonslog, final String message, final Throwable t)
-    {
-        if (vfslog != null)
-        {
+    public static void debug(final Log vfslog, final Log commonslog, final String message, final Throwable t) {
+        if (vfslog != null) {
             vfslog.debug(message, t);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.debug(message, t);
         }
     }
 
     /**
      * info.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      * @param t The exception, if any.
      */
-    public static void info(final Log vfslog, final Log commonslog, final String message, final Throwable t)
-    {
-        if (vfslog != null)
-        {
+    public static void info(final Log vfslog, final Log commonslog, final String message, final Throwable t) {
+        if (vfslog != null) {
             vfslog.info(message, t);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.info(message, t);
         }
     }
 
     /**
      * info.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      */
-    public static void info(final Log vfslog, final Log commonslog, final String message)
-    {
-        if (vfslog != null)
-        {
+    public static void info(final Log vfslog, final Log commonslog, final String message) {
+        if (vfslog != null) {
             vfslog.info(message);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.info(message);
         }
     }
 
     /**
      * error.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      * @param t The exception, if any.
      */
-    public static void error(final Log vfslog, final Log commonslog, final String message, final Throwable t)
-    {
-        if (vfslog != null)
-        {
+    public static void error(final Log vfslog, final Log commonslog, final String message, final Throwable t) {
+        if (vfslog != null) {
             vfslog.error(message, t);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.error(message, t);
         }
     }
 
     /**
      * error.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      */
-    public static void error(final Log vfslog, final Log commonslog, final String message)
-    {
-        if (vfslog != null)
-        {
+    public static void error(final Log vfslog, final Log commonslog, final String message) {
+        if (vfslog != null) {
             vfslog.error(message);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.error(message);
         }
     }
 
     /**
      * fatal.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      * @param t The exception, if any.
      */
-    public static void fatal(final Log vfslog, final Log commonslog, final String message, final Throwable t)
-    {
-        if (vfslog != null)
-        {
+    public static void fatal(final Log vfslog, final Log commonslog, final String message, final Throwable t) {
+        if (vfslog != null) {
             vfslog.fatal(message, t);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.fatal(message, t);
         }
     }
 
     /**
      * fatal.
+     * 
      * @param vfslog The base component Logger to use.
      * @param commonslog The class specific Logger
      * @param message The message to log.
      */
-    public static void fatal(final Log vfslog, final Log commonslog, final String message)
-    {
-        if (vfslog != null)
-        {
+    public static void fatal(final Log vfslog, final Log commonslog, final String message) {
+        if (vfslog != null) {
             vfslog.fatal(message);
-        }
-        else if (commonslog != null)
-        {
+        } else if (commonslog != null) {
             commonslog.fatal(message);
         }
     }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/auth/StaticUserAuthenticator.java Thu Sep 14 19:26:39 2017
@@ -25,8 +25,7 @@ import org.apache.commons.vfs2.util.User
 /**
  * Provides always the same credentials data passed in with the constructor.
  */
-public class StaticUserAuthenticator implements UserAuthenticator, Comparable<StaticUserAuthenticator>
-{
+public class StaticUserAuthenticator implements UserAuthenticator, Comparable<StaticUserAuthenticator> {
     private static final Log LOG = LogFactory.getLog(StaticUserAuthenticator.class);
 
     /** The user name */
@@ -38,38 +37,27 @@ public class StaticUserAuthenticator imp
     /** The user's domain */
     private final String domain;
 
-    public StaticUserAuthenticator(final String domain, final String username, final String password)
-    {
+    public StaticUserAuthenticator(final String domain, final String username, final String password) {
         this.username = username;
         this.password = password;
         this.domain = domain;
     }
 
     @Override
-    public UserAuthenticationData requestAuthentication(final UserAuthenticationData.Type[] types)
-    {
+    public UserAuthenticationData requestAuthentication(final UserAuthenticationData.Type[] types) {
         final UserAuthenticationData data = new UserAuthenticationData();
-        for (final UserAuthenticationData.Type type : types)
-        {
-            if (type == UserAuthenticationData.DOMAIN)
-            {
+        for (final UserAuthenticationData.Type type : types) {
+            if (type == UserAuthenticationData.DOMAIN) {
                 data.setData(UserAuthenticationData.DOMAIN, UserAuthenticatorUtils.toChar(domain));
-            }
-            else if (type == UserAuthenticationData.USERNAME)
-            {
+            } else if (type == UserAuthenticationData.USERNAME) {
                 data.setData(UserAuthenticationData.USERNAME, UserAuthenticatorUtils.toChar(username));
-            }
-            else if (type == UserAuthenticationData.PASSWORD)
-            {
+            } else if (type == UserAuthenticationData.PASSWORD) {
                 data.setData(UserAuthenticationData.PASSWORD, UserAuthenticatorUtils.toChar(password));
-            }
-            else
-            {
-                if (LOG.isDebugEnabled())
-                {
+            } else {
+                if (LOG.isDebugEnabled()) {
                     LOG.debug(StaticUserAuthenticator.class.getSimpleName()
-                        + " does not support authentication data type '" + type
-                        + "'; authentication request for this type ignored.");
+                            + " does not support authentication data type '" + type
+                            + "'; authentication request for this type ignored.");
                 }
             }
         }
@@ -78,11 +66,11 @@ public class StaticUserAuthenticator imp
 
     /**
      * {@inheritDoc}
+     * 
      * @since 2.0
      */
     @Override
-    public int hashCode()
-    {
+    public int hashCode() {
         final int prime = 37;
         int result = 1;
         result = prime * result + (domain == null ? 0 : domain.hashCode());
@@ -94,43 +82,34 @@ public class StaticUserAuthenticator imp
 
     /**
      * {@inheritDoc}
+     * 
      * @since 2.0
      */
     @Override
-    public boolean equals(final Object obj)
-    {
-        if (this == obj)
-        {
+    public boolean equals(final Object obj) {
+        if (this == obj) {
             return true;
         }
 
-        if (obj == null)
-        {
+        if (obj == null) {
             return false;
         }
 
-        if (getClass() != obj.getClass())
-        {
+        if (getClass() != obj.getClass()) {
             return false;
         }
 
         final StaticUserAuthenticator other = (StaticUserAuthenticator) obj;
-        return equalsNullsafe(domain, other.domain)
-                && equalsNullsafe(username, other.username)
+        return equalsNullsafe(domain, other.domain) && equalsNullsafe(username, other.username)
                 && equalsNullsafe(password, other.password);
     }
 
-    private boolean equalsNullsafe(final String thisString, final String otherString)
-    {
-        if (thisString == null)
-        {
-            if (otherString != null)
-            {
+    private boolean equalsNullsafe(final String thisString, final String otherString) {
+        if (thisString == null) {
+            if (otherString != null) {
                 return false;
             }
-        }
-        else if (!thisString.equals(otherString))
-        {
+        } else if (!thisString.equals(otherString)) {
             return false;
         }
         return true;
@@ -138,11 +117,11 @@ public class StaticUserAuthenticator imp
 
     /**
      * {@inheritDoc}
+     * 
      * @since 2.0
      */
     @Override
-    public int compareTo(final StaticUserAuthenticator other)
-    {
+    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;
@@ -150,25 +129,18 @@ public class StaticUserAuthenticator imp
         return result;
     }
 
-    private int compareStringOrNull(final String thisString, final String otherString)
-    {
-        if (thisString == null)
-        {
-            if (otherString != null)
-            {
+    private int compareStringOrNull(final String thisString, final String otherString) {
+        if (thisString == null) {
+            if (otherString != null) {
                 return -1;
             }
-        }
-        else
-        {
-            if (otherString == null)
-            {
+        } else {
+            if (otherString == null) {
                 return 1;
             }
 
             final int result = thisString.compareTo(otherString);
-            if (result != 0)
-            {
+            if (result != 0) {
                 return result;
             }
         }
@@ -178,26 +150,21 @@ public class StaticUserAuthenticator imp
 
     /**
      * {@inheritDoc}
+     * 
      * @since 2.0
      */
     @Override
-    public String toString()
-    {
+    public String toString() {
         final StringBuilder buffer = new StringBuilder();
-        if (domain != null)
-        {
+        if (domain != null) {
             buffer.append(domain).append('\\');
         }
-        if (username != null)
-        {
+        if (username != null) {
             buffer.append(username);
-        }
-        else
-        {
+        } else {
             buffer.append("(null)");
         }
-        if (password != null)
-        {
+        if (password != null) {
             buffer.append(":***");
         }
         return buffer.toString();

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/AbstractFilesCache.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/AbstractFilesCache.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/AbstractFilesCache.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/AbstractFilesCache.java Thu Sep 14 19:26:39 2017
@@ -20,14 +20,11 @@ import org.apache.commons.vfs2.FileObjec
 import org.apache.commons.vfs2.FilesCache;
 import org.apache.commons.vfs2.provider.AbstractVfsComponent;
 
-
 /**
  * Abstract base class for FilesCache implementations.
  */
-public abstract class AbstractFilesCache extends AbstractVfsComponent implements FilesCache
-{
+public abstract class AbstractFilesCache extends AbstractVfsComponent implements FilesCache {
     // @Override - commented in FilesCache interface
-    public void touchFile(final FileObject file)
-    {
+    public void touchFile(final FileObject file) {
     }
 }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/DefaultFilesCache.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/DefaultFilesCache.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/DefaultFilesCache.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/DefaultFilesCache.java Thu Sep 14 19:26:39 2017
@@ -27,47 +27,40 @@ import org.apache.commons.vfs2.FileSyste
 /**
  * A simple {@link org.apache.commons.vfs2.FilesCache FilesCache} implementation.
  * <p>
- * This implementation caches every file with no expire or limit.
- * All files and filesystems are hard reachable references. This implementation
- * holds a list of filesystem specific {@linkplain ConcurrentHashMap ConcurrentHashMaps} in
- * the main cache map.
+ * This implementation caches every file with no expire or limit. All files and filesystems are hard reachable
+ * references. This implementation holds a list of filesystem specific {@linkplain ConcurrentHashMap ConcurrentHashMaps}
+ * in the main cache map.
  * <p>
- * Cached {@linkplain FileObject FileObjects} as well as {@linkplain FileSystem FileSystems}
- * are only removed when {@link #clear(FileSystem)} is called (i.e. on filesystem close).
- * When the used {@link org.apache.commons.vfs2.FileSystemManager FileSystemManager} is closed,
- * it will also {@linkplain #close() close} this cache (which frees all entries).
+ * Cached {@linkplain FileObject FileObjects} as well as {@linkplain FileSystem FileSystems} are only removed when
+ * {@link #clear(FileSystem)} is called (i.e. on filesystem close). When the used
+ * {@link org.apache.commons.vfs2.FileSystemManager FileSystemManager} is closed, it will also {@linkplain #close()
+ * close} this cache (which frees all entries).
  * <p>
  * Despite its name, this is not the fallback implementation used by
- * {@link org.apache.commons.vfs2.impl.DefaultFileSystemManager#init() DefaultFileSystemManager#init()}
- * anymore.
+ * {@link org.apache.commons.vfs2.impl.DefaultFileSystemManager#init() DefaultFileSystemManager#init()} anymore.
  */
-public class DefaultFilesCache extends AbstractFilesCache
-{
+public class DefaultFilesCache extends AbstractFilesCache {
     /** The FileSystem cache. Keeps one Map for each FileSystem. */
-    private final ConcurrentMap<FileSystem, ConcurrentMap<FileName, FileObject>> filesystemCache =
-                    new ConcurrentHashMap<>(10);
+    private final ConcurrentMap<FileSystem, ConcurrentMap<FileName, FileObject>> filesystemCache = new ConcurrentHashMap<>(
+            10);
 
     @Override
-    public void putFile(final FileObject file)
-    {
+    public void putFile(final FileObject file) {
         final Map<FileName, FileObject> files = getOrCreateFilesystemCache(file.getFileSystem());
         files.put(file.getName(), file);
     }
 
     @Override
-    public boolean putFileIfAbsent(final FileObject file)
-    {
+    public boolean putFileIfAbsent(final FileObject file) {
         final ConcurrentMap<FileName, FileObject> files = getOrCreateFilesystemCache(file.getFileSystem());
         return files.putIfAbsent(file.getName(), file) == null;
     }
 
     @Override
-    public FileObject getFile(final FileSystem filesystem, final FileName name)
-    {
+    public FileObject getFile(final FileSystem filesystem, final FileName name) {
         // avoid creating filesystem entry for empty filesystem cache:
         final Map<FileName, FileObject> files = filesystemCache.get(filesystem);
-        if (files == null)
-        {
+        if (files == null) {
             // cache for filesystem is not known => file is not cached:
             return null;
         }
@@ -76,22 +69,18 @@ public class DefaultFilesCache extends A
     }
 
     @Override
-    public void clear(final FileSystem filesystem)
-    {
+    public void clear(final FileSystem filesystem) {
         // avoid keeping a reference to the FileSystem (key) object
         final Map<FileName, FileObject> files = filesystemCache.remove(filesystem);
-        if (files != null)
-        {
+        if (files != null) {
             files.clear(); // help GC
         }
     }
 
-    protected ConcurrentMap<FileName, FileObject> getOrCreateFilesystemCache(final FileSystem filesystem)
-    {
+    protected ConcurrentMap<FileName, FileObject> getOrCreateFilesystemCache(final FileSystem filesystem) {
         ConcurrentMap<FileName, FileObject> files = filesystemCache.get(filesystem);
         // we loop to make sure we never return null even when concurrent clean is called
-        while (files == null)
-        {
+        while (files == null) {
             filesystemCache.putIfAbsent(filesystem, new ConcurrentHashMap<FileName, FileObject>(200, 0.75f, 8));
             files = filesystemCache.get(filesystem);
         }
@@ -100,20 +89,17 @@ public class DefaultFilesCache extends A
     }
 
     @Override
-    public void close()
-    {
+    public void close() {
         super.close();
 
         filesystemCache.clear();
     }
 
     @Override
-    public void removeFile(final FileSystem filesystem, final FileName name)
-    {
+    public void removeFile(final FileSystem filesystem, final FileName name) {
         // avoid creating filesystem entry for empty filesystem cache:
         final Map<FileName, FileObject> files = filesystemCache.get(filesystem);
-        if (files != null)
-        {
+        if (files != null) {
             files.remove(name);
             // This would be too racey:
             // if (files.empty()) filesystemCache.remove(filessystem);

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/FileSystemAndNameKey.java Thu Sep 14 19:26:39 2017
@@ -24,8 +24,7 @@ import org.apache.commons.vfs2.FileSyste
  * <p>
  * It compares the fileSystem (by hashCode) and the filename.
  */
-class FileSystemAndNameKey implements Comparable<FileSystemAndNameKey>
-{
+class FileSystemAndNameKey implements Comparable<FileSystemAndNameKey> {
     /** The FileSystem */
     private final FileSystem fileSystem;
 
@@ -35,8 +34,7 @@ class FileSystemAndNameKey implements Co
     /** hashcode to identify this object */
     private final int fileSystemId;
 
-    FileSystemAndNameKey(final FileSystem fileSystem, final FileName fileName)
-    {
+    FileSystemAndNameKey(final FileSystem fileSystem, final FileName fileName) {
         this.fileSystem = fileSystem;
         this.fileSystemId = System.identityHashCode(fileSystem);
 
@@ -44,27 +42,22 @@ class FileSystemAndNameKey implements Co
     }
 
     @Override
-    public int compareTo(final FileSystemAndNameKey other)
-    {
-        if (fileSystemId < other.fileSystemId)
-        {
+    public int compareTo(final FileSystemAndNameKey other) {
+        if (fileSystemId < other.fileSystemId) {
             return -1;
         }
-        if (fileSystemId > other.fileSystemId)
-        {
+        if (fileSystemId > other.fileSystemId) {
             return 1;
         }
 
         return fileName.compareTo(other.fileName);
     }
 
-    FileSystem getFileSystem()
-    {
+    FileSystem getFileSystem() {
         return fileSystem;
     }
 
-    FileName getFileName()
-    {
+    FileName getFileName() {
         return fileName;
     }
 }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/LRUFilesCache.java Thu Sep 14 19:26:39 2017
@@ -39,8 +39,7 @@ import org.apache.commons.vfs2.util.Mess
  * <p>
  * The default constructor uses a LRU size of 100 per filesystem.
  */
-public class LRUFilesCache extends AbstractFilesCache
-{
+public class LRUFilesCache extends AbstractFilesCache {
     /** The default LRU size */
     private static final int DEFAULT_LRU_SIZE = 100;
 
@@ -48,8 +47,7 @@ public class LRUFilesCache extends Abstr
     private static final Log log = LogFactory.getLog(LRUFilesCache.class);
 
     /** The FileSystem cache */
-    private final ConcurrentMap<FileSystem, Map<FileName, FileObject>> filesystemCache =
-          new ConcurrentHashMap<>(10);
+    private final ConcurrentMap<FileSystem, Map<FileName, FileObject>> filesystemCache = new ConcurrentHashMap<>(10);
 
     /** The size of the cache */
     private final int lruSize;
@@ -61,8 +59,7 @@ public class LRUFilesCache extends Abstr
     /**
      * The file cache
      */
-    private class MyLRUMap extends LRUMap<FileName, FileObject>
-    {
+    private class MyLRUMap extends LRUMap<FileName, FileObject> {
         /**
          * serialVersionUID format is YYYYMMDD for the date of the last binary change.
          */
@@ -71,46 +68,37 @@ public class LRUFilesCache extends Abstr
         /** The FileSystem */
         private final FileSystem filesystem;
 
-        public MyLRUMap(final FileSystem filesystem, final int size)
-        {
+        public MyLRUMap(final FileSystem filesystem, final int size) {
             super(size, true);
             this.filesystem = filesystem;
         }
 
         @Override
-        protected boolean removeLRU(final AbstractLinkedMap.LinkEntry<FileName, FileObject> linkEntry)
-        {
-            synchronized (LRUFilesCache.this)
-            {
+        protected boolean removeLRU(final AbstractLinkedMap.LinkEntry<FileName, FileObject> linkEntry) {
+            synchronized (LRUFilesCache.this) {
                 final FileObject file = linkEntry.getValue();
 
                 // System.err.println(">>> " + size() + " check removeLRU:" + linkEntry.getKey().toString());
 
-                if (file.isAttached() || file.isContentOpen())
-                {
+                if (file.isAttached() || file.isContentOpen()) {
                     // do not allow open or attached files to be removed
                     // System.err.println(">>> " + size() + " VETO removeLRU:" +
-                    //    linkEntry.getKey().toString() + " (" + file.isAttached() + "/" +
-                    //    file.isContentOpen() + ")");
+                    // linkEntry.getKey().toString() + " (" + file.isAttached() + "/" +
+                    // file.isContentOpen() + ")");
                     return false;
                 }
 
                 // System.err.println(">>> " + size() + " removeLRU:" + linkEntry.getKey().toString());
-                if (super.removeLRU(linkEntry))
-                {
-                    try
-                    {
+                if (super.removeLRU(linkEntry)) {
+                    try {
                         // force detach
                         file.close();
-                    }
-                    catch (final FileSystemException e)
-                    {
+                    } catch (final FileSystemException e) {
                         VfsLog.warn(getLogger(), log, Messages.getString("vfs.impl/LRUFilesCache-remove-ex.warn"), e);
                     }
 
                     final Map<?, ?> files = filesystemCache.get(filesystem);
-                    if (files.size() < 1)
-                    {
+                    if (files.size() < 1) {
                         filesystemCache.remove(filesystem);
                     }
 
@@ -125,8 +113,7 @@ public class LRUFilesCache extends Abstr
     /**
      * Default constructor. Uses a LRU size of 100 per filesystem.
      */
-    public LRUFilesCache()
-    {
+    public LRUFilesCache() {
         this(DEFAULT_LRU_SIZE);
     }
 
@@ -135,91 +122,70 @@ public class LRUFilesCache extends Abstr
      *
      * @param lruSize the LRU size
      */
-    public LRUFilesCache(final int lruSize)
-    {
+    public LRUFilesCache(final int lruSize) {
         this.lruSize = lruSize;
     }
 
     @Override
-    public void putFile(final FileObject file)
-    {
+    public void putFile(final FileObject file) {
         final Map<FileName, FileObject> files = getOrCreateFilesystemCache(file.getFileSystem());
 
         writeLock.lock();
-        try
-        {
+        try {
             files.put(file.getName(), file);
-        }
-        finally
-        {
+        } finally {
             writeLock.unlock();
         }
     }
 
-
     @Override
-    public boolean putFileIfAbsent(final FileObject file)
-    {
+    public boolean putFileIfAbsent(final FileObject file) {
         final Map<FileName, FileObject> files = getOrCreateFilesystemCache(file.getFileSystem());
 
         writeLock.lock();
-        try
-        {
+        try {
             final FileName name = file.getName();
 
-            if (files.containsKey(name))
-            {
+            if (files.containsKey(name)) {
                 return false;
             }
 
             files.put(name, file);
             return true;
-        }
-        finally
-        {
+        } finally {
             writeLock.unlock();
         }
     }
 
     @Override
-    public FileObject getFile(final FileSystem filesystem, final FileName name)
-    {
+    public FileObject getFile(final FileSystem filesystem, final FileName name) {
         final Map<FileName, FileObject> files = getOrCreateFilesystemCache(filesystem);
 
         readLock.lock();
-        try
-        {
+        try {
             return files.get(name);
-        }
-        finally
-        {
+        } finally {
             readLock.unlock();
         }
     }
 
     @Override
-    public void clear(final FileSystem filesystem)
-    {
+    public void clear(final FileSystem filesystem) {
         final Map<FileName, FileObject> files = getOrCreateFilesystemCache(filesystem);
 
         writeLock.lock();
-        try
-        {
+        try {
             files.clear();
 
             filesystemCache.remove(filesystem);
-        }
-        finally
-        {
+        } finally {
             writeLock.unlock();
         }
     }
 
-    protected Map<FileName, FileObject> getOrCreateFilesystemCache(final FileSystem filesystem)
-    {
+    protected Map<FileName, FileObject> getOrCreateFilesystemCache(final FileSystem filesystem) {
         Map<FileName, FileObject> files = filesystemCache.get(filesystem);
-        if (files == null)
-        {
+        if (files == null) {
             files = new MyLRUMap(filesystem, lruSize);
             filesystemCache.putIfAbsent(filesystem, files);
         }
@@ -227,36 +193,29 @@ public class LRUFilesCache extends Abstr
     }
 
     @Override
-    public void close()
-    {
+    public void close() {
         super.close();
         filesystemCache.clear();
     }
 
     @Override
-    public void removeFile(final FileSystem filesystem, final FileName name)
-    {
+    public void removeFile(final FileSystem filesystem, final FileName name) {
         final Map<?, ?> files = getOrCreateFilesystemCache(filesystem);
 
         writeLock.lock();
-        try
-        {
+        try {
             files.remove(name);
 
-            if (files.size() < 1)
-            {
+            if (files.size() < 1) {
                 filesystemCache.remove(filesystem);
             }
-        }
-        finally
-        {
+        } finally {
             writeLock.unlock();
         }
     }
 
     @Override
-    public void touchFile(final FileObject file)
-    {
+    public void touchFile(final FileObject file) {
         // this moves the file back on top
         getFile(file.getFileSystem(), file.getName());
     }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/NullFilesCache.java Thu Sep 14 19:26:39 2017
@@ -25,35 +25,29 @@ import org.apache.commons.vfs2.FileSyste
  * <p>
  * This implementation never ever caches a single file.
  * <p>
- * <b>Notice</b>: if you use resolveFile(uri) multiple times with the same path, the system will always
- * create a new instance. Changes on one instance of this file are not seen by the others.
+ * <b>Notice</b>: if you use resolveFile(uri) multiple times with the same path, the system will always create a new
+ * instance. Changes on one instance of this file are not seen by the others.
  */
-public class NullFilesCache extends AbstractFilesCache
-{
+public class NullFilesCache extends AbstractFilesCache {
     @Override
-    public void putFile(final FileObject file)
-    {
+    public void putFile(final FileObject file) {
     }
 
     @Override
-    public boolean putFileIfAbsent(final FileObject file)
-    {
+    public boolean putFileIfAbsent(final FileObject file) {
         return false;
     }
 
     @Override
-    public FileObject getFile(final FileSystem filesystem, final FileName name)
-    {
+    public FileObject getFile(final FileSystem filesystem, final FileName name) {
         return null;
     }
 
     @Override
-    public void clear(final FileSystem filesystem)
-    {
+    public void clear(final FileSystem filesystem) {
     }
 
     @Override
-    public void removeFile(final FileSystem filesystem, final FileName name)
-    {
+    public void removeFile(final FileSystem filesystem, final FileName name) {
     }
 }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/OnCallRefreshFileObject.java Thu Sep 14 19:26:39 2017
@@ -29,171 +29,146 @@ import org.apache.commons.vfs2.impl.Deco
 /**
  * This decorator refreshes the fileObject data on every call.
  */
-public class OnCallRefreshFileObject extends DecoratedFileObject
-{
-    public OnCallRefreshFileObject(final FileObject fileObject)
-    {
+public class OnCallRefreshFileObject extends DecoratedFileObject {
+    public OnCallRefreshFileObject(final FileObject fileObject) {
         super(fileObject);
     }
 
     @Override
-    public void close() throws FileSystemException
-    {
+    public void close() throws FileSystemException {
         refresh();
         super.close();
     }
 
     @Override
-    public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException
-    {
+    public void copyFrom(final FileObject srcFile, final FileSelector selector) throws FileSystemException {
         refresh();
         super.copyFrom(srcFile, selector);
     }
 
     @Override
-    public void createFile() throws FileSystemException
-    {
+    public void createFile() throws FileSystemException {
         refresh();
         super.createFile();
     }
 
     @Override
-    public void createFolder() throws FileSystemException
-    {
+    public void createFolder() throws FileSystemException {
         refresh();
         super.createFolder();
     }
 
     @Override
-    public boolean delete() throws FileSystemException
-    {
+    public boolean delete() throws FileSystemException {
         refresh();
         return super.delete();
     }
 
     @Override
-    public int delete(final FileSelector selector) throws FileSystemException
-    {
+    public int delete(final FileSelector selector) throws FileSystemException {
         refresh();
         return super.delete(selector);
     }
 
     @Override
-    public boolean exists() throws FileSystemException
-    {
+    public boolean exists() throws FileSystemException {
         refresh();
         return super.exists();
     }
 
     @Override
     public void findFiles(final FileSelector selector, final boolean depthwise, final List<FileObject> selected)
-        throws FileSystemException
-    {
+            throws FileSystemException {
         refresh();
         super.findFiles(selector, depthwise, selected);
     }
 
     @Override
-    public FileObject[] findFiles(final FileSelector selector) throws FileSystemException
-    {
+    public FileObject[] findFiles(final FileSelector selector) throws FileSystemException {
         refresh();
         return super.findFiles(selector);
     }
 
     @Override
-    public FileObject getChild(final String name) throws FileSystemException
-    {
+    public FileObject getChild(final String name) throws FileSystemException {
         refresh();
         return super.getChild(name);
     }
 
     @Override
-    public FileObject[] getChildren() throws FileSystemException
-    {
+    public FileObject[] getChildren() throws FileSystemException {
         refresh();
         return super.getChildren();
     }
 
     @Override
-    public FileContent getContent() throws FileSystemException
-    {
+    public FileContent getContent() throws FileSystemException {
         refresh();
         return super.getContent();
     }
 
     @Override
-    public FileType getType() throws FileSystemException
-    {
+    public FileType getType() throws FileSystemException {
         refresh();
         return super.getType();
     }
 
     @Override
-    public boolean isExecutable() throws FileSystemException
-    {
+    public boolean isExecutable() throws FileSystemException {
         refresh();
         return super.isExecutable();
     }
 
     @Override
-    public boolean isHidden() throws FileSystemException
-    {
+    public boolean isHidden() throws FileSystemException {
         refresh();
         return super.isHidden();
     }
 
     @Override
-    public boolean isReadable() throws FileSystemException
-    {
+    public boolean isReadable() throws FileSystemException {
         refresh();
         return super.isReadable();
     }
 
     @Override
-    public boolean isWriteable() throws FileSystemException
-    {
+    public boolean isWriteable() throws FileSystemException {
         refresh();
         return super.isWriteable();
     }
 
     @Override
-    public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException
-    {
+    public boolean setExecutable(final boolean executable, final boolean ownerOnly) throws FileSystemException {
         refresh();
         return super.setExecutable(executable, ownerOnly);
     }
 
     @Override
-    public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException
-    {
+    public boolean setReadable(final boolean readable, final boolean ownerOnly) throws FileSystemException {
         refresh();
         return super.setReadable(readable, ownerOnly);
     }
 
     @Override
-    public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException
-    {
+    public boolean setWritable(final boolean writable, final boolean ownerOnly) throws FileSystemException {
         refresh();
         return super.setWritable(writable, ownerOnly);
     }
 
     @Override
-    public void moveTo(final FileObject destFile) throws FileSystemException
-    {
+    public void moveTo(final FileObject destFile) throws FileSystemException {
         refresh();
         super.moveTo(destFile);
     }
 
     @Override
-    public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException
-    {
+    public FileObject resolveFile(final String name, final NameScope scope) throws FileSystemException {
         refresh();
         return super.resolveFile(name, scope);
     }
 
     @Override
-    public FileObject resolveFile(final String path) throws FileSystemException
-    {
+    public FileObject resolveFile(final String path) throws FileSystemException {
         refresh();
         return super.resolveFile(path);
     }

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/SoftRefFilesCache.java Thu Sep 14 19:26:39 2017
@@ -36,77 +36,59 @@ import org.apache.commons.vfs2.VfsLog;
 import org.apache.commons.vfs2.util.Messages;
 
 /**
- * This implementation caches every file as long as it is strongly reachable by
- * the java vm. As soon as the vm needs memory - every softly reachable file
- * will be discarded.
+ * This implementation caches every file as long as it is strongly reachable by the java vm. As soon as the vm needs
+ * memory - every softly reachable file will be discarded.
  *
  * @see SoftReference
  */
-public class SoftRefFilesCache extends AbstractFilesCache
-{
+public class SoftRefFilesCache extends AbstractFilesCache {
     private static final int TIMEOUT = 1000;
 
     private static final Log log = LogFactory.getLog(SoftRefFilesCache.class);
 
-    private final ConcurrentMap<FileSystem, Map<FileName, Reference<FileObject>>> fileSystemCache =
-          new ConcurrentHashMap<>();
-    private final Map<Reference<FileObject>, FileSystemAndNameKey> refReverseMap =
-          new HashMap<>(100);
+    private final ConcurrentMap<FileSystem, Map<FileName, Reference<FileObject>>> fileSystemCache = new ConcurrentHashMap<>();
+    private final Map<Reference<FileObject>, FileSystemAndNameKey> refReverseMap = new HashMap<>(100);
     private final ReferenceQueue<FileObject> refQueue = new ReferenceQueue<>();
 
     private volatile SoftRefReleaseThread softRefReleaseThread = null; // @GuardedBy("lock")
 
     private final Lock lock = new ReentrantLock();
 
-
     /**
-     * This thread will listen on the ReferenceQueue and remove the entry in the
-     * filescache as soon as the vm removes the reference
+     * This thread will listen on the ReferenceQueue and remove the entry in the filescache as soon as the vm removes
+     * the reference
      */
-    private final class SoftRefReleaseThread extends Thread
-    {
+    private final class SoftRefReleaseThread extends Thread {
         private volatile boolean requestEnd; // used for inter-thread communication
 
-        private SoftRefReleaseThread()
-        {
+        private SoftRefReleaseThread() {
             setName(SoftRefReleaseThread.class.getName());
             setDaemon(true);
         }
 
         @Override
-        public void run()
-        {
-            loop: while (!requestEnd && !Thread.currentThread().isInterrupted())
-            {
-                try
-                {
+        public void run() {
+            loop: while (!requestEnd && !Thread.currentThread().isInterrupted()) {
+                try {
                     final Reference<?> ref = refQueue.remove(TIMEOUT);
-                    if (ref == null)
-                    {
+                    if (ref == null) {
                         continue;
                     }
 
                     lock.lock();
-                    try
-                    {
+                    try {
                         final FileSystemAndNameKey key = refReverseMap.get(ref);
 
-                        if (key != null && removeFile(key))
-                        {
+                        if (key != null && removeFile(key)) {
                             close(key.getFileSystem());
                         }
-                    }
-                    finally
-                    {
+                    } finally {
                         lock.unlock();
                     }
-                }
-                catch (final InterruptedException e)
-                {
-                    if (!requestEnd)
-                    {
+                } catch (final InterruptedException e) {
+                    if (!requestEnd) {
                         VfsLog.warn(getLogger(), log,
-                                    Messages.getString("vfs.impl/SoftRefReleaseThread-interrupt.info"));
+                                Messages.getString("vfs.impl/SoftRefReleaseThread-interrupt.info"));
                     }
                     break loop;
                 }
@@ -114,36 +96,28 @@ public class SoftRefFilesCache extends A
         }
     }
 
-    public SoftRefFilesCache()
-    {
+    public SoftRefFilesCache() {
     }
 
-    private void startThread()
-    {
+    private void startThread() {
         // Double Checked Locking is allowed when volatile
-        if (softRefReleaseThread != null)
-        {
+        if (softRefReleaseThread != null) {
             return;
         }
 
-        synchronized (lock)
-        {
-            if (softRefReleaseThread == null)
-            {
+        synchronized (lock) {
+            if (softRefReleaseThread == null) {
                 softRefReleaseThread = new SoftRefReleaseThread();
                 softRefReleaseThread.start();
             }
         }
     }
 
-    private void endThread()
-    {
-        synchronized (lock)
-        {
+    private void endThread() {
+        synchronized (lock) {
             final SoftRefReleaseThread thread = softRefReleaseThread;
             softRefReleaseThread = null;
-            if (thread != null)
-            {
+            if (thread != null) {
                 thread.requestEnd = true;
                 thread.interrupt();
             }
@@ -151,10 +125,8 @@ public class SoftRefFilesCache extends A
     }
 
     @Override
-    public void putFile(final FileObject fileObject)
-    {
-        if (log.isDebugEnabled())
-        {
+    public void putFile(final FileObject fileObject) {
+        if (log.isDebugEnabled()) {
             log.debug("putFile: " + this.getSafeName(fileObject));
         }
 
@@ -164,36 +136,28 @@ public class SoftRefFilesCache extends A
         final FileSystemAndNameKey key = new FileSystemAndNameKey(fileObject.getFileSystem(), fileObject.getName());
 
         lock.lock();
-        try
-        {
+        try {
             final Reference<FileObject> old = files.put(fileObject.getName(), ref);
-            if (old != null)
-            {
+            if (old != null) {
                 refReverseMap.remove(old);
             }
             refReverseMap.put(ref, key);
-        }
-        finally
-        {
+        } finally {
             lock.unlock();
         }
     }
 
-    private String getSafeName(final FileName fileName)
-    {
+    private String getSafeName(final FileName fileName) {
         return fileName.getFriendlyURI();
     }
 
-    private String getSafeName(final FileObject fileObject)
-    {
+    private String getSafeName(final FileObject fileObject) {
         return this.getSafeName(fileObject.getName());
     }
 
     @Override
-    public boolean putFileIfAbsent(final FileObject fileObject)
-    {
-        if (log.isDebugEnabled())
-        {
+    public boolean putFileIfAbsent(final FileObject fileObject) {
+        if (log.isDebugEnabled()) {
             log.debug("putFile: " + this.getSafeName(fileObject));
         }
 
@@ -203,179 +167,142 @@ public class SoftRefFilesCache extends A
         final FileSystemAndNameKey key = new FileSystemAndNameKey(fileObject.getFileSystem(), fileObject.getName());
 
         lock.lock();
-        try
-        {
-            if (files.containsKey(fileObject.getName()) && files.get(fileObject.getName()).get() != null)
-            {
+        try {
+            if (files.containsKey(fileObject.getName()) && files.get(fileObject.getName()).get() != null) {
                 return false;
             }
             final Reference<FileObject> old = files.put(fileObject.getName(), ref);
-            if (old != null)
-            {
+            if (old != null) {
                 refReverseMap.remove(old);
             }
             refReverseMap.put(ref, key);
             return true;
-        }
-        finally
-        {
+        } finally {
             lock.unlock();
         }
     }
 
-    protected Reference<FileObject> createReference(final FileObject file, final ReferenceQueue<FileObject> refqueue)
-    {
+    protected Reference<FileObject> createReference(final FileObject file, final ReferenceQueue<FileObject> refqueue) {
         return new SoftReference<>(file, refqueue);
     }
 
     @Override
-    public FileObject getFile(final FileSystem fileSystem, final FileName fileName)
-    {
+    public FileObject getFile(final FileSystem fileSystem, final FileName fileName) {
         final Map<FileName, Reference<FileObject>> files = getOrCreateFilesystemCache(fileSystem);
 
         lock.lock();
-        try
-        {
+        try {
             final Reference<FileObject> ref = files.get(fileName);
-            if (ref == null)
-            {
+            if (ref == null) {
                 return null;
             }
 
             final FileObject fo = ref.get();
-            if (fo == null)
-            {
+            if (fo == null) {
                 removeFile(fileSystem, fileName);
             }
             return fo;
-        }
-        finally
-        {
+        } finally {
             lock.unlock();
         }
     }
 
     @Override
-    public void clear(final FileSystem fileSystem)
-    {
+    public void clear(final FileSystem fileSystem) {
         final Map<FileName, Reference<FileObject>> files = getOrCreateFilesystemCache(fileSystem);
 
         lock.lock();
-        try
-        {
+        try {
             final Iterator<FileSystemAndNameKey> iterKeys = refReverseMap.values().iterator();
-            while (iterKeys.hasNext())
-            {
+            while (iterKeys.hasNext()) {
                 final FileSystemAndNameKey key = iterKeys.next();
-                if (key.getFileSystem() == fileSystem)
-                {
+                if (key.getFileSystem() == fileSystem) {
                     iterKeys.remove();
                     files.remove(key.getFileName());
                 }
             }
 
-            if (files.size() < 1)
-            {
+            if (files.size() < 1) {
                 close(fileSystem);
             }
-        }
-        finally
-        {
+        } finally {
             lock.unlock();
         }
     }
 
     /**
      * Called while the lock is held
+     * 
      * @param fileSystem The file system to close.
      */
-    private void close(final FileSystem fileSystem)
-    {
-        if (log.isDebugEnabled())
-        {
+    private void close(final FileSystem fileSystem) {
+        if (log.isDebugEnabled()) {
             log.debug("close fs: " + fileSystem.getRootName());
         }
 
         fileSystemCache.remove(fileSystem);
-        if (fileSystemCache.size() < 1)
-        {
+        if (fileSystemCache.size() < 1) {
             endThread();
         }
-        /* This is not thread-safe as another thread might be opening the file system
-        ((DefaultFileSystemManager) getContext().getFileSystemManager())
-                ._closeFileSystem(filesystem);
+        /*
+         * This is not thread-safe as another thread might be opening the file system ((DefaultFileSystemManager)
+         * getContext().getFileSystemManager()) ._closeFileSystem(filesystem);
          */
     }
 
     @Override
-    public void close()
-    {
+    public void close() {
         super.close();
 
         endThread();
 
         lock.lock();
-        try
-        {
+        try {
             fileSystemCache.clear();
 
             refReverseMap.clear();
-        }
-        finally
-        {
+        } finally {
             lock.unlock();
         }
     }
 
     @Override
-    public void removeFile(final FileSystem fileSystem, final FileName fileName)
-    {
-        if (removeFile(new FileSystemAndNameKey(fileSystem, fileName)))
-        {
+    public void removeFile(final FileSystem fileSystem, final FileName fileName) {
+        if (removeFile(new FileSystemAndNameKey(fileSystem, fileName))) {
             close(fileSystem);
         }
     }
 
-    private boolean removeFile(final FileSystemAndNameKey key)
-    {
-        if (log.isDebugEnabled())
-        {
+    private boolean removeFile(final FileSystemAndNameKey key) {
+        if (log.isDebugEnabled()) {
             log.debug("removeFile: " + this.getSafeName(key.getFileName()));
         }
 
         final Map<?, ?> files = getOrCreateFilesystemCache(key.getFileSystem());
 
         lock.lock();
-        try
-        {
+        try {
             final Object ref = files.remove(key.getFileName());
-            if (ref != null)
-            {
+            if (ref != null) {
                 refReverseMap.remove(ref);
             }
 
             return files.size() < 1;
-        }
-        finally
-        {
+        } finally {
             lock.unlock();
         }
     }
 
-    protected Map<FileName, Reference<FileObject>> getOrCreateFilesystemCache(final FileSystem fileSystem)
-    {
-        if (fileSystemCache.size() < 1)
-        {
+    protected Map<FileName, Reference<FileObject>> getOrCreateFilesystemCache(final FileSystem fileSystem) {
+        if (fileSystemCache.size() < 1) {
             startThread();
         }
 
         Map<FileName, Reference<FileObject>> files;
 
-        do
-        {
+        do {
             files = fileSystemCache.get(fileSystem);
-            if (files != null)
-            {
+            if (files != null) {
                 break;
             }
             files = new HashMap<>();

Modified: commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java?rev=1808381&r1=1808380&r2=1808381&view=diff
==============================================================================
--- commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java (original)
+++ commons/proper/vfs/trunk/commons-vfs2/src/main/java/org/apache/commons/vfs2/cache/WeakRefFilesCache.java Thu Sep 14 19:26:39 2017
@@ -23,18 +23,15 @@ import java.lang.ref.WeakReference;
 import org.apache.commons.vfs2.FileObject;
 
 /**
- * This implementation caches every file as long as it is strongly reachable by
- * the java vm. As soon as the object is no longer reachable it will be discarded.
- * In contrast to the SoftRefFilesCache this implementation might free resources faster
- * as it don't wait until a memory limitation.
+ * This implementation caches every file as long as it is strongly reachable by the java vm. As soon as the object is no
+ * longer reachable it will be discarded. In contrast to the SoftRefFilesCache this implementation might free resources
+ * faster as it don't wait until a memory limitation.
  *
  * @see java.lang.ref.WeakReference
  */
-public class WeakRefFilesCache extends SoftRefFilesCache
-{
+public class WeakRefFilesCache extends SoftRefFilesCache {
     @Override
-    protected Reference<FileObject> createReference(final FileObject file, final ReferenceQueue<FileObject> refqueue)
-    {
+    protected Reference<FileObject> createReference(final FileObject file, final ReferenceQueue<FileObject> refqueue) {
         return new WeakReference<>(file, refqueue);
     }
 }