You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by bw...@apache.org on 2003/04/05 14:05:40 UTC

cvs commit: maven/src/java/org/apache/maven/util HttpUtils.java

bwalding    2003/04/05 04:05:40

  Modified:    src/java/org/apache/maven/util HttpUtils.java
  Log:
  Now downloads to temporary file and renames it once finished. Not perfect, but
  will stop half-done downloads from breaking builds.  Would be better if we could resume,
  but I don't have time to test that at present.
  PR: MAVEN-371
  
  Revision  Changes    Path
  1.22      +12 -1     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.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- HttpUtils.java	10 Feb 2003 13:55:00 -0000	1.21
  +++ HttpUtils.java	5 Apr 2003 12:05:39 -0000	1.22
  @@ -144,15 +144,26 @@
                                   boolean useChecksum )
           throws Exception
       {
  +        File tempFile = new File(destinationFile.getParentFile(), destinationFile.getName() + ".incomplete");
  +        
  +        //No resume at present.
  +        if (tempFile.exists()) 
  +        {
  +            tempFile.delete();    
  +        }
  +        
           // Get the requested file.
           getFile( url,
  -                 destinationFile,
  +                 tempFile,
                    ignoreErrors,
                    useTimestamp,
                    proxyHost,
                    proxyPort,
                    proxyUserName,
                    proxyPassword );
  +                 
  +        tempFile.renameTo(destinationFile);                                   
  +
   
           // Get the checksum if requested.
           if ( useChecksum )
  
  
  

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