commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Hyzer (JIRA)" <j...@apache.org>
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
         URL: http://issues.apache.org/jira/browse/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
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


Mime
View raw message