maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r190538 - /maven/wagon/trunk/wagon-provider-api /maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon /maven/wagon/trunk/wagon-providers /maven/wagon/trunk/wagon-providers/wagon-file /maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file /maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh
Date Tue, 14 Jun 2005 00:41:13 GMT
Author: brett
Date: Mon Jun 13 17:41:12 2005
New Revision: 190538

URL: http://svn.apache.org/viewcvs?rev=190538&view=rev
Log:
PR: MNG-261
create parent directories for the artifact being downloaded at the appropriate time

Modified:
    maven/wagon/trunk/wagon-provider-api/pom.xml
    maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
    maven/wagon/trunk/wagon-providers/pom.xml
    maven/wagon/trunk/wagon-providers/wagon-file/pom.xml
    maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java
    maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java

Modified: maven/wagon/trunk/wagon-provider-api/pom.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-provider-api/pom.xml?rev=190538&r1=190537&r2=190538&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/pom.xml (original)
+++ maven/wagon/trunk/wagon-provider-api/pom.xml Mon Jun 13 17:41:12 2005
@@ -9,4 +9,5 @@
   </parent>
   <artifactId>wagon-provider-api</artifactId>
   <name>Maven Wagon API</name>
+  <version>1.0-alpha-4-SNAPSHOT</version>
 </project>

Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java?rev=190538&r1=190537&r2=190538&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
(original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/AbstractWagon.java
Mon Jun 13 17:41:12 2005
@@ -139,13 +139,8 @@
         throws ConnectionException;
 
     protected void createParentDirectories( File destination )
-        throws ResourceDoesNotExistException, TransferFailedException
+        throws TransferFailedException
     {
-        if ( destination == null )
-        {
-            throw new ResourceDoesNotExistException( "get: Destination cannot be null" );
-        }
-
         File destinationDirectory = destination.getParentFile();
         if ( destinationDirectory != null && !destinationDirectory.exists() )
         {
@@ -164,6 +159,10 @@
     protected void getTransfer( Resource resource, File destination, InputStream input )
         throws TransferFailedException
     {
+    	// ensure that the destination is created only when we are ready to transfer
+        fireTransferDebug( "attempting to create parent directories for destination: " +
destination.getName() );
+        createParentDirectories( destination );
+
         fireGetStarted( resource, destination );
 
         OutputStream output = new LazyFileOutputStream( destination );

Modified: maven/wagon/trunk/wagon-providers/pom.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/pom.xml?rev=190538&r1=190537&r2=190538&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/pom.xml (original)
+++ maven/wagon/trunk/wagon-providers/pom.xml Mon Jun 13 17:41:12 2005
@@ -15,7 +15,7 @@
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>
       <artifactId>wagon-provider-api</artifactId>
-      <version>1.0-alpha-3</version>
+      <version>1.0-alpha-4-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.wagon</groupId>

Modified: maven/wagon/trunk/wagon-providers/wagon-file/pom.xml
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-file/pom.xml?rev=190538&r1=190537&r2=190538&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-file/pom.xml (original)
+++ maven/wagon/trunk/wagon-providers/wagon-file/pom.xml Mon Jun 13 17:41:12 2005
@@ -5,8 +5,9 @@
   <parent>
     <groupId>org.apache.maven.wagon</groupId>
     <artifactId>wagon-providers</artifactId>
-    <version>1.0-alpha-3</version>
+    <version>1.0-alpha-4-SNAPSHOT</version>
   </parent>
   <artifactId>wagon-file</artifactId>
   <name>Maven Wagon File Provider</name>
+  <version>1.0-alpha-4-SNAPSHOT</version>
 </project>

Modified: maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java?rev=190538&r1=190537&r2=190538&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-file/src/main/java/org/apache/maven/wagon/providers/file/FileWagon.java
Mon Jun 13 17:41:12 2005
@@ -74,24 +74,11 @@
     public void fillOutputData( OutputData outputData )
         throws TransferFailedException
     {
-
         Resource resource = outputData.getResource();
 
         File file = new File( getRepository().getBasedir(), resource.getName() );
 
-        File dir = file.getParentFile();
-
-        if ( dir != null && !dir.exists() )
-        {
-
-            if ( !dir.mkdirs() )
-            {
-                String msg = "Some of the requied directories do not exist and could not
be create. " +
-                    "Requested path:  " + file.getAbsolutePath();
-
-                throw new TransferFailedException( msg );
-            }
-        }
+        createParentDirectories( file );
 
         OutputStream outputStream = new LazyFileOutputStream( file );
 

Modified: maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
URL: http://svn.apache.org/viewcvs/maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java?rev=190538&r1=190537&r2=190538&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
(original)
+++ maven/wagon/trunk/wagon-providers/wagon-ssh/src/main/java/org/apache/maven/wagon/providers/ssh/ScpWagon.java
Mon Jun 13 17:41:12 2005
@@ -270,7 +270,7 @@
 
             channel.connect();
 
-            if ( checkAck( in ) != 0 )
+            if ( checkAck( in, false ) != 0 )
             {
                 throw new TransferFailedException( "ACK check failed" );
             }
@@ -295,7 +295,7 @@
 
             out.flush();
 
-            if ( checkAck( in ) != 0 )
+            if ( checkAck( in, false ) != 0 )
             {
                 throw new TransferFailedException( "ACK check failed" );
             }
@@ -311,7 +311,7 @@
 
             out.flush();
 
-            if ( checkAck( in ) != 0 )
+            if ( checkAck( in, false ) != 0 )
             {
                 throw new TransferFailedException( "ACK check failed" );
             }
@@ -404,7 +404,7 @@
             while ( true )
             {
                 // TODO: is this really an ACK, or just an in.read()? If the latter, change
checkAck method to not return a value, but throw an exception on non-zero result
-                int c = checkAck( in );
+                int c = checkAck( in, true );
 
                 if ( c != 'C' )
                 {
@@ -497,7 +497,7 @@
 
                 fireGetCompleted( resource, destination );
 
-                if ( checkAck( in ) != 0 )
+                if ( checkAck( in, true ) != 0 )
                 {
                     throw new TransferFailedException( "Wrong ACK" );
                 }
@@ -608,7 +608,7 @@
         }
     }
 
-    static int checkAck( InputStream in )
+    static int checkAck( InputStream in, boolean isGet )
         throws IOException, ResourceDoesNotExistException, TransferFailedException
     {
         int b = in.read();
@@ -640,7 +640,7 @@
             if ( b == 1 )
             {
                 // error
-                if ( message.endsWith( "No such file or directory\n" ) )
+                if ( message.endsWith( "No such file or directory\n" ) && isGet )
                 {
                     // TODO: this might be too hokey?
                     throw new ResourceDoesNotExistException( message );



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


Mime
View raw message