maven-wagon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r680225 - in /maven/wagon/trunk/wagon-provider-api/src: main/java/org/apache/maven/wagon/observers/ChecksumObserver.java test/java/org/apache/maven/wagon/observers/ test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
Date Mon, 28 Jul 2008 02:06:42 GMT
Author: brett
Date: Sun Jul 27 19:06:41 2008
New Revision: 680225

URL: http://svn.apache.org/viewvc?rev=680225&view=rev
Log:
[WAGON-224] do not throw a NPE on subsequent transfers if a previous transfer failed in error

Added:
    maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/
    maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
  (with props)
Modified:
    maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java

Modified: maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java?rev=680225&r1=680224&r2=680225&view=diff
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java
(original)
+++ maven/wagon/trunk/wagon-provider-api/src/main/java/org/apache/maven/wagon/observers/ChecksumObserver.java
Sun Jul 27 19:06:41 2008
@@ -83,7 +83,8 @@
 
     public void transferError( TransferEvent transferEvent )
     {
-        digester = null;
+        digester.reset();
+        
         actualChecksum = null;
     }
 

Added: maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
URL: http://svn.apache.org/viewvc/maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java?rev=680225&view=auto
==============================================================================
--- maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
(added)
+++ maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
Sun Jul 27 19:06:41 2008
@@ -0,0 +1,92 @@
+package org.apache.maven.wagon.observers;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+
+import junit.framework.TestCase;
+
+import org.apache.maven.wagon.ConnectionException;
+import org.apache.maven.wagon.ResourceDoesNotExistException;
+import org.apache.maven.wagon.TransferFailedException;
+import org.apache.maven.wagon.Wagon;
+import org.apache.maven.wagon.WagonMock;
+import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.apache.maven.wagon.events.TransferListener;
+import org.apache.maven.wagon.repository.Repository;
+
+public class ChecksumObserverTest
+    extends TestCase
+{
+    private Wagon wagon;
+
+    public void setUp()
+        throws Exception
+    {
+        super.setUp();
+
+        wagon = new WagonMock( true );
+
+        Repository repository = new Repository();
+        wagon.connect( repository );        
+    }
+    
+    public void tearDown()
+        throws ConnectionException
+    {
+        wagon.disconnect();
+    }
+
+    public void testSubsequentTransfersAfterTransferError()
+        throws NoSuchAlgorithmException, ResourceDoesNotExistException,
+        AuthorizationException, IOException
+    {
+        TransferListener listener = new ChecksumObserver();
+
+        wagon.addTransferListener( listener );
+
+        File testFile = File.createTempFile( "wagon", "tmp" );
+        testFile.deleteOnExit();
+        
+        try
+        {
+            wagon.get( "resource", testFile );
+            fail();
+        }
+        catch ( TransferFailedException e )
+        {
+            assertTrue( true );
+        }
+
+        try
+        {
+            wagon.get( "resource", testFile );
+            fail();
+        }
+        catch ( TransferFailedException e )
+        {
+            assertTrue( true );
+        }
+        
+        testFile.delete();
+    }
+}

Propchange: maven/wagon/trunk/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



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


Mime
View raw message