Author: olamy
Date: Fri Oct 28 09:42:53 2011
New Revision: 1190226

URL: http://svn.apache.org/viewvc?rev=1190226&view=rev
Log:
[MINDEXER-43] WagonFetch.retrieve swallows root causes of problems

Modified:
    
maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/updater/WagonHelper.java

Modified: 
maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/updater/WagonHelper.java
URL: 
http://svn.apache.org/viewvc/maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/updater/WagonHelper.java?rev=1190226&r1=1190225&r2=1190226&view=diff
==============================================================================
--- 
maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/updater/WagonHelper.java
 (original)
+++ 
maven/indexer/trunk/indexer-core/src/main/java/org/apache/maven/index/updater/WagonHelper.java
 Fri Oct 28 09:42:53 2011
@@ -134,13 +134,17 @@ public class WagonHelper
             {
                 String msg = "Authentication exception connecting to " + 
repository;
                 logError( msg, ex );
-                throw new IOException( msg );
+                IOException ioException = new IOException( msg );
+                ioException.initCause( ex );
+                throw ioException;
             }
             catch ( WagonException ex )
             {
                 String msg = "Wagon exception connecting to " + repository;
                 logError( msg, ex );
-                throw new IOException( msg );
+                IOException ioException = new IOException( msg );
+                ioException.initCause( ex );
+                throw ioException;
             }
         }
 
@@ -187,19 +191,25 @@ public class WagonHelper
             {
                 String msg = "Authorization exception retrieving " + name;
                 logError( msg, e );
-                throw new IOException( msg );
+                IOException ioException = new IOException( msg );
+                ioException.initCause( e );
+                throw ioException;
             }
             catch ( ResourceDoesNotExistException e )
             {
                 String msg = "Resource " + name + " does not exist";
                 logError( msg, e );
-                throw new FileNotFoundException( msg );
+                FileNotFoundException fileNotFoundException = new 
FileNotFoundException( msg );
+                fileNotFoundException.initCause( e );
+                throw fileNotFoundException;
             }
             catch ( WagonException e )
             {
                 String msg = "Transfer for " + name + " failed";
                 logError( msg, e );
-                throw new IOException( msg + "; " + e.getMessage() );
+                IOException ioException = new IOException( msg + "; " + 
e.getMessage() );
+                ioException.initCause( e );
+                throw ioException;
             }
         }
 


Reply via email to