This is an automated email from the ASF dual-hosted git repository.

markt-asf pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 46d1b6ff8d Align Tomcat with clarifications in Jakarta EL
46d1b6ff8d is described below

commit 46d1b6ff8d81a94df816fb85a262885e00ca5908
Author: Mark Thomas <[email protected]>
AuthorDate: Wed Dec 2 16:27:51 2026 +0000

    Align Tomcat with clarifications in Jakarta EL
    
    The requirements for calling EvaluationListener have been clarified.
    Tomcat was calling the listener to often and for events where it was not
    required.
---
 java/javax/el/ValueExpression.java                 |  14 +-
 java/org/apache/el/MethodExpressionImpl.java       |   5 +-
 java/org/apache/el/MethodExpressionLiteral.java    |   6 +-
 java/org/apache/el/ValueExpressionImpl.java        |  15 +-
 java/org/apache/el/ValueExpressionLiteral.java     |  16 +-
 java/org/apache/jasper/el/JspMethodExpression.java |  10 +-
 java/org/apache/jasper/el/JspValueExpression.java  |  17 +-
 test/javax/el/TestEvaluationListener.java          | 182 +++++++++++++++++++++
 .../el/TestJspExpressionEvaluationListener.java    | 126 ++++++++++++++
 webapps/docs/changelog.xml                         |  13 ++
 10 files changed, 347 insertions(+), 57 deletions(-)

diff --git a/java/javax/el/ValueExpression.java 
b/java/javax/el/ValueExpression.java
index 86c9c57d89..51397e0efb 100644
--- a/java/javax/el/ValueExpression.java
+++ b/java/javax/el/ValueExpression.java
@@ -16,6 +16,17 @@
  */
 package javax.el;
 
+import java.util.Objects;
+
+/**
+ * Represents a parsed EL expression that can be evaluated to produce a value.
+ * <p>
+ * A value expression is created by parsing an EL expression string and can be
+ * evaluated multiple times in different contexts. It supports reading values,
+ * writing values, and introspecting the expression's type and mutability.
+ *
+ * @since EL 2.1
+ */
 public abstract class ValueExpression extends Expression {
 
     private static final long serialVersionUID = 8577809572381654673L;
@@ -79,8 +90,7 @@ public abstract class ValueExpression extends Expression {
      */
     public ValueReference getValueReference(ELContext context) {
         // Expected to be over-ridden by implementation
-        context.notifyBeforeEvaluation(getExpressionString());
-        context.notifyAfterEvaluation(getExpressionString());
+        Objects.requireNonNull(context);
         return null;
     }
 }
diff --git a/java/org/apache/el/MethodExpressionImpl.java 
b/java/org/apache/el/MethodExpressionImpl.java
index eb5d8a3e0f..1689ecdfd5 100644
--- a/java/org/apache/el/MethodExpressionImpl.java
+++ b/java/org/apache/el/MethodExpressionImpl.java
@@ -187,10 +187,7 @@ public final class MethodExpressionImpl extends 
MethodExpression implements Exte
             throws PropertyNotFoundException, MethodNotFoundException, 
ELException {
         Node n = this.getNode();
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, 
this.varMapper);
-        ctx.notifyBeforeEvaluation(getExpressionString());
-        MethodInfo result = n.getMethodInfo(ctx, this.paramTypes);
-        ctx.notifyAfterEvaluation(getExpressionString());
-        return result;
+        return n.getMethodInfo(ctx, this.paramTypes);
     }
 
     private Node getNode() throws ELException {
diff --git a/java/org/apache/el/MethodExpressionLiteral.java 
b/java/org/apache/el/MethodExpressionLiteral.java
index 7e3da24780..bc6baada04 100644
--- a/java/org/apache/el/MethodExpressionLiteral.java
+++ b/java/org/apache/el/MethodExpressionLiteral.java
@@ -63,12 +63,10 @@ public class MethodExpressionLiteral extends 
MethodExpression implements Externa
 
     @Override
     public MethodInfo getMethodInfo(ELContext context) throws ELException {
-        context.notifyBeforeEvaluation(getExpressionString());
-        MethodInfo result = new MethodInfo(this.expr, this.expectedType, 
this.paramTypes);
-        context.notifyAfterEvaluation(getExpressionString());
-        return result;
+        return new MethodInfo(this.expr, this.expectedType, this.paramTypes);
     }
 
+
     @Override
     public Object invoke(ELContext context, Object[] params) throws 
ELException {
         context.notifyBeforeEvaluation(getExpressionString());
diff --git a/java/org/apache/el/ValueExpressionImpl.java 
b/java/org/apache/el/ValueExpressionImpl.java
index 8f0dc7ddd4..044876d335 100644
--- a/java/org/apache/el/ValueExpressionImpl.java
+++ b/java/org/apache/el/ValueExpressionImpl.java
@@ -159,10 +159,7 @@ public final class ValueExpressionImpl extends 
ValueExpression implements Extern
     @Override
     public Class<?> getType(ELContext context) throws 
PropertyNotFoundException, ELException {
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, 
this.varMapper);
-        context.notifyBeforeEvaluation(getExpressionString());
-        Class<?> result = this.getNode().getType(ctx);
-        context.notifyAfterEvaluation(getExpressionString());
-        return result;
+        return this.getNode().getType(ctx);
     }
 
     @Override
@@ -194,10 +191,7 @@ public final class ValueExpressionImpl extends 
ValueExpression implements Extern
     @Override
     public boolean isReadOnly(ELContext context) throws 
PropertyNotFoundException, ELException {
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, 
this.varMapper);
-        context.notifyBeforeEvaluation(getExpressionString());
-        boolean result = this.getNode().isReadOnly(ctx);
-        context.notifyAfterEvaluation(getExpressionString());
-        return result;
+        return this.getNode().isReadOnly(ctx);
     }
 
     @Override
@@ -236,9 +230,6 @@ public final class ValueExpressionImpl extends 
ValueExpression implements Extern
     @Override
     public ValueReference getValueReference(ELContext context) {
         EvaluationContext ctx = new EvaluationContext(context, this.fnMapper, 
this.varMapper);
-        context.notifyBeforeEvaluation(getExpressionString());
-        ValueReference result = this.getNode().getValueReference(ctx);
-        context.notifyAfterEvaluation(getExpressionString());
-        return result;
+        return this.getNode().getValueReference(ctx);
     }
 }
diff --git a/java/org/apache/el/ValueExpressionLiteral.java 
b/java/org/apache/el/ValueExpressionLiteral.java
index 93878fe427..68bdbcd430 100644
--- a/java/org/apache/el/ValueExpressionLiteral.java
+++ b/java/org/apache/el/ValueExpressionLiteral.java
@@ -61,36 +61,26 @@ public final class ValueExpressionLiteral extends 
ValueExpression implements Ext
 
     @Override
     public Object getValue(ELContext context) {
-        context.notifyBeforeEvaluation(getExpressionString());
-        Object result;
         if (this.expectedType != null) {
-            result = context.convertToType(this.value, this.expectedType);
+            return context.convertToType(this.value, this.expectedType);
         } else {
-            result = this.value;
+            return this.value;
         }
-        context.notifyAfterEvaluation(getExpressionString());
-        return result;
     }
 
     @Override
     public void setValue(ELContext context, Object value) {
-        context.notifyBeforeEvaluation(getExpressionString());
         throw new 
PropertyNotWritableException(MessageFactory.get("error.value.literal.write", 
this.value));
     }
 
     @Override
     public boolean isReadOnly(ELContext context) {
-        context.notifyBeforeEvaluation(getExpressionString());
-        context.notifyAfterEvaluation(getExpressionString());
         return true;
     }
 
     @Override
     public Class<?> getType(ELContext context) {
-        context.notifyBeforeEvaluation(getExpressionString());
-        Class<?> result = (this.value != null) ? this.value.getClass() : null;
-        context.notifyAfterEvaluation(getExpressionString());
-        return result;
+        return (this.value != null) ? this.value.getClass() : null;
     }
 
     @Override
diff --git a/java/org/apache/jasper/el/JspMethodExpression.java 
b/java/org/apache/jasper/el/JspMethodExpression.java
index 97571f10dd..abafc6e6fc 100644
--- a/java/org/apache/jasper/el/JspMethodExpression.java
+++ b/java/org/apache/jasper/el/JspMethodExpression.java
@@ -62,11 +62,8 @@ public final class JspMethodExpression extends 
MethodExpression implements Exter
     @Override
     public MethodInfo getMethodInfo(ELContext context)
             throws NullPointerException, PropertyNotFoundException, 
MethodNotFoundException, ELException {
-        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            MethodInfo result = this.target.getMethodInfo(context);
-            context.notifyAfterEvaluation(getExpressionString());
-            return result;
+            return this.target.getMethodInfo(context);
         } catch (MethodNotFoundException e) {
             if (e instanceof JspMethodNotFoundException) {
                 throw e;
@@ -88,11 +85,8 @@ public final class JspMethodExpression extends 
MethodExpression implements Exter
     @Override
     public Object invoke(ELContext context, Object[] params)
             throws NullPointerException, PropertyNotFoundException, 
MethodNotFoundException, ELException {
-        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            Object result = this.target.invoke(context, params);
-            context.notifyAfterEvaluation(getExpressionString());
-            return result;
+            return this.target.invoke(context, params);
         } catch (MethodNotFoundException e) {
             if (e instanceof JspMethodNotFoundException) {
                 throw e;
diff --git a/java/org/apache/jasper/el/JspValueExpression.java 
b/java/org/apache/jasper/el/JspValueExpression.java
index 7bb9634e31..4a0f91a644 100644
--- a/java/org/apache/jasper/el/JspValueExpression.java
+++ b/java/org/apache/jasper/el/JspValueExpression.java
@@ -64,11 +64,8 @@ public final class JspValueExpression extends 
ValueExpression implements Externa
 
     @Override
     public Class<?> getType(ELContext context) throws NullPointerException, 
PropertyNotFoundException, ELException {
-        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            Class<?> result = this.target.getType(context);
-            context.notifyAfterEvaluation(getExpressionString());
-            return result;
+            return this.target.getType(context);
         } catch (PropertyNotFoundException e) {
             if (e instanceof JspPropertyNotFoundException) {
                 throw e;
@@ -84,11 +81,8 @@ public final class JspValueExpression extends 
ValueExpression implements Externa
 
     @Override
     public boolean isReadOnly(ELContext context) throws NullPointerException, 
PropertyNotFoundException, ELException {
-        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            boolean result = this.target.isReadOnly(context);
-            context.notifyAfterEvaluation(getExpressionString());
-            return result;
+            return this.target.isReadOnly(context);
         } catch (PropertyNotFoundException e) {
             if (e instanceof JspPropertyNotFoundException) {
                 throw e;
@@ -105,10 +99,8 @@ public final class JspValueExpression extends 
ValueExpression implements Externa
     @Override
     public void setValue(ELContext context, Object value)
             throws NullPointerException, PropertyNotFoundException, 
PropertyNotWritableException, ELException {
-        context.notifyBeforeEvaluation(getExpressionString());
         try {
             this.target.setValue(context, value);
-            context.notifyAfterEvaluation(getExpressionString());
         } catch (PropertyNotWritableException e) {
             if (e instanceof JspPropertyNotWritableException) {
                 throw e;
@@ -129,11 +121,8 @@ public final class JspValueExpression extends 
ValueExpression implements Externa
 
     @Override
     public Object getValue(ELContext context) throws NullPointerException, 
PropertyNotFoundException, ELException {
-        context.notifyBeforeEvaluation(getExpressionString());
         try {
-            Object result = this.target.getValue(context);
-            context.notifyAfterEvaluation(getExpressionString());
-            return result;
+            return this.target.getValue(context);
         } catch (PropertyNotFoundException e) {
             if (e instanceof JspPropertyNotFoundException) {
                 throw e;
diff --git a/test/javax/el/TestEvaluationListener.java 
b/test/javax/el/TestEvaluationListener.java
index fe00e6fc02..120dabd8fd 100644
--- a/test/javax/el/TestEvaluationListener.java
+++ b/test/javax/el/TestEvaluationListener.java
@@ -16,6 +16,7 @@
  */
 package javax.el;
 
+import java.util.Arrays;
 import java.util.List;
 
 import javax.el.TesterEvaluationListener.Pair;
@@ -129,4 +130,185 @@ public class TestEvaluationListener {
         List<String> after = listener.getAfterEvaluationExpressions();
         Assert.assertEquals(0, after.size());
     }
+
+
+    /*
+     * Instances of ValueExpression created via 
ExpressionFactory.createValueExpression(Object, Class) do not notify
+     * the listener. Using one as a variable in another expression results in 
a single notification for the expression
+     * that was evaluated.
+     */
+    @Test
+    public void testInstanceVariableGetValue() {
+        VariableFixture f = new VariableFixture();
+
+        ValueExpression ve = f.factory.createValueExpression(f.context, 
"${bean.name}", String.class);
+        Assert.assertEquals(0, 
f.listener.getBeforeEvaluationExpressions().size());
+
+        Assert.assertEquals("test", ve.getValue(f.context));
+
+        f.assertEvaluatedOnce("${bean.name}");
+    }
+
+
+    @Test
+    public void testInstanceVariableSetValue() {
+        VariableFixture f = new VariableFixture();
+
+        ValueExpression ve = f.factory.createValueExpression(f.context, 
"${bean.name}", String.class);
+        ve.setValue(f.context, "updated");
+
+        Assert.assertEquals("updated", f.bean.getName());
+        f.assertEvaluatedOnce("${bean.name}");
+    }
+
+
+    @Test
+    public void testInstanceVariableInvoke() {
+        VariableFixture f = new VariableFixture();
+
+        MethodExpression me = f.factory.createMethodExpression(f.context, 
"${bean.setName}", null,
+                new Class<?>[] { String.class });
+        me.invoke(f.context, new Object[] { "invoked" });
+
+        Assert.assertEquals("invoked", f.bean.getName());
+        f.assertEvaluatedOnce("${bean.setName}");
+    }
+
+
+    @Test
+    public void testInstanceValueExpressionDoesNotNotify() {
+        VariableFixture f = new VariableFixture();
+        ValueExpression ve = f.factory.createValueExpression(f.bean, 
TesterBean.class);
+
+        Assert.assertSame(f.bean, ve.getValue(f.context));
+        Assert.assertEquals(TesterBean.class, ve.getExpectedType());
+        Assert.assertTrue(ve.isReadOnly(f.context));
+        ve.getType(f.context);
+        ve.getValueReference(f.context);
+        ve.getExpressionString();
+        ve.isLiteralText();
+        ve.toString();
+        try {
+            ve.setValue(f.context, f.bean);
+            Assert.fail("Expected PropertyNotWritableException");
+        } catch (PropertyNotWritableException e) {
+            // Expected
+        }
+
+        Assert.assertEquals(0, 
f.listener.getBeforeEvaluationExpressions().size());
+        Assert.assertEquals(0, 
f.listener.getAfterEvaluationExpressions().size());
+    }
+
+
+    /*
+     * A variable that is a ValueExpression created from a String is a normal 
expression so it notifies the listener
+     * in addition to the expression that references it.
+     */
+    @Test
+    public void testStringVariableNotifiesTwice() {
+        ExpressionFactory factory = ELManager.getExpressionFactory();
+        ELContext context = new ELManager().getELContext();
+        TesterEvaluationListener listener = new TesterEvaluationListener();
+        context.addEvaluationListener(listener);
+
+        context.getVariableMapper().setVariable("answer",
+                factory.createValueExpression(context, "${1 + 2}", 
Long.class));
+        ValueExpression ve = factory.createValueExpression(context, "${answer 
* 2}", Long.class);
+
+        Assert.assertEquals(Long.valueOf(6), ve.getValue(context));
+
+        Assert.assertEquals(Arrays.asList("${answer * 2}", "${1 + 2}"), 
listener.getBeforeEvaluationExpressions());
+        Assert.assertEquals(Arrays.asList("${1 + 2}", "${answer * 2}"), 
listener.getAfterEvaluationExpressions());
+    }
+
+
+    /*
+     * Methods other than ValueExpression.getValue(), 
ValueExpression.setValue() and MethodExpression.invoke() do not
+     * notify the listener.
+     */
+    @Test
+    public void testValueExpressionOtherMethodsDoNotNotify() {
+        VariableFixture f = new VariableFixture();
+        ValueExpression ve = f.factory.createValueExpression(f.context, 
"${bean.name}", String.class);
+
+        Assert.assertEquals(String.class, ve.getExpectedType());
+        Assert.assertEquals("${bean.name}", ve.getExpressionString());
+        Assert.assertFalse(ve.isLiteralText());
+        Assert.assertFalse(ve.isReadOnly(f.context));
+        Assert.assertEquals(String.class, ve.getType(f.context));
+        Assert.assertNotNull(ve.getValueReference(f.context));
+        ve.equals(ve);
+        ve.hashCode();
+        ve.toString();
+
+        Assert.assertEquals(0, 
f.listener.getBeforeEvaluationExpressions().size());
+        Assert.assertEquals(0, 
f.listener.getAfterEvaluationExpressions().size());
+    }
+
+
+    @Test
+    public void testMethodExpressionOtherMethodsDoNotNotify() {
+        VariableFixture f = new VariableFixture();
+        MethodExpression me = f.factory.createMethodExpression(f.context, 
"${bean.setName}", null,
+                new Class<?>[] { String.class });
+        MethodExpression meWithParameters = 
f.factory.createMethodExpression(f.context, "${bean.getName()}",
+                String.class, new Class<?>[0]);
+
+        Assert.assertEquals("${bean.setName}", me.getExpressionString());
+        Assert.assertFalse(me.isLiteralText());
+        Assert.assertFalse(me.isParametersProvided());
+        Assert.assertNotNull(me.getMethodInfo(f.context));
+        Assert.assertTrue(meWithParameters.isParametersProvided());
+        Assert.assertNotNull(meWithParameters.getMethodInfo(f.context));
+        me.hashCode();
+        me.toString();
+
+        Assert.assertEquals(0, 
f.listener.getBeforeEvaluationExpressions().size());
+        Assert.assertEquals(0, 
f.listener.getAfterEvaluationExpressions().size());
+    }
+
+
+    @Test
+    public void testLiteralMethodExpression() {
+        ExpressionFactory factory = ELManager.getExpressionFactory();
+        ELContext context = new ELManager().getELContext();
+        TesterEvaluationListener listener = new TesterEvaluationListener();
+        context.addEvaluationListener(listener);
+
+        String expression = "plain text";
+        MethodExpression me = factory.createMethodExpression(context, 
expression, String.class, new Class<?>[0]);
+
+        Assert.assertTrue(me.isLiteralText());
+        Assert.assertNotNull(me.getMethodInfo(context));
+        me.toString();
+        Assert.assertEquals(0, 
listener.getBeforeEvaluationExpressions().size());
+        Assert.assertEquals(0, 
listener.getAfterEvaluationExpressions().size());
+
+        Assert.assertEquals(expression, me.invoke(context, null));
+
+        Assert.assertEquals(Arrays.asList(expression), 
listener.getBeforeEvaluationExpressions());
+        Assert.assertEquals(Arrays.asList(expression), 
listener.getAfterEvaluationExpressions());
+    }
+
+
+    /*
+     * Registers a TesterBean as the variable "bean" using 
ExpressionFactory.createValueExpression(Object, Class) and
+     * adds a listener.
+     */
+    private static class VariableFixture {
+        final ExpressionFactory factory = ELManager.getExpressionFactory();
+        final ELContext context = new ELManager().getELContext();
+        final TesterBean bean = new TesterBean("test");
+        final TesterEvaluationListener listener = new 
TesterEvaluationListener();
+
+        VariableFixture() {
+            context.getVariableMapper().setVariable("bean", 
factory.createValueExpression(bean, TesterBean.class));
+            context.addEvaluationListener(listener);
+        }
+
+        void assertEvaluatedOnce(String expression) {
+            Assert.assertEquals(Arrays.asList(expression), 
listener.getBeforeEvaluationExpressions());
+            Assert.assertEquals(Arrays.asList(expression), 
listener.getAfterEvaluationExpressions());
+        }
+    }
 }
diff --git a/test/org/apache/jasper/el/TestJspExpressionEvaluationListener.java 
b/test/org/apache/jasper/el/TestJspExpressionEvaluationListener.java
new file mode 100644
index 0000000000..d70ba2a669
--- /dev/null
+++ b/test/org/apache/jasper/el/TestJspExpressionEvaluationListener.java
@@ -0,0 +1,126 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jasper.el;
+
+import java.util.Arrays;
+
+import javax.el.ELContext;
+import javax.el.ELManager;
+import javax.el.ExpressionFactory;
+import javax.el.MethodExpression;
+import javax.el.TesterBean;
+import javax.el.TesterEvaluationListener;
+import javax.el.ValueExpression;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/*
+ * The JSP wrappers add the location of the expression to any exception. The 
wrapped expression notifies the
+ * EvaluationListener so the wrappers must not.
+ */
+public class TestJspExpressionEvaluationListener {
+
+    private final ExpressionFactory factory = ELManager.getExpressionFactory();
+    private final ELContext context = new ELManager().getELContext();
+    private final TesterBean bean = new TesterBean("test");
+    private final TesterEvaluationListener listener = new 
TesterEvaluationListener();
+
+    private void setup() {
+        context.getVariableMapper().setVariable("bean", 
factory.createValueExpression(bean, TesterBean.class));
+        context.addEvaluationListener(listener);
+    }
+
+
+    @Test
+    public void testValueExpressionGetValue() {
+        setup();
+        String expression = "${bean.name}";
+        ValueExpression ve = new JspValueExpression("mark", 
factory.createValueExpression(context, expression,
+                String.class));
+
+        Assert.assertEquals("test", ve.getValue(context));
+
+        assertEvaluatedOnce(expression);
+    }
+
+
+    @Test
+    public void testValueExpressionSetValue() {
+        setup();
+        String expression = "${bean.name}";
+        ValueExpression ve = new JspValueExpression("mark", 
factory.createValueExpression(context, expression,
+                String.class));
+
+        ve.setValue(context, "updated");
+
+        Assert.assertEquals("updated", bean.getName());
+        assertEvaluatedOnce(expression);
+    }
+
+
+    @Test
+    public void testValueExpressionOtherMethods() {
+        setup();
+        ValueExpression ve = new JspValueExpression("mark", 
factory.createValueExpression(context, "${bean.name}",
+                String.class));
+
+        Assert.assertFalse(ve.isReadOnly(context));
+        Assert.assertEquals(String.class, ve.getType(context));
+        ve.getValueReference(context);
+
+        assertNotEvaluated();
+    }
+
+
+    @Test
+    public void testMethodExpressionInvoke() {
+        setup();
+        String expression = "${bean.setName}";
+        MethodExpression me = new JspMethodExpression("mark", 
factory.createMethodExpression(context, expression,
+                null, new Class<?>[] { String.class }));
+
+        me.invoke(context, new Object[] { "invoked" });
+
+        Assert.assertEquals("invoked", bean.getName());
+        assertEvaluatedOnce(expression);
+    }
+
+
+    @Test
+    public void testMethodExpressionOtherMethods() {
+        setup();
+        MethodExpression me = new JspMethodExpression("mark", 
factory.createMethodExpression(context,
+                "${bean.getName()}", String.class, new Class<?>[0]));
+
+        Assert.assertNotNull(me.getMethodInfo(context));
+
+        assertNotEvaluated();
+    }
+
+
+    private void assertEvaluatedOnce(String expression) {
+        Assert.assertEquals(Arrays.asList(expression), 
listener.getBeforeEvaluationExpressions());
+        Assert.assertEquals(Arrays.asList(expression), 
listener.getAfterEvaluationExpressions());
+    }
+
+
+    private void assertNotEvaluated() {
+        Assert.assertEquals(0, 
listener.getBeforeEvaluationExpressions().size());
+        Assert.assertEquals(0, 
listener.getAfterEvaluationExpressions().size());
+    }
+}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 6b550e3c37..56f82fee87 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -503,6 +503,19 @@
         language specification when <code>expr-a</code> is a literal
         <code>null</code>. (markt)
       </fix>
+      <fix>
+        Ensure that the <code>EvaluationListener</code> is only notified when
+        <code>ValueExpression.getValue()</code>,
+        <code>ValueExpression.setValue()</code> or
+        <code>MethodExpression.invoke()</code> is called and that it is
+        notified once only for each evaluation. Previously, other methods such
+        as <code>ValueExpression.getType()</code> also triggered notifications,
+        expressions created with
+        <code>ExpressionFactory.createValueExpression(Object, Class)</code>
+        triggered additional notifications when used as a variable in another
+        expression and expressions evaluated in JSPs triggered duplicate
+        notifications. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Cluster">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to