Maven 1

Improved reporting of proxy authentication failure

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0-rc1
  • Fix Version/s: 1.0-rc2
  • Component/s: core
  • Labels:
    None
  • Environment:
    Not applicable
  • Number of attachments :
    0

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 -----------------

Activity

Hide
Emmanuel Venisse added a comment -

Applied. Thanks.

Show
Emmanuel Venisse added a comment - Applied. Thanks.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
1h
Original Estimate - 1 hour
Remaining:
1h
Remaining Estimate - 1 hour
Logged:
Not Specified
Time Spent - Not Specified