From: markt Date: Sat, 16 Jan 2010 12:57:55 +0000 (+0000) Subject: TCK failure: Must check to see if property is resolved and throw exception if not. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=3cf9fbf0656ab512a1fba21667478ac29d1fac40;p=tomcat7.0 TCK failure: Must check to see if property is resolved and throw exception if not. git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@899935 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/el/parser/AstIdentifier.java b/java/org/apache/el/parser/AstIdentifier.java index ee09ac721..c6f4c9f5b 100644 --- a/java/org/apache/el/parser/AstIdentifier.java +++ b/java/org/apache/el/parser/AstIdentifier.java @@ -22,10 +22,12 @@ import javax.el.ELException; import javax.el.MethodExpression; import javax.el.MethodInfo; import javax.el.MethodNotFoundException; +import javax.el.PropertyNotFoundException; import javax.el.ValueExpression; import javax.el.VariableMapper; import org.apache.el.lang.EvaluationContext; +import org.apache.el.util.MessageFactory; /** @@ -47,7 +49,12 @@ public final class AstIdentifier extends SimpleNode { } } ctx.setPropertyResolved(false); - return ctx.getELResolver().getType(ctx, null, this.image); + Class result = ctx.getELResolver().getType(ctx, null, this.image); + if (!ctx.isPropertyResolved()) { + throw new PropertyNotFoundException(MessageFactory.get( + "error.resolver.unhandled.null", this.image)); + } + return result; } @Override @@ -60,7 +67,12 @@ public final class AstIdentifier extends SimpleNode { } } ctx.setPropertyResolved(false); - return ctx.getELResolver().getValue(ctx, null, this.image); + Object result = ctx.getELResolver().getValue(ctx, null, this.image); + if (!ctx.isPropertyResolved()) { + throw new PropertyNotFoundException(MessageFactory.get( + "error.resolver.unhandled.null", this.image)); + } + return result; } @Override @@ -73,7 +85,12 @@ public final class AstIdentifier extends SimpleNode { } } ctx.setPropertyResolved(false); - return ctx.getELResolver().isReadOnly(ctx, null, this.image); + boolean result = ctx.getELResolver().isReadOnly(ctx, null, this.image); + if (!ctx.isPropertyResolved()) { + throw new PropertyNotFoundException(MessageFactory.get( + "error.resolver.unhandled.null", this.image)); + } + return result; } @Override @@ -89,6 +106,10 @@ public final class AstIdentifier extends SimpleNode { } ctx.setPropertyResolved(false); ctx.getELResolver().setValue(ctx, null, this.image, value); + if (!ctx.isPropertyResolved()) { + throw new PropertyNotFoundException(MessageFactory.get( + "error.resolver.unhandled.null", this.image)); + } } @Override diff --git a/java/org/apache/el/parser/AstValue.java b/java/org/apache/el/parser/AstValue.java index e1e434b79..1c3738749 100644 --- a/java/org/apache/el/parser/AstValue.java +++ b/java/org/apache/el/parser/AstValue.java @@ -57,7 +57,12 @@ public final class AstValue extends SimpleNode { public Class getType(EvaluationContext ctx) throws ELException { Target t = getTarget(ctx); ctx.setPropertyResolved(false); - return ctx.getELResolver().getType(ctx, t.base, t.property); + Class result = ctx.getELResolver().getType(ctx, t.base, t.property); + if (!ctx.isPropertyResolved()) { + throw new PropertyNotFoundException(MessageFactory.get( + "error.resolver.unhandled", t.base, t.property)); + } + return result; } private final Target getTarget(EvaluationContext ctx) throws ELException { @@ -141,6 +146,10 @@ public final class AstValue extends SimpleNode { i++; } } + if (!ctx.isPropertyResolved()) { + throw new PropertyNotFoundException(MessageFactory.get( + "error.resolver.unhandled", base, suffix)); + } return base; } @@ -148,7 +157,13 @@ public final class AstValue extends SimpleNode { public boolean isReadOnly(EvaluationContext ctx) throws ELException { Target t = getTarget(ctx); ctx.setPropertyResolved(false); - return ctx.getELResolver().isReadOnly(ctx, t.base, t.property); + boolean result = + ctx.getELResolver().isReadOnly(ctx, t.base, t.property); + if (!ctx.isPropertyResolved()) { + throw new PropertyNotFoundException(MessageFactory.get( + "error.resolver.unhandled", t.base, t.property)); + } + return result; } @Override @@ -167,6 +182,10 @@ public final class AstValue extends SimpleNode { } else { resolver.setValue(ctx, t.base, t.property, value); } + if (!ctx.isPropertyResolved()) { + throw new PropertyNotFoundException(MessageFactory.get( + "error.resolver.unhandled", t.base, t.property)); + } } private boolean isAssignable(Object value, Class targetClass) {