This is an automated email from the ASF dual-hosted git repository.
markt-asf pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new fde9bf09a8 Fix backport
fde9bf09a8 is described below
commit fde9bf09a8edf535e6d85bf909753655b4c50897
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Nov 5 16:19:26 2026 +0000
Fix backport
---
java/org/apache/el/parser/AstIdentifier.java | 8 ++++----
test/org/apache/el/parser/TestAstIdentifier.java | 7 ++++---
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/java/org/apache/el/parser/AstIdentifier.java
b/java/org/apache/el/parser/AstIdentifier.java
index e6b3fa5db6..3267768a19 100644
--- a/java/org/apache/el/parser/AstIdentifier.java
+++ b/java/org/apache/el/parser/AstIdentifier.java
@@ -68,9 +68,9 @@ public final class AstIdentifier extends SimpleNode {
if (imported instanceof ELClass) {
// getValue() returns an ELClass for an imported class
return ELClass.class;
- } else if (imported instanceof Field field) {
+ } else if (imported instanceof Field) {
// getValue() returns the value of a statically imported field
- return field.getType();
+ return ((Field) imported).getType();
}
throw new
PropertyNotFoundException(MessageFactory.get("error.resolver.unhandled.null",
this.image));
@@ -123,9 +123,9 @@ public final class AstIdentifier extends SimpleNode {
Object imported = resolveImport(ctx);
if (imported instanceof ELClass) {
return imported;
- } else if (imported instanceof Field field) {
+ } else if (imported instanceof Field) {
try {
- return field.get(null);
+ return ((Field) imported).get(null);
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new ELException(e);
}
diff --git a/test/org/apache/el/parser/TestAstIdentifier.java
b/test/org/apache/el/parser/TestAstIdentifier.java
index e01a6518b1..939c28bedf 100644
--- a/test/org/apache/el/parser/TestAstIdentifier.java
+++ b/test/org/apache/el/parser/TestAstIdentifier.java
@@ -19,6 +19,7 @@ package org.apache.el.parser;
import java.util.HashMap;
import java.util.Map;
+import jakarta.el.CompositeELResolver;
import jakarta.el.ELClass;
import jakarta.el.ELContext;
import jakarta.el.ELException;
@@ -163,7 +164,7 @@ public class TestAstIdentifier {
@Test(expected = PropertyNotWritableException.class)
public void testImportSetValueClass() {
// ELProcessor's resolvers would create a bean with this name so use a
context without them
- ELContext context = new ELContextImpl();
+ ELContext context = new ELContextImpl(new CompositeELResolver());
ExpressionFactory factory = ExpressionFactory.newInstance();
ValueExpression ve = factory.createValueExpression(context,
"${Integer}", Object.class);
@@ -174,7 +175,7 @@ public class TestAstIdentifier {
@Test(expected = PropertyNotWritableException.class)
public void testImportSetValueStaticField() {
// ELProcessor's resolvers would create a bean with this name so use a
context without them
- ELContext context = new ELContextImpl();
+ ELContext context = new ELContextImpl(new CompositeELResolver());
ExpressionFactory factory = ExpressionFactory.newInstance();
context.getImportHandler().importStatic("java.lang.Integer.MAX_VALUE");
ValueExpression ve = factory.createValueExpression(context,
@@ -196,7 +197,7 @@ public class TestAstIdentifier {
@Test(expected = PropertyNotFoundException.class)
public void testUnresolvedSetValue() {
// ELProcessor's resolvers would create a bean with this name so use a
context without them
- ELContext context = new ELContextImpl();
+ ELContext context = new ELContextImpl(new CompositeELResolver());
ExpressionFactory factory = ExpressionFactory.newInstance();
ValueExpression ve = factory.createValueExpression(context,
"${unresolvedName}", Object.class);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]