You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by Ingo Düppe <ma...@dueppe.com> on 2007/02/09 17:53:01 UTC

Issue with @Property and request parameter converter

Hi,

I ran in the following issue:

I have an EnrollmentPage class with a the property

@Property{value="#{param.enrollmentId}")
private Long enrollmentId;

And this ends up that shale calls during the restore view phase the 
javax.faces.convert.LongConverter of MyFaces-1.1.5-SNAPSHOT.

During the restore phase variable the the  
javax.faces.convert.LongConverter getAsObject method is called. This 
method expects an uiComponent otherwise it throws a 
NullPointerException. But this method is called by the 
org.apache.shale.util.ConverterHelper during create view and therefore 
the facesContext setViewRoot is not called and null. So the below code 
end ups in a NullPointerException in this situation.

    public Object asObject(FacesContext context, Class type, String value) {
        if (String.class == type) {
            return value;
        }
        return converter(context, type).getAsObject(context, 
context.getViewRoot(), value);
    }

Is this an issue?

Regards
Ingo





Re: Issue with @Property and request parameter converter

Posted by Ingo Düppe <ma...@dueppe.com>.
Done:
https://issues.apache.org/struts/browse/SHALE-406
Regards
 Ingo

Craig McClanahan schrieb:
> On 2/9/07, Ingo Düppe <ma...@dueppe.com> wrote:
>
> Yes, that does sound like a legitimate issue ... could you add a 
> ticket to
> our JIRA[1] for it? The interesting part of the problem is it might 
> actually
> be a JSF implementation thing ... we'll need to explore whether the same
> behavior happens when you use a <managed-property> entry in web.xml to
> configure the property setter, and also whether it happens with the RI as
> well.
>
> Regards
> Craig
>
> [1] https://issues.apache.org/struts/browse/SHALE
>


Re: Issue with @Property and request parameter converter

Posted by Craig McClanahan <cr...@apache.org>.
On 2/9/07, Ingo Düppe <ma...@dueppe.com> wrote:
>
> Hi,
>
> I ran in the following issue:
>
> I have an EnrollmentPage class with a the property
>
> @Property{value="#{param.enrollmentId}")
> private Long enrollmentId;
>
> And this ends up that shale calls during the restore view phase the
> javax.faces.convert.LongConverter of MyFaces-1.1.5-SNAPSHOT.
>
> During the restore phase variable the the
> javax.faces.convert.LongConverter getAsObject method is called. This
> method expects an uiComponent otherwise it throws a
> NullPointerException. But this method is called by the
> org.apache.shale.util.ConverterHelper during create view and therefore
> the facesContext setViewRoot is not called and null. So the below code
> end ups in a NullPointerException in this situation.
>
>     public Object asObject(FacesContext context, Class type, String value)
> {
>         if (String.class == type) {
>             return value;
>         }
>         return converter(context, type).getAsObject(context,
> context.getViewRoot(), value);
>     }
>
> Is this an issue?


Yes, that does sound like a legitimate issue ... could you add a ticket to
our JIRA[1] for it? The interesting part of the problem is it might actually
be a JSF implementation thing ... we'll need to explore whether the same
behavior happens when you use a <managed-property> entry in web.xml to
configure the property setter, and also whether it happens with the RI as
well.

Regards
> Ingo
>
>
>
>
>
Craig

[1] https://issues.apache.org/struts/browse/SHALE