[tomcat] branch master updated: Minor EL bugs when running under Graal/SubstrateVM

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[tomcat] branch master updated: Minor EL bugs when running under Graal/SubstrateVM

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

fhanik pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/master by this push:
     new f03f60e  Minor EL bugs when running under Graal/SubstrateVM
f03f60e is described below

commit f03f60e04a97f283825da9000a913107922d24fb
Author: Filip Hanik <[hidden email]>
AuthorDate: Thu Jul 23 12:17:33 2020 -0700

    Minor EL bugs when running under Graal/SubstrateVM
---
 java/org/apache/jasper/el/JasperELResolver.java     | 4 ++++
 test/org/apache/jasper/el/TestJasperELResolver.java | 8 +++++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/java/org/apache/jasper/el/JasperELResolver.java b/java/org/apache/jasper/el/JasperELResolver.java
index d28c61c..71ed2ff 100644
--- a/java/org/apache/jasper/el/JasperELResolver.java
+++ b/java/org/apache/jasper/el/JasperELResolver.java
@@ -199,6 +199,7 @@ public class JasperELResolver extends CompositeELResolver {
             if (method != null) {
                 context.setPropertyResolved(base, property);
                 try {
+                    method.setAccessible(true);
                     value = method.invoke(base, (Object[]) null);
                 } catch (Exception ex) {
                     Throwable thr = ExceptionUtils.unwrapInvocationTargetException(ex);
@@ -211,6 +212,9 @@ public class JasperELResolver extends CompositeELResolver {
         @Override
         public void setValue(ELContext context, Object base, Object property,
                 Object value) {
+            if (base == null) {
+                return;
+            }
             Method method = getWriteMethod(base.getClass(), property.toString());
             if (method != null) {
                 context.setPropertyResolved(base, property);
diff --git a/test/org/apache/jasper/el/TestJasperELResolver.java b/test/org/apache/jasper/el/TestJasperELResolver.java
index 59c31d6..d58391e 100644
--- a/test/org/apache/jasper/el/TestJasperELResolver.java
+++ b/test/org/apache/jasper/el/TestJasperELResolver.java
@@ -28,6 +28,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 import org.apache.el.stream.StreamELResolverImpl;
+import org.apache.jasper.runtime.JspRuntimeLibrary;
 
 public class TestJasperELResolver {
 
@@ -53,15 +54,16 @@ public class TestJasperELResolver {
             list.add(new ImplicitObjectELResolver());
         }
 
+        int adjustedForGraalCount = JspRuntimeLibrary.GRAAL ? count + 1 : count;
+
         JasperELResolver resolver =
                 new JasperELResolver(list, new StreamELResolverImpl());
 
-
         Assert.assertEquals(Integer.valueOf(count),
                 getField("appResolversSize", resolver));
-        Assert.assertEquals(9 + count,
+        Assert.assertEquals(9 + adjustedForGraalCount,
                 ((ELResolver[])getField("resolvers", resolver)).length);
-        Assert.assertEquals(Integer.valueOf(9 + count),
+        Assert.assertEquals(Integer.valueOf(9 + adjustedForGraalCount),
                 Integer.valueOf(((AtomicInteger) getField("resolversSize", resolver)).get()));
     }
 


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