You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2014/03/26 00:30:15 UTC

svn commit: r1581598 - in /tomcat/trunk/java/javax/el: BeanELResolver.java ExpressionFactory.java

Author: markt
Date: Tue Mar 25 23:30:14 2014
New Revision: 1581598

URL: http://svn.apache.org/r1581598
Log:
Code review
- use multicatch to reduce code duplication
- use Util.handleThrowable() to reduce code duplication

Modified:
    tomcat/trunk/java/javax/el/BeanELResolver.java
    tomcat/trunk/java/javax/el/ExpressionFactory.java

Modified: tomcat/trunk/java/javax/el/BeanELResolver.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/BeanELResolver.java?rev=1581598&r1=1581597&r2=1581598&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/BeanELResolver.java (original)
+++ tomcat/trunk/java/javax/el/BeanELResolver.java Tue Mar 25 23:30:14 2014
@@ -95,16 +95,9 @@ public class BeanELResolver extends ELRe
         Method m = this.property(context, base, property).read(context);
         try {
             return m.invoke(base, (Object[]) null);
-        } catch (IllegalAccessException e) {
-            throw new ELException(e);
         } catch (InvocationTargetException e) {
             Throwable cause = e.getCause();
-            if (cause instanceof ThreadDeath) {
-                throw (ThreadDeath) cause;
-            }
-            if (cause instanceof VirtualMachineError) {
-                throw (VirtualMachineError) cause;
-            }
+            Util.handleThrowable(cause);
             throw new ELException(Util.message(context, "propertyReadError",
                     base.getClass().getName(), property.toString()), cause);
         } catch (Exception e) {
@@ -132,16 +125,9 @@ public class BeanELResolver extends ELRe
         Method m = this.property(context, base, property).write(context);
         try {
             m.invoke(base, value);
-        } catch (IllegalAccessException e) {
-            throw new ELException(e);
         } catch (InvocationTargetException e) {
             Throwable cause = e.getCause();
-            if (cause instanceof ThreadDeath) {
-                throw (ThreadDeath) cause;
-            }
-            if (cause instanceof VirtualMachineError) {
-                throw (VirtualMachineError) cause;
-            }
+            Util.handleThrowable(cause);
             throw new ELException(Util.message(context, "propertyWriteError",
                     base.getClass().getName(), property.toString()), cause);
         } catch (Exception e) {

Modified: tomcat/trunk/java/javax/el/ExpressionFactory.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/ExpressionFactory.java?rev=1581598&r1=1581597&r2=1581598&view=diff
==============================================================================
--- tomcat/trunk/java/javax/el/ExpressionFactory.java (original)
+++ tomcat/trunk/java/javax/el/ExpressionFactory.java Tue Mar 25 23:30:14 2014
@@ -188,26 +188,13 @@ public abstract class ExpressionFactory 
                     (ExpressionFactory) constructor.newInstance(properties);
             }
 
-        } catch (InstantiationException e) {
-            throw new ELException(
-                    "Unable to create ExpressionFactory of type: " + clazz.getName(),
-                    e);
-        } catch (IllegalAccessException e) {
-            throw new ELException(
-                    "Unable to create ExpressionFactory of type: " + clazz.getName(),
-                    e);
-        } catch (IllegalArgumentException e) {
+        } catch (InstantiationException | IllegalAccessException | IllegalArgumentException e) {
             throw new ELException(
                     "Unable to create ExpressionFactory of type: " + clazz.getName(),
                     e);
         } catch (InvocationTargetException e) {
             Throwable cause = e.getCause();
-            if (cause instanceof ThreadDeath) {
-                throw (ThreadDeath) cause;
-            }
-            if (cause instanceof VirtualMachineError) {
-                throw (VirtualMachineError) cause;
-            }
+            Util.handleThrowable(cause);
             throw new ELException(
                     "Unable to create ExpressionFactory of type: " + clazz.getName(),
                     e);



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