You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by ji...@codehaus.org on 2004/02/06 10:47:12 UTC

[jira] Created: (MAVEN-1151) Improved reporting of proxy authentication failure

Message:

  A new issue has been created in JIRA.

---------------------------------------------------------------------
View the issue:
  http://jira.codehaus.org/secure/ViewIssue.jspa?key=MAVEN-1151

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: MAVEN-1151
    Summary: Improved reporting of proxy authentication failure
       Type: Improvement

     Status: Unassigned
   Priority: Major

 Original Estimate: 1 hour
 Time Spent: Unknown
  Remaining: 1 hour

    Project: maven
 Components: 
             core
   Versions:
             1.0-rc1

   Assignee: 
   Reporter: Kristopher Brown

    Created: Fri, 6 Feb 2004 4:46 AM
    Updated: Fri, 6 Feb 2004 4:46 AM
Environment: Not applicable

Description:
If connecting through a proxy server, and authentication fails, maven provides a confusing message as shown below:

Attempting to download maven-SNAPSHOT.jar.
Error retrieving artifact from [http://www.ibiblio.org/maven/maven/jars/maven-SNAPSHOT.jar]: java.lang.Exception: Can't get maven-SNAPSHOT.jar to yadayadayada\.maven\repository\maven\jars\maven-SNAPSHOT.jar 

So I added a few lines to HttpUtils to recognise the HTTP_PROXY_AUTH [407] return code and handle it similarily to the code already there for HTTP_UNAUTHORIZED [401].  The message is now:

Attempting to download maven-SNAPSHOT.jar.
Error retrieving artifact from [http://www.ibiblio.org/maven/maven/jars/maven-SNAPSHOT.jar]: java.lang.Exception: Not authorized by proxy.

I've provided a patch below.

---------------- PATCH START ----------------
Index: HttpUtils.java
===================================================================
RCS file: /home/cvspublic/maven/src/java/org/apache/maven/util/HttpUtils.java,v
retrieving revision 1.28
diff -c -r1.28 HttpUtils.java
*** HttpUtils.java	27 Oct 2003 16:33:11 -0000	1.28
--- HttpUtils.java	6 Feb 2004 09:37:53 -0000
***************
*** 283,288 ****
--- 283,295 ----
                      return;
                  throw new Exception( "Not authorized." );
              }
+             // test for 407 result (HTTP only)
+             if ( httpConnection.getResponseCode() == HttpURLConnection.HTTP_PROXY_AUTH )
+             {
+                 if (ignoreErrors)
+                     return;
+                 throw new Exception( "Not authorized by proxy." );
+             }
          }
  
          // REVISIT: at this point even non HTTP connections may support the
----------------- PATCH END -----------------


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org