continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r329791 - /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
Date Mon, 31 Oct 2005 09:57:44 GMT
Author: evenisse
Date: Mon Oct 31 01:57:41 2005
New Revision: 329791

URL: http://svn.apache.org/viewcvs?rev=329791&view=rev
Log:
[CONTINUUM-394] remove password in log.

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
URL: http://svn.apache.org/viewcvs/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java?rev=329791&r1=329790&r2=329791&view=diff
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/scm/DefaultContinuumScm.java
Mon Oct 31 01:57:41 2005
@@ -273,7 +273,7 @@
 
         result.setSuccess( scmResult.isSuccess() );
 
-        result.setCommandLine( scmResult.getCommandLine() );
+        result.setCommandLine( writeCommandLine( scmResult.getCommandLine() ) );
 
         result.setCommandOutput( scmResult.getCommandOutput() );
 
@@ -315,7 +315,7 @@
     {
         ScmResult result = new ScmResult();
 
-        result.setCommandLine( scmResult.getCommandLine() );
+        result.setCommandLine( writeCommandLine( scmResult.getCommandLine() ) );
 
         result.setSuccess( scmResult.isSuccess() );
 
@@ -358,5 +358,29 @@
         }
 
         return result;
+    }
+
+    /**
+     * Remove password from command line
+     */
+    private String writeCommandLine( String commandLine )
+    {
+        String cmd = commandLine;
+        
+        if ( cmd.startsWith( "svn" ) )
+        {
+            String pwdString = "--password";
+
+            if ( cmd.indexOf( pwdString ) > 0 )
+            {
+                int index = cmd.indexOf( pwdString ) + pwdString.length() + 1;
+
+                int nextSpace = cmd.indexOf( " ", index );
+
+                cmd = cmd.substring( 0, index ) + "********" + cmd.substring( nextSpace );
+            }
+        }
+
+        return cmd;
     }
 }



Mime
View raw message