Danny,

Sorry.  I thought you were trying to access a public property of a package
private class from a reference to an instance of that package private class.
This does appear to be a bug.  What's quite troubling, though, is that there
are absolutely NO test cases in SVN for commons-el!  Am I missing something?
Is there no way to test this stuff outside of a Servlet/JSP container?

James 


-----Original Message-----
From: Trieu, Danny [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 12, 2005 12:14 PM
To: Jakarta Commons Developers List
Cc: [EMAIL PROTECTED]; Destiny Developers
Subject: RE: Posible bug with commons EL.....

James,

Thanks for your response. But I don't think I did make the case clear
enough. So, let me give it another try.

My beans are in package com.xxx.domain

com.xxx.domain

abstract class Foo { // Notice: this class has the default package access
//modifier.
        private String firstName ;
        private String lastName ;
...... Public Getters/Setters ....
}

Now child class in the same package com.xxx.domain

com.xxx.domain

public class Bar extends Foo { // Notice: this class has "public" access
modifier
        private String abc ;
...... Public Getter/Setter ....
}

Out side of com.xxx.domain package, I have no problem creating Bar and at
The same time accessing Foo's, Bar's parent, properties.

For Example:

Public class BarActionForm extends ActionForm {
        Private Bar bar ;
...... Public Getter/Setter .....
}

public class BarAction extends Action {
        public ActionForward execute( ...., ActionForm form, .... ) {
                Final BarActionForm barForm = (BarActionForm) form ;
                
                barForm.getBar().setFirstName( "myFirstName" ) ; // no
problem 
                // accessing Bar's parent properties.
                
                return mapping.findForward("success") ;
        }
}

You see, I have no problem access Foo's properties from a Bar instance
inside my BarActionForm instance.

However, the problem is inside my JSP, where I have the BarActionForm binded
To an action mapping of my html's form tag. Accessing Foo's properties with
EL will result with IllegalAccessException. You see, this is clearly a bug
in commons-el.

For example in my JSP:

......
<html:form action="/myActionMappingPath" > <!-- this mapping has "myForm",
BarActionForm, bind to it -->
....
  <html:text property="bar.firstName" /> <!-- this is where I had the
IllegalAccessException -->
....
</html:form>

I hope this would make it clear that this is a bug. I've search the commons
archive and nothing that I found related to this issue. 

Thanks for any help,

--danny

-----Original Message-----
From: James Carman [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 11, 2005 3:13 PM
To: 'Jakarta Commons Developers List'
Subject: RE: Posible bug with commons EL.....

Check the Java Language Specification:

http://java.sun.com/docs/books/jls/third_edition/html/names.html#6.6.1


-----Original Message-----
From: Trieu, Danny [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, October 11, 2005 4:52 PM
To: commons-dev@jakarta.apache.org
Subject: Posible bug with commons EL.....

Hi,

 

I am accessing a nested bean property via EL and getting a
java.lang.IllegalAccessException:

 

java.lang.IllegalAccessException: Class org.apache.commons.el.ArraySuffix
can not access a member of class com.xxx.patron.domain.BasePerson with
modifiers "public"

        at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)

        at java.lang.reflect.Method.invoke(Method.java:578)

        at org.apache.commons.el.ArraySuffix.evaluate(ArraySuffix.java:314)

        at
org.apache.commons.el.ComplexValue.evaluate(ComplexValue.java:145)

        at
org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorIm
pl.java:263)

        at
org.apache.commons.el.ExpressionEvaluatorImpl.evaluate(ExpressionEvaluatorIm
pl.java:190)

        at
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImp
l.java:922)

        at
org.apache.jsp.html.portlet.patron.PatronDetails_jsp._jspx_meth_html_form_0(
org.apache.jsp.html.portlet.patron.PatronDetails_jsp:156)

        at
org.apache.jsp.html.portlet.patron.PatronDetails_jsp._jspService(org.apache.
jsp.html.portlet.patron.PatronDetails_jsp:102)

 

my bean has the default package access modifier, but its properties are
declared "public". I think this is bug with the commons.el package. 

Can someone verify if this is true? If it is a bug. Can someone tell when is
the next release that will have a fix for this bug?

 

Thanks for any help,

 

--danny

 

"The essence of knowledge is, having it, to apply it; not having it, to
confess your ignorance." -Confucius

 




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to