maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mic...@apache.org
Subject cvs commit: maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon StreamWagon.java
Date Tue, 27 Apr 2004 18:26:59 GMT
michal      2004/04/27 11:26:59

  Modified:    wagon-api/src/test/java/org/apache/maven/wagon/events
                        SessionEventTest.java
               wagon-api/src/test/java/org/apache/maven/wagon
                        AbstractWagonTest.java
               wagon-api/src/main/java/org/apache/maven/wagon
                        StreamWagon.java
  Log:
  Improving exception handling
  
  Revision  Changes    Path
  1.2       +1 -2      maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java
  
  Index: SessionEventTest.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SessionEventTest.java	30 Mar 2004 14:43:04 -0000	1.1
  +++ SessionEventTest.java	27 Apr 2004 18:26:59 -0000	1.2
  @@ -48,7 +48,6 @@
   import org.apache.maven.wagon.authentication.AuthenticationException;
   import org.apache.maven.wagon.repository.Repository;
   import org.apache.maven.wagon.Wagon;
  -import org.apache.maven.wagon.ConnectionException;
   import org.apache.maven.wagon.MockWagon;
   
   /**
  
  
  
  1.2       +2 -2      maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/AbstractWagonTest.java
  
  Index: AbstractWagonTest.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-api/src/test/java/org/apache/maven/wagon/AbstractWagonTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractWagonTest.java	30 Mar 2004 14:43:03 -0000	1.1
  +++ AbstractWagonTest.java	27 Apr 2004 18:26:59 -0000	1.2
  @@ -33,7 +33,7 @@
   
           artifact = new DefaultArtifact( "groupId", "artifactId", "version", "type", "extension"
);
   
  -        destination = new File( basedir, "destination" );
  +        destination = new File( basedir, "folder/subfolder" );
   
           source = new File( basedir, "project.xml" );
   
  
  
  
  1.5       +12 -5     maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/StreamWagon.java
  
  Index: StreamWagon.java
  ===================================================================
  RCS file: /home/cvs/maven-wagon/wagon-api/src/main/java/org/apache/maven/wagon/StreamWagon.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- StreamWagon.java	26 Apr 2004 21:23:35 -0000	1.4
  +++ StreamWagon.java	27 Apr 2004 18:26:59 -0000	1.5
  @@ -85,6 +85,13 @@
       public void get( String resource, File destination )
           throws TransferFailedException, ResourceDoesNotExistException, AuthorizationException
       {
  +        
  +        if ( destination == null )
  +        {
  +           throw new ResourceDoesNotExistException( "get: Destination cannot be null" );
  +        }
  +        
  +        
           if ( !destination.getParentFile().exists() )
           {
               if ( !destination.getParentFile().mkdirs() )
  @@ -101,8 +108,7 @@
           }
           catch ( FileNotFoundException e )
           {
  -            // This is taken care of above, if we cannot create the
  -            // parent directory then an exception will be thrown above.
  +            throw new TransferFailedException( "Cannot write to specified destination:
" + destination.getAbsolutePath() );
           }
   
           InputStream is;
  @@ -113,7 +119,9 @@
           }
           catch ( Exception e )
           {
  -            throw new TransferFailedException( "Cannot create input stream: ", e );
  +            String msg = "Cannot create input stream for resource: " + resource;
  +            
  +            throw new TransferFailedException( msg, e );
           }
   
           getTransfer( resource, is, os );
  @@ -136,8 +144,7 @@
           }
           catch ( FileNotFoundException e )
           {
  -            // This is taken care of above, if we cannot create the
  -            // parent directory then an exception will be thrown above.
  +            throw new TransferFailedException( "Cannot read from specified source: " +
source.getAbsolutePath() );
           }
   
           OutputStream os;
  
  
  

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