Bug 1029387 - WFLY-2493 EL cannot access public methods/fields of non-public classes
WFLY-2493 EL cannot access public methods/fields of non-public classes
Status: CLOSED CURRENTRELEASE
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: JSF (Show other bugs)
6.1.0
Unspecified Unspecified
unspecified Severity unspecified
: DR5
: EAP 6.3.0
Assigned To: Farah Juma
Matous Jobanek
Russell Dickenson
:
Depends On:
Blocks: 1076061 1076320
  Show dependency treegraph
 
Reported: 2013-11-12 05:26 EST by Jonáš Trantina
Modified: 2014-07-29 10:39 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
In previous versions of JBoss EAP 6 the BeanELResolver did not try to override Method.invoke access control to access public methods or fields of non-public classes. This caused issues when trying to access the public method or field of a non-public class via Expression Language (EL) the following error message resulted: ---- "java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class X with modifiers "private" ---- This issue has been resolved by calling setAccessible(true) as appropriate in the EL implementation. Public methods or fields of non-public class are now accessile via EL
Story Points: ---
Clone Of:
: 1076320 (view as bug list)
Environment:
Last Closed: 2014-07-29 10:39:40 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker JBEE-146 Major Resolved jboss-el-api_2.2_spec 1.0.2.Final cannot access public methods from non-public classes 2015-10-19 02:45 EDT
JBoss Issue Tracker WFLY-2493 Major Resolved EL cannot access public methods/fields of non-public classes 2015-10-19 02:45 EDT

  None (edit)
Description Jonáš Trantina 2013-11-12 05:26:32 EST
Description of problem:
When trying to access public method/field of non-public class via EL I get
"java.lang.IllegalAccessException: Class javax.el.BeanELResolver can not access a member of class X with modifiers "private"".
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. These attachments can be found in the JIRA [2]. 

[1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4071957
[2] https://issues.jboss.org/browse/WFLY-2493

Version-Release number of selected component (if applicable):
jboss-el-api_2.2_spec-1.0.2.Final
Comment 1 JBoss JIRA Server 2013-11-12 10:55:54 EST
Jonáš Trantina <jtrantin@redhat.com> made a comment on jira WFLY-2493

Corrected description and added new reproducer, as the previous one was not correct.
Comment 2 Jonáš Trantina 2013-11-12 11:01:14 EST
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
Comment 3 JBoss JIRA Server 2013-11-14 16:23:30 EST
Farah Juma <fjuma@redhat.com> made a comment on jira JBEE-146

I've created the following PR:
https://github.com/jboss/jboss-el-api_spec/pull/3
Comment 6 JBoss JIRA Server 2013-11-20 19:11:16 EST
Shelly McGowan <smcgowan@redhat.com> made a comment on jira JBEE-146

Java EE 6 signature tests passed with jboss-el-api_2.2_spec-1.0.3.Final-SNAPSHOT.  Will do a release.
Comment 7 JBoss JIRA Server 2013-11-20 19:37:12 EST
Shelly McGowan <smcgowan@redhat.com> made a comment on jira JBEE-146

JBoss EL 2.2 Spec API, v1.0.3.Final has been released:
https://repository.jboss.org/nexus/content/groups/public/org/jboss/spec/javax/el/jboss-el-api_2.2_spec/1.0.3.Final/
Comment 8 JBoss JIRA Server 2013-11-20 19:38:47 EST
Shelly McGowan <smcgowan@redhat.com> made a comment on jira JBEE-146

Commit also merged to jboss-el-api_spec master:
https://github.com/jboss/jboss-el-api_spec/commit/a3955731753487a2fbce5024a66c23bb2b28b63e
Comment 9 JBoss JIRA Server 2013-11-21 09:39:50 EST
Farah Juma <fjuma@redhat.com> updated the status of jira JBEE-146 to Resolved
Comment 12 Kabir Khan 2014-04-04 14:54:42 EDT
Fixed by upgrade for DR5
Comment 13 JBoss JIRA Server 2014-04-16 18:44:39 EDT
Tomaz Cerar <tomaz.cerar@gmail.com> updated the status of jira WFLY-2493 to Resolved
Comment 14 Matous Jobanek 2014-04-17 07:22:51 EDT
Verified in 6.3.0.DR5

Note You need to log in before you can comment on or make changes to this bug.