You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by ba...@apache.org on 2006/09/13 01:16:31 UTC

svn commit: r442755 - /jakarta/commons/proper/beanutils/trunk/optional/bean-collections/src/java/org/apache/commons/beanutils/BeanComparator.java

Author: bayard
Date: Tue Sep 12 16:16:30 2006
New Revision: 442755

URL: http://svn.apache.org/viewvc?view=rev&rev=442755
Log:
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

Modified:
    jakarta/commons/proper/beanutils/trunk/optional/bean-collections/src/java/org/apache/commons/beanutils/BeanComparator.java

Modified: jakarta/commons/proper/beanutils/trunk/optional/bean-collections/src/java/org/apache/commons/beanutils/BeanComparator.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/optional/bean-collections/src/java/org/apache/commons/beanutils/BeanComparator.java?view=diff&rev=442755&r1=442754&r2=442755
==============================================================================
--- jakarta/commons/proper/beanutils/trunk/optional/bean-collections/src/java/org/apache/commons/beanutils/BeanComparator.java (original)
+++ jakarta/commons/proper/beanutils/trunk/optional/bean-collections/src/java/org/apache/commons/beanutils/BeanComparator.java Tue Sep 12 16:16:30 2006
@@ -17,6 +17,7 @@
 
 package org.apache.commons.beanutils;
 
+import java.lang.reflect.InvocationTargetException;
 import java.io.Serializable;
 import java.util.Comparator;
 import org.apache.commons.beanutils.PropertyUtils;
@@ -152,9 +153,15 @@
             Object value2 = PropertyUtils.getProperty( o2, property );
             return comparator.compare( value1, value2 );
         }
-        catch ( Exception e ) {
-            throw new ClassCastException( e.toString() );
+        catch ( IllegalAccessException iae ) {
+            throw new RuntimeException( "IllegalAccessException: " + iae.toString() );
+        } 
+        catch ( InvocationTargetException ite ) {
+            throw new RuntimeException( "InvocationTargetException: " + ite.toString() );
         }
+        catch ( NoSuchMethodException nsme ) {
+            throw new RuntimeException( "NoSuchMethodException: " + nsme.toString() );
+        } 
     }
     
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org