TCK failure: Must check to see if property is resolved and throw exception if not.
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 16 Jan 2010 12:57:55 +0000 (12:57 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Sat, 16 Jan 2010 12:57:55 +0000 (12:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@899935 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/el/parser/AstIdentifier.java
java/org/apache/el/parser/AstValue.java

index ee09ac7..c6f4c9f 100644 (file)
@@ -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
index e1e434b..1c37387 100644 (file)
@@ -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) {