WagonFetch.retrieve swallows root causes of problems
----------------------------------------------------

                 Key: MINDEXER-43
                 URL: https://jira.codehaus.org/browse/MINDEXER-43
             Project: Maven Indexer
          Issue Type: Bug
    Affects Versions: 4.1.2
            Reporter: Jesse Glick
            Priority: Minor


{{WagonFetch.retrieve}} catches {{AuthorizationException}}, 
{{ResourceDoesNotExistException}}, and {{WagonException}} and rethrows as 
{{IOException}} without including the original exception as a cause. This may 
make it more difficult to diagnose errors: while 
{{TransferListener.transferError}} will receive the root exception, it may not 
be obvious that an error here is the "final" error (e.g. if a {{.gz}} index 
cannot be found but a {{.zip}} can); inspecting the final {{IOException}} from 
{{IndexUpdater.fetchAndUpdateIndex}} is more convenient.

Fix should be easy: in {{retrieve}}, replace the three occurrences of

{code:java}
throw new SomeException( ... );
{code}

with

{code:java}
SomeException e2 = new SomeException( ... );
e2.initCause( e );
throw e2;
{code}

({{IOException}} has a constructor to do this directly in JDK 6 but I guess you 
are compatible with JDK 5. Anyway {{FileNotFoundException}} still does not.)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to