You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Henri Yandell (JIRA)" <ji...@apache.org> on 2006/09/13 01:15:24 UTC
[jira] Closed: (BEANUTILS-241) BeanComparator throws wrong
exception and hides cause
[ http://issues.apache.org/jira/browse/BEANUTILS-241?page=all ]
Henri Yandell closed BEANUTILS-241.
-----------------------------------
Fix Version/s: 1.8.0
Resolution: Fixed
svn ci -m "Switching the catch(Exception -> throw ClassCast to code that catches the particular exceptions thrown and rethrows them as RuntimeExceptions. The previous catch caught too much as complained about in #BEANUTILS-241" src/java/org/apache/commons/beanutils/BeanComparator.java
Sending src/java/org/apache/commons/beanutils/BeanComparator.java
Transmitting file data .
Committed revision 442755.
> BeanComparator throws wrong exception and hides cause
> -----------------------------------------------------
>
> Key: BEANUTILS-241
> URL: http://issues.apache.org/jira/browse/BEANUTILS-241
> Project: Commons BeanUtils
> Issue Type: Bug
> Affects Versions: 1.6 Release
> Reporter: Chris Hyzer
> Priority: Minor
> Fix For: 1.8.0
>
>
> BeanComparator does this:
> catch ( Exception e ) {
> throw new ClassCastException( e.toString() );
> }
> In my case, it was a getter throwing an exception, so it wasnt a ClassCastException, but BeanComparator threw as such. I couldnt see what the real exception was since the exception was not propagated as cause. I recommend:
> catch(Exception e) {
> if (e instanceof RuntimeException) {
> throw (RuntimeException)e;
> }
> //if this isnt available in the java version you are targetting, the above line will improve things...
> throw new RuntimeException(e);
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org