commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Hyzer (JIRA)" <>
Subject [jira] Created: (BEANUTILS-241) BeanComparator throws wrong exception and hides cause
Date Sun, 11 Jun 2006 03:10:33 GMT
BeanComparator throws wrong exception and hides cause

         Key: BEANUTILS-241
     Project: Commons BeanUtils
        Type: Bug

    Versions: 1.6 Final    
    Reporter: Chris Hyzer
    Priority: Minor

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
  throw new RuntimeException(e);

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message