brett       2004/11/04 02:56:20

  Modified:    src/java/org/apache/maven/util Tag: MAVEN-1_0-BRANCH
                        HttpUtils.java
               src/java/org/apache/maven/verifier Tag: MAVEN-1_0-BRANCH
                        DependencyVerifier.java
               .        Tag: MAVEN-1_0-BRANCH maven.xml
  Log:
  PR: MAVEN-1457

  Don't display the password in the remote repo when configured to use basic auth
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.28.4.16 +21 -19    maven/src/java/org/apache/maven/util/HttpUtils.java
  
  Index: HttpUtils.java
  ===================================================================
  RCS file: /home/cvs/maven/src/java/org/apache/maven/util/HttpUtils.java,v
  retrieving revision 1.28.4.15
  retrieving revision 1.28.4.16
  diff -u -r1.28.4.15 -r1.28.4.16
  --- HttpUtils.java    30 Jul 2004 16:54:34 -0000      1.28.4.15
  +++ HttpUtils.java    4 Nov 2004 10:56:19 -0000       1.28.4.16
  @@ -17,6 +17,20 @@
    * ====================================================================
    */
   
  +import org.apache.commons.httpclient.Credentials;
  +import org.apache.commons.httpclient.Header;
  +import org.apache.commons.httpclient.HostConfiguration;
  +import org.apache.commons.httpclient.HttpClient;
  +import org.apache.commons.httpclient.HttpRecoverableException;
  +import org.apache.commons.httpclient.NTCredentials;
  +import org.apache.commons.httpclient.UsernamePasswordCredentials;
  +import org.apache.commons.httpclient.methods.GetMethod;
  +import org.apache.commons.httpclient.util.DateParseException;
  +import org.apache.commons.httpclient.util.DateParser;
  +import org.apache.commons.lang.StringUtils;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +
   import java.io.File;
   import java.io.FileNotFoundException;
   import java.io.FileOutputStream;
  @@ -25,7 +39,6 @@
   import java.io.OutputStream;
   import java.net.Authenticator;
   import java.net.HttpURLConnection;
  -import java.net.MalformedURLException;
   import java.net.PasswordAuthentication;
   import java.net.URL;
   import java.net.URLConnection;
  @@ -34,21 +47,6 @@
   import java.util.Locale;
   import java.util.TimeZone;
   
  -import org.apache.commons.lang.StringUtils;
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
  -import org.apache.commons.httpclient.Credentials;
  -import org.apache.commons.httpclient.Header;
  -import org.apache.commons.httpclient.HostConfiguration;
  -import org.apache.commons.httpclient.HttpClient;
  -import org.apache.commons.httpclient.HttpRecoverableException;
  -import org.apache.commons.httpclient.NTCredentials;
  -import org.apache.commons.httpclient.UsernamePasswordCredentials;
  -import org.apache.commons.httpclient.methods.GetMethod;
  -import org.apache.commons.httpclient.protocol.Protocol;
  -import org.apache.commons.httpclient.util.DateParser;
  -import org.apache.commons.httpclient.util.DateParseException;
  -
   /**
    * Http utils for retrieving files.
    *
  @@ -337,13 +335,17 @@
                                   DownloadMeter downloadMeter )
         throws IOException
       {
  -        LOG.debug( "Getting URL: " + url );
  -
           String[] s = parseUrl( url );
           String username = s[0];
           String password = s[1];
           String parsedUrl = s[2];
   
  +        LOG.debug( "Getting URL: " + parsedUrl );
  +        if ( username != null )
  +        {
  +            LOG.debug( "username is " + username + "; password hidden" );
  +        }
  +
           URL source = new URL( parsedUrl );
           if (source.getProtocol().equals("http") || 
source.getProtocol().equals("https")) {
               Credentials creds = null;
  @@ -610,7 +612,7 @@
        * @param url The url to parse.
        * @return The username, password and url.
        */
  -    static String[] parseUrl( String url )
  +    public static String[] parseUrl( String url )
       {
           String[] parsedUrl = new String[3];
           parsedUrl[0] = null;
  
  
  
  No                   revision
  No                   revision
  1.34.4.11 +7 -3      maven/src/java/org/apache/maven/verifier/DependencyVerifier.java
  
  Index: DependencyVerifier.java
  ===================================================================
  RCS file: 
/home/cvs/maven/src/java/org/apache/maven/verifier/DependencyVerifier.java,v
  retrieving revision 1.34.4.10
  retrieving revision 1.34.4.11
  diff -u -r1.34.4.10 -r1.34.4.11
  --- DependencyVerifier.java   24 Sep 2004 10:38:44 -0000      1.34.4.10
  +++ DependencyVerifier.java   4 Nov 2004 10:56:20 -0000       1.34.4.11
  @@ -21,10 +21,10 @@
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.maven.AbstractMavenComponent;
  +import org.apache.maven.MavenConstants;
   import org.apache.maven.project.Project;
   import org.apache.maven.repository.Artifact;
   import org.apache.maven.util.HttpUtils;
  -import org.apache.maven.MavenConstants;
   
   import java.io.File;
   import java.io.FileNotFoundException;
  @@ -387,7 +387,11 @@
                   // print a warning, in any case, so user catches on to mistyped
                   // hostnames, or other snafus
                   // FIXME: localize this message
  -                log.warn("Error retrieving artifact from [" + url + "]: " + e);
  +                String[] parsedUrl = HttpUtils.parseUrl(url);
  +                log.warn("Error retrieving artifact from [" + parsedUrl[2] + "]: " 
+ e);
  +                if (parsedUrl[0] != null) {
  +                    log.debug("Username was '" + parsedUrl[0] + "', password 
hidden");
  +                }
                   log.debug("Error details", e);
                   errorsFound = true;
               }
  
  
  
  No                   revision
  No                   revision
  1.97.2.33 +0 -2      maven/maven.xml
  
  Index: maven.xml
  ===================================================================
  RCS file: /home/cvs/maven/maven.xml,v
  retrieving revision 1.97.2.32
  retrieving revision 1.97.2.33
  diff -u -r1.97.2.32 -r1.97.2.33
  --- maven.xml 31 Oct 2004 01:01:55 -0000      1.97.2.32
  +++ maven.xml 4 Nov 2004 10:56:20 -0000       1.97.2.33
  @@ -409,8 +409,6 @@
       <j:set var="repoRemote" value="file:${prevRepoLocal},${prevRepoRemote}" />
       ${systemScope.setProperty('maven.repo.local',repoLocal)}
       ${systemScope.setProperty('maven.repo.remote',repoRemote)}
  -    <ant:echo>maven.repo.local = ${repoLocal}</ant:echo>
  -    <ant:echo>maven.repo.remote = ${repoRemote}</ant:echo>
       <ant:delete dir="${repoLocal}" />
       <maven:maven 
descriptor="src/test/touchstone-build/src/reactor-build/default/project.xml" 
goals="java:compile,site" />
       <ant:mkdir dir="${maven.build.dir}/installer" />
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to