continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r485677 - /maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
Date Mon, 11 Dec 2006 14:28:56 GMT
Author: evenisse
Date: Mon Dec 11 06:28:55 2006
New Revision: 485677

URL: http://svn.apache.org/viewvc?view=rev&rev=485677
Log:
o Add a logger for MungedHttpsURL
o Hide password in url

Modified:
    maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java

Modified: maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java?view=diff&rev=485677&r1=485676&r2=485677
==============================================================================
--- maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
(original)
+++ maven/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/core/action/CreateProjectsFromMetadataAction.java
Mon Dec 11 06:28:55 2006
@@ -131,6 +131,8 @@
                    mungedURL = new MungedHttpsURL( curl, username, password );
                 }
 
+                mungedURL.setLogger( getLogger() );
+
                 if ( mungedURL.isValid() )
                 {
                     url = mungedURL.getURL();
@@ -140,7 +142,7 @@
                 else
                 {
                     result = new ContinuumProjectBuildingResult();
-                    getLogger().info( "Malformed URL (MungedHttpsURL is not valid): " + curl
);
+                    getLogger().info( "Malformed URL (MungedHttpsURL is not valid): " + hidePasswordInUrl(
curl ) );
                     result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
                 }
             }
@@ -148,13 +150,29 @@
         }
         catch ( MalformedURLException e )
         {
-            getLogger().info( "Malformed URL: " + curl, e );
+            getLogger().info( "Malformed URL: " + hidePasswordInUrl( curl ), e );
             result = new ContinuumProjectBuildingResult();
             result.addError( ContinuumProjectBuildingResult.ERROR_MALFORMED_URL );
         }
 
 
         context.put( KEY_PROJECT_BUILDING_RESULT, result );
+    }
+
+    private String hidePasswordInUrl( String url )
+    {
+        int indexAt = url.indexOf( "@" );
+
+        if ( indexAt < 0 )
+        {
+            return url;
+        }
+
+        String s = url.substring( 0, indexAt );
+
+        int pos = s.lastIndexOf( ":" );
+
+        return s.substring( 0, pos + 1 ) + "*****" + url.substring( indexAt );
     }
 
     private Settings getSettings()



Mime
View raw message