commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Trieu, Danny" <dtr...@tickets.com>
Subject RE: common EL bug?
Date Wed, 12 Oct 2005 16:21:32 GMT
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: news [mailto:news@sea.gmane.org] On Behalf Of digby
Sent: Tuesday, October 11, 2005 11:59 PM
To: commons-user@jakarta.apache.org
Subject: Re: common EL bug?

Could you paste your code in case this isn't a bug?


Trieu, Danny wrote:
> 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
> 
>  
> 
>  
> 
>  
> 
> "The essence of knowledge is, having it, to apply it; not having it, to
> confess your ignorance." -Confucius
> 
>  
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message