forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ross Gardler <rgard...@apache.org>
Subject Re: svn commit: r428728 - /forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java
Date Fri, 04 Aug 2006 14:31:14 GMT
thorsten@apache.org wrote:
> Author: thorsten
> Date: Fri Aug  4 07:01:27 2006
> New Revision: 428728
> 
> URL: http://svn.apache.org/viewvc?rev=428728&view=rev
> Log:
> Throwing the exception instead of swollowing it. Forgot to add this in the first place.
> 
> Modified:
>     forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java
> 
> Modified: forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java
> URL: http://svn.apache.org/viewvc/forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java?rev=428728&r1=428727&r2=428728&view=diff
> ==============================================================================
> --- forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java (original)
> +++ forrest/trunk/main/java/org/apache/forrest/conf/ForrestConfModule.java Fri Aug  4
07:01:27 2006
> @@ -177,6 +177,7 @@
>          }
>          } catch (Exception e) {
>          	getLogger().error("Opps, something went wrong.",e);
> +        	throw new Exception("Opps, something went wrong.",e);
>          }

Better, but ...

Why wrap it in a new exception?

We should be doing one of the following:

1) prevent the exception occurring
2) trap the exception and deal with it
3) let the exception pass through and deal with it later
4) wrap the exception in a *more* meaningful exception (either checked 
or unchecked) and rethrow it

What was happening was 2) with respect to FileNotFound and 3) with 
respect to all other exceptions.

You've modified it so that we are doing 2) with respect to FileNotFound, 
that's good, but you have also wrapped the exception in a *less* 
meaningful one for example you could be going from IOException to Exception.

What added benefit do we get from this catch and rethrow?

Ross


Mime
View raw message