dion        2003/09/04 08:19:25

  Modified:    src/java/org/apache/maven/verifier DependencyVerifier.java
               src/java/org/apache/maven/util HttpUtils.java
  Log:
  MAVEN-651
  
  Revision  Changes    Path
  1.32      +5 -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.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- DependencyVerifier.java   21 Aug 2003 04:28:25 -0000      1.31
  +++ DependencyVerifier.java   4 Sep 2003 15:19:25 -0000       1.32
  @@ -360,8 +360,10 @@
               catch (FileNotFoundException e)
               {
                   // Multiple repositories may exist, and if the file is not found
  -                // in just one of them, it's no problem.
  -                // if it's not found at all, artifactFound will be false.
  +                // in just one of them, it's no problem, and we don't want to
  +                // even print out an error.
  +                // if it's not found at all, artifactFound will be false, and the
  +                // build _will_ break, and the user will get an error message
                   log.debug("File not found on one of the repos", e);
               }
               catch ( Exception e )
  
  
  
  1.27      +17 -4     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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- HttpUtils.java    17 May 2003 23:30:33 -0000      1.26
  +++ HttpUtils.java    4 Sep 2003 15:19:25 -0000       1.27
  @@ -57,6 +57,7 @@
    */
   
   import java.io.File;
  +import java.io.FileNotFoundException;
   import java.io.FileOutputStream;
   import java.io.IOException;
   import java.io.InputStream;
  @@ -115,8 +116,8 @@
       }
   
       /**
  -     * Retrieve a remote file.  Returns true if the file was successfully
  -     * retrieved or if it is up to date (when the useTimestamp flag is set).
  +     * Retrieve a remote file.  Throws an Exception on errors unless the 
  +     * ifnoreErrors flag is set to True
        *
        * @param url the of the file to retrieve
        * @param destinationFile where to store it
  @@ -179,8 +180,8 @@
       }
   
       /**
  -     * Retrieve a remote file.  Returns true if the file was successfully
  -     * retrieved or if it is up to date (when the useTimestamp flag is set).
  +     * Retrieve a remote file.  Throws an Exception on errors unless the 
  +     * ifnoreErrors flag is set to True
        *
        * @param url the of the file to retrieve
        * @param destinationFile where to store it
  @@ -261,6 +262,16 @@
           if ( connection instanceof HttpURLConnection )
           {
               HttpURLConnection httpConnection = (HttpURLConnection) connection;
  +            // although HTTPUrlConnection javadocs says FileNotFoundException 
should be
  +            // thrown on a 404 error, that certainly does not appear to be the 
case, so
  +            // test for 404 ourselves, and throw FileNotFoundException as needed
  +            if ( httpConnection.getResponseCode() == 
HttpURLConnection.HTTP_NOT_FOUND)
  +            {
  +                if (ignoreErrors)
  +                    return;
  +                throw new FileNotFoundException(url.toString() + " (HTTP Error: "
  +                        + httpConnection.getResponseCode() + " " + 
httpConnection.getResponseMessage() + ")");
  +            }
               if ( httpConnection.getResponseCode() == 
HttpURLConnection.HTTP_NOT_MODIFIED )
               {
                   return;
  @@ -268,6 +279,8 @@
               // test for 401 result (HTTP only)
               if ( httpConnection.getResponseCode() == 
HttpURLConnection.HTTP_UNAUTHORIZED )
               {
  +                if (ignoreErrors)
  +                    return;
                   throw new Exception( "Not authorized." );
               }
           }
  
  
  

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

Reply via email to