You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wagon-commits@maven.apache.org by mi...@apache.org on 2004/11/02 21:39:35 UTC

cvs commit: maven-wagon/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp FtpWagon.java

michal      2004/11/02 12:39:35

  Modified:    wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp
                        FtpWagon.java
  Log:
  trying to make it work again
  
  Revision  Changes    Path
  1.3       +41 -11    maven-wagon/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java
  
  Index: FtpWagon.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-providers/wagon-ftp/src/main/java/org/apache/maven/wagon/providers/ftp/FtpWagon.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FtpWagon.java	1 Nov 2004 19:43:53 -0000	1.2
  +++ FtpWagon.java	2 Nov 2004 20:39:35 -0000	1.3
  @@ -27,12 +27,14 @@
   import org.apache.maven.wagon.StreamWagon;
   import org.apache.maven.wagon.TransferFailedException;
   import org.apache.maven.wagon.WagonConstants;
  +import org.apache.maven.wagon.events.TransferListener;
   import org.apache.maven.wagon.authentication.AuthenticationException;
   import org.apache.maven.wagon.authentication.AuthenticationInfo;
   
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.OutputStream;
  +import java.io.File;
   
   public class FtpWagon
       extends StreamWagon
  @@ -143,12 +145,44 @@
           }
       }
   
  +    protected void firePutCompleted( String s, File file )
  +    {
  +
  +
  +        try
  +        {
  +            ftp.completePendingCommand();
  +        }
  +        catch ( IOException e )
  +        {
  +            // michal I am not sure  what error means in that context
  +            // I think that we will be able to recover or simply we will fail later on
  +        }
  +
  +         super.firePutCompleted( s, file );
  +    }
  +
  +
  +    protected void fireGetCompleted( String resource, File localFile )
  +    {
  +        try
  +        {
  +            ftp.completePendingCommand();
  +        }
  +        catch ( IOException e )
  +        {
  +            // michal I am not sure  what error means in that context
  +            // actually I am not even sure why we have to invoke that command
  +            // I think that we will be able to recover or simply we will fail later on
  +        }
  +        super.fireGetCompleted( resource, localFile );
  +    }
  +
       public void closeConnection()
           throws ConnectionException
       {
           if ( ftp.isConnected() )
           {
  -            
               try
               {
                   // This is a NPE rethink shutting down the streams
  @@ -161,11 +195,6 @@
           }
       }
   
  -    
  -
  -    // ----------------------------------------------------------------------
  -    //
  -    // ----------------------------------------------------------------------
   
       public OutputStream getOutputStream( String resource )
           throws TransferFailedException
  @@ -202,15 +231,16 @@
   
               if ( os == null)
               {
  -                 fireTransferDebug( "REPLY STRING: " + ftp.getReplyString() );
  +                String msg = "Cannot transfer resource:  '" +
  +                        resource + "' Output stream is null. FTP Server response: " +
  +                        ftp.getReplyString();
   
  -                 fireTransferDebug( "REPLY: " + ftp.getReply() );
  +                throw new TransferFailedException( msg );
   
  -                 fireTransferDebug( "REPLY CODE: " + ftp.getReplyCode() );
               }
  -
  -            fireTransferDebug( "resource = " + resource );
               
  +            fireTransferDebug( "resource = " + resource );
  +
           }
           catch ( Exception e )
           {
  
  
  

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