commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1541152 - in /commons/proper/vfs/trunk: core/src/main/java/org/apache/commons/vfs2/ core/src/main/java/org/apache/commons/vfs2/impl/ core/src/main/java/org/apache/commons/vfs2/provider/ core/src/main/java/org/apache/commons/vfs2/tasks/ src...
Date Tue, 12 Nov 2013 17:04:30 GMT
Author: ggregory
Date: Tue Nov 12 17:04:29 2013
New Revision: 1541152

URL: http://svn.apache.org/r1541152
Log:
[VFS-501] Hide passwords from log/console output. Commit a different fix from the suggested
patch.

Modified:
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/CopyTask.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/DeleteTask.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/MoveTask.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java
    commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/SyncTask.java
    commons/proper/vfs/trunk/src/changes/changes.xml

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java?rev=1541152&r1=1541151&r2=1541152&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java (original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/FileObject.java Tue
Nov 12 17:04:29 2013
@@ -274,6 +274,14 @@ public interface FileObject extends Comp
     FileObject getParent() throws FileSystemException;
 
     /**
+     * Returns the receiver as a URI String for public display, like, without a
+     * password.
+     * 
+     * @return A URI String without a password, never {@code null}.
+     */
+    String getPublicURIString();
+
+    /**
      * Returns this file's type.
      *
      * @return One of the {@link FileType} constants.  Never returns null.
@@ -416,6 +424,7 @@ public interface FileObject extends Comp
      */
     boolean setExecutable(boolean executable, boolean ownerOnly) throws FileSystemException;
 
+
     /**
      * Sets the owner's (or everybody's) read permission.
      *
@@ -430,7 +439,6 @@ public interface FileObject extends Comp
      */
     boolean setReadable(boolean readable, boolean ownerOnly) throws FileSystemException;
 
-
     /**
      * Sets the owner's (or everybody's) write permission.
      *

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java?rev=1541152&r1=1541151&r2=1541152&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/impl/DecoratedFileObject.java
Tue Nov 12 17:04:29 2013
@@ -152,6 +152,11 @@ public class DecoratedFileObject impleme
     }
 
     @Override
+    public String getPublicURIString() {
+        return decoratedFileObject.getPublicURIString();
+    }
+
+    @Override
     public FileName getName()
     {
         return decoratedFileObject.getName();

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java?rev=1541152&r1=1541151&r2=1541152&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/provider/AbstractFileObject.java
Tue Nov 12 17:04:29 2013
@@ -1312,6 +1312,18 @@ public abstract class AbstractFileObject
     }
 
     /**
+     * Returns the receiver as a URI String for public display, like, without a
+     * password.
+     * 
+     * @return A URI String without a password, never {@code null}.
+     */
+    @Override
+    public String getPublicURIString()
+    {
+        return fileName.getFriendlyURI();
+    }
+
+    /**
      * Prepares this file for writing.  Makes sure it is either a file,
      * or its parent folder exists.  Returns an output stream to use to
      * write the content of the file to.

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/CopyTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/CopyTask.java?rev=1541152&r1=1541151&r2=1541152&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/CopyTask.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/CopyTask.java
Tue Nov 12 17:04:29 2013
@@ -76,7 +76,7 @@ public class CopyTask
                                        final FileObject destFile)
         throws FileSystemException
     {
-        log("Copying " + srcFile + " to " + destFile);
+        log("Copying " + srcFile.getPublicURIString() + " to " + destFile.getPublicURIString());
         destFile.copyFrom(srcFile, Selectors.SELECT_SELF);
         if (preserveLastModified
             && srcFile.getFileSystem().hasCapability(Capability.GET_LAST_MODIFIED)

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/DeleteTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/DeleteTask.java?rev=1541152&r1=1541151&r2=1541152&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/DeleteTask.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/DeleteTask.java
Tue Nov 12 17:04:29 2013
@@ -95,7 +95,7 @@ public class DeleteTask
             else
             {
                 final FileObject srcFile = resolveFile(file);
-                log("Deleting " + srcFile);
+                log("Deleting " + srcFile.getPublicURIString());
                 srcFile.deleteAll();
             }
         }

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/MoveTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/MoveTask.java?rev=1541152&r1=1541151&r2=1541152&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/MoveTask.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/MoveTask.java
Tue Nov 12 17:04:29 2013
@@ -52,12 +52,12 @@ public class MoveTask
         {
             super.handleOutOfDateFile(srcFile, destFile);
 
-            log("Deleting " + srcFile);
+            log("Deleting " + srcFile.getPublicURIString());
             srcFile.delete(Selectors.SELECT_SELF);
         }
         else
         {
-            log("Rename " + srcFile + " to " + destFile);
+            log("Rename " + srcFile.getPublicURIString() + " to " + destFile.getPublicURIString());
             srcFile.moveTo(destFile);
             if (!isPreserveLastModified()
                 && destFile.getFileSystem().hasCapability(Capability.SET_LAST_MODIFIED_FILE))

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java?rev=1541152&r1=1541151&r2=1541152&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/ShowFileTask.java
Tue Nov 12 17:04:29 2013
@@ -75,7 +75,7 @@ public class ShowFileTask
         try
         {
             final FileObject file = resolveFile(url);
-            log("Details of " + file.getName().getURI());
+            log("Details of " + file.getPublicURIString());
             showFile(file, INDENT);
         }
         catch (final Exception e)

Modified: commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/SyncTask.java
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/SyncTask.java?rev=1541152&r1=1541151&r2=1541152&view=diff
==============================================================================
--- commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/SyncTask.java
(original)
+++ commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs2/tasks/SyncTask.java
Tue Nov 12 17:04:29 2013
@@ -32,7 +32,7 @@ public class SyncTask
     protected void handleMissingSourceFile(final FileObject destFile)
         throws Exception
     {
-        log("deleting " + destFile);
+        log("deleting " + destFile.getPublicURIString());
         //destFile.delete( Selectors.SELECT_SELF );
     }
 

Modified: commons/proper/vfs/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/vfs/trunk/src/changes/changes.xml?rev=1541152&r1=1541151&r2=1541152&view=diff
==============================================================================
--- commons/proper/vfs/trunk/src/changes/changes.xml (original)
+++ commons/proper/vfs/trunk/src/changes/changes.xml Tue Nov 12 17:04:29 2013
@@ -26,6 +26,9 @@
 <!--       <action issue="VFS-443" dev="ggregory" type="update" due-to="nickallen">
-->
 <!--     	[Local] Need an easy way to convert from a FileObject to a File. -->
 <!--       </action> -->
+      <action issue="VFS-501" dev="ggregory" type="update" due-to="Yves Schumann">
+        Hide passwords from log/console output.
+      </action>
       <action issue="VFS-496" dev="ggregory" type="update" due-to="Bernd Eckenfels">
         Resource translation issues.
       </action>



Mime
View raw message