From: rjung Date: Thu, 18 Sep 2008 17:08:10 +0000 (+0000) Subject: Fix ClassCastException when we try to cast a X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5d5423ea8116e39742c0ce2a24a3cea80766eca6;p=tomcat7.0 Fix ClassCastException when we try to cast a NullPointerException to an ELException. I still need to investigate where the NPE came from, but simply casting seems unsafe in any case. Use a cast if possible and recreate exception otherwise. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@696716 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/el/lang/ExpressionBuilder.java b/java/org/apache/el/lang/ExpressionBuilder.java index 61d351cc1..006dca9a2 100644 --- a/java/org/apache/el/lang/ExpressionBuilder.java +++ b/java/org/apache/el/lang/ExpressionBuilder.java @@ -132,7 +132,11 @@ public final class ExpressionBuilder implements NodeVisitor { try { node.accept(this); } catch (Exception e) { - throw (ELException) e; + if (e instanceof ELException) { + throw (ELException) e; + } else { + throw (new ELException(e)); + } } if (this.fnMapper instanceof FunctionMapperFactory) { this.fnMapper = ((FunctionMapperFactory) this.fnMapper).create();