This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new ec7a606 Ensure correct exception with StaticFieldELResolver and Java 9+ ec7a606 is described below commit ec7a6063fcafd76d85a30cd16f085f5b096ed5c7 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Oct 3 23:55:16 2019 +0100 Ensure correct exception with StaticFieldELResolver and Java 9+ --- java/javax/el/LocalStrings.properties | 2 +- java/javax/el/StaticFieldELResolver.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/java/javax/el/LocalStrings.properties b/java/javax/el/LocalStrings.properties index 4bca364..76e4fb8 100644 --- a/java/javax/el/LocalStrings.properties +++ b/java/javax/el/LocalStrings.properties @@ -45,7 +45,7 @@ propertyReadError=Error reading [{1}] on type [{0}] propertyWriteError=Error writing [{1}] on type [{0}] staticFieldELResolver.methodNotFound=No matching public static method named [{0}] found on class [{1}] -staticFieldELResolver.notFound=No public static field named [{0}] was found on class [{1}] +staticFieldELResolver.notFound=No public static field named [{0}] was found on (exported for Java 9+) class [{1}] staticFieldELResolver.notWriteable=Writing to static fields (in this case field [{0}] on class [{1}]) is not permitted util.method.ambiguous=Unable to find unambiguous method: {0}.{1}({2}) diff --git a/java/javax/el/StaticFieldELResolver.java b/java/javax/el/StaticFieldELResolver.java index 3ed6edd..29d6218 100644 --- a/java/javax/el/StaticFieldELResolver.java +++ b/java/javax/el/StaticFieldELResolver.java @@ -43,8 +43,10 @@ public class StaticFieldELResolver extends ELResolver { try { Field field = clazz.getField(name); int modifiers = field.getModifiers(); + JreCompat jreCompat = JreCompat.getInstance(); if (Modifier.isStatic(modifiers) && - Modifier.isPublic(modifiers)) { + Modifier.isPublic(modifiers) && + jreCompat.canAcccess(null, field)) { return field.get(null); } } catch (IllegalArgumentException | IllegalAccessException | @@ -154,8 +156,10 @@ public class StaticFieldELResolver extends ELResolver { try { Field field = clazz.getField(name); int modifiers = field.getModifiers(); + JreCompat jreCompat = JreCompat.getInstance(); if (Modifier.isStatic(modifiers) && - Modifier.isPublic(modifiers)) { + Modifier.isPublic(modifiers) && + jreCompat.canAcccess(null, field)) { return field.getType(); } } catch (IllegalArgumentException | NoSuchFieldException | --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org