[jboss-jira] [JBoss JIRA] (WFLY-2493) EL cannot access public methods/fields of non-public classes
RH Bugzilla Integration (JIRA)
jira-events at lists.jboss.org
Tue Nov 12 11:03:05 EST 2013
[ https://issues.jboss.org/browse/WFLY-2493?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12922860#comment-12922860 ]
RH Bugzilla Integration commented on WFLY-2493:
-----------------------------------------------
Jonáš Trantina <jtrantin at redhat.com> made a comment on [bug 1029387|https://bugzilla.redhat.com/show_bug.cgi?id=1029387]
Edited description:
When trying to access public method/field of non-public class that implements public interface via EL I get
"java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class X with modifiers "private"".
E.g. accessing Collections.unmodifiableList(..) via EL will throw the exception, because #unmodifiableList returns non-public implementation of List interface.
This is apparently caused by JDK-4071957 [1], but since that is opened for over 16 years, it should be probably worth it to implement a workaround.
Workaround for this issue is setting setAccessible(true) on the method before invoking it, thus suppress Java access checking.
I have attached a simple reproducer app as well as a stack trace of the exception.
[1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957
> EL cannot access public methods/fields of non-public classes
> ------------------------------------------------------------
>
> Key: WFLY-2493
> URL: https://issues.jboss.org/browse/WFLY-2493
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: JSF
> Environment: JBoss AS 7.2.0.Final
> Reporter: Jonáš Trantina
> Attachments: elresolver_stack, reproducer.zip
>
>
> When trying to access public method/field of non-public class that implements public interface via EL I get
> {noformat}
> java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class X with modifiers "private"
> {noformat}
> E.g. accessing Collections.unmodifiableList(..) via EL will throw the exception, because #unmodifiableList returns non-public implementation of List interface.
> This is apparently caused by JDK-4071957 [1], but since that is opened for over 16 years, it should be probably worth it to implement a workaround.
> Workaround for this issue is setting setAccessible(true) on the method before invoking it, thus suppress Java access checking.
> I have attached a simple reproducer app as well as a stack trace of the exception.
> [1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list