You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@shale.apache.org by "Ingo Dueppe (JIRA)" <ji...@apache.org> on 2007/02/11 14:35:17 UTC

[jira] Created: (SHALE-406) ConverterHelper produce NullPointerException by calling Converter with uiComponent = null parameter during restore view phase.

ConverterHelper produce NullPointerException by calling Converter with uiComponent = null parameter during restore view phase.
------------------------------------------------------------------------------------------------------------------------------

                 Key: SHALE-406
                 URL: https://issues.apache.org/struts/browse/SHALE-406
             Project: Shale
          Issue Type: Bug
          Components: View
    Affects Versions: 1.0.4
         Environment: Facelets 1.1.12, MyFaces 1.1.5-SNAPSHOT , Tomahawk 1.1.5-SNAPSHOT
            Reporter: Ingo Dueppe


I had an backing bean class with the following property:

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

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

This method expects an uiComponent not null 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 still null. So the below code of the ConverterHelper
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);
    } 

There are also some other parts in the ConverterHelper class that depends on that viewRoot is not null.

Well the jsf - 1.1 spec says that the getAsObject method is called during the apply request values phase. 
As far as I understood it myfaces doesn't use the converter to initialize the beans also. Instead it uses the Coercions class of common-el to convert #{param.enrollmentId}.

Btw.: As workaround, define your own ConverterClass that can handle that the component parameter is null.

- Ingo


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (SHALE-406) ConverterHelper produce NullPointerException by calling Converter with uiComponent = null parameter during restore view phase.

Posted by "Gary VanMatre (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/SHALE-406?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary VanMatre resolved SHALE-406.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 1.1.0-SNAPSHOT
                   1.0.5-SNAPSHOT

When the shale-tiger Property annotation is evaluated, a nifty type converter is used to coerce the source data type to the target data type.  This utility reuses existing JSF converters outside the context of rendering.  It assumes a FacesContext and UIViewRoot.  I removed the requirement that a UIViewRoot is needed.  Since we are using converters for outside of the component tree, we just need a object that extends UIComponent.

Fixed in the 20070729 nightly build.

> ConverterHelper produce NullPointerException by calling Converter with uiComponent = null parameter during restore view phase.
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SHALE-406
>                 URL: https://issues.apache.org/struts/browse/SHALE-406
>             Project: Shale
>          Issue Type: Bug
>          Components: Core, View
>    Affects Versions: 1.0.4
>         Environment: Facelets 1.1.12, MyFaces 1.1.5-SNAPSHOT , Tomahawk 1.1.5-SNAPSHOT
>            Reporter: Ingo Dueppe
>            Assignee: Gary VanMatre
>             Fix For: 1.0.5-SNAPSHOT, 1.1.0-SNAPSHOT
>
>
> I had an backing bean class with the following property:
> @Property{value="#{param.enrollmentId}")
> private Long enrollmentId;
> And this ends up that shale calls the
> getAsObject method javax.faces.convert.LongConverter of MyFaces-1.1.5-SNAPSHOT during the restore view phase .
> This method expects an uiComponent not null 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 still null. So the below code of the ConverterHelper
> 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);
>     } 
> There are also some other parts in the ConverterHelper class that depends on that viewRoot is not null.
> Well the jsf - 1.1 spec says that the getAsObject method is called during the apply request values phase. 
> As far as I understood it myfaces doesn't use the converter to initialize the beans also. Instead it uses the Coercions class of common-el to convert #{param.enrollmentId}.
> Btw.: As workaround, define your own ConverterClass that can handle that the component parameter is null.
> - Ingo

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SHALE-406) ConverterHelper produce NullPointerException by calling Converter with uiComponent = null parameter during restore view phase.

Posted by "Ingo Dueppe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/SHALE-406?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ingo Dueppe updated SHALE-406:
------------------------------

    Component/s: Core

> ConverterHelper produce NullPointerException by calling Converter with uiComponent = null parameter during restore view phase.
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SHALE-406
>                 URL: https://issues.apache.org/struts/browse/SHALE-406
>             Project: Shale
>          Issue Type: Bug
>          Components: Core, View
>    Affects Versions: 1.0.4
>         Environment: Facelets 1.1.12, MyFaces 1.1.5-SNAPSHOT , Tomahawk 1.1.5-SNAPSHOT
>            Reporter: Ingo Dueppe
>
> I had an backing bean class with the following property:
> @Property{value="#{param.enrollmentId}")
> private Long enrollmentId;
> And this ends up that shale calls the
> getAsObject method javax.faces.convert.LongConverter of MyFaces-1.1.5-SNAPSHOT during the restore view phase .
> This method expects an uiComponent not null 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 still null. So the below code of the ConverterHelper
> 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);
>     } 
> There are also some other parts in the ConverterHelper class that depends on that viewRoot is not null.
> Well the jsf - 1.1 spec says that the getAsObject method is called during the apply request values phase. 
> As far as I understood it myfaces doesn't use the converter to initialize the beans also. Instead it uses the Coercions class of common-el to convert #{param.enrollmentId}.
> Btw.: As workaround, define your own ConverterClass that can handle that the component parameter is null.
> - Ingo

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (SHALE-406) ConverterHelper produce NullPointerException by calling Converter with uiComponent = null parameter during restore view phase.

Posted by "Gary VanMatre (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/SHALE-406?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary VanMatre reassigned SHALE-406:
-----------------------------------

    Assignee: Gary VanMatre

> ConverterHelper produce NullPointerException by calling Converter with uiComponent = null parameter during restore view phase.
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SHALE-406
>                 URL: https://issues.apache.org/struts/browse/SHALE-406
>             Project: Shale
>          Issue Type: Bug
>          Components: Core, View
>    Affects Versions: 1.0.4
>         Environment: Facelets 1.1.12, MyFaces 1.1.5-SNAPSHOT , Tomahawk 1.1.5-SNAPSHOT
>            Reporter: Ingo Dueppe
>            Assignee: Gary VanMatre
>
> I had an backing bean class with the following property:
> @Property{value="#{param.enrollmentId}")
> private Long enrollmentId;
> And this ends up that shale calls the
> getAsObject method javax.faces.convert.LongConverter of MyFaces-1.1.5-SNAPSHOT during the restore view phase .
> This method expects an uiComponent not null 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 still null. So the below code of the ConverterHelper
> 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);
>     } 
> There are also some other parts in the ConverterHelper class that depends on that viewRoot is not null.
> Well the jsf - 1.1 spec says that the getAsObject method is called during the apply request values phase. 
> As far as I understood it myfaces doesn't use the converter to initialize the beans also. Instead it uses the Coercions class of common-el to convert #{param.enrollmentId}.
> Btw.: As workaround, define your own ConverterClass that can handle that the component parameter is null.
> - Ingo

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.