[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-3077) org.jboss.seam.handledException results in error "The class 'org.jboss.seam.Namespace' does not have the property 'handledException'" when this variable is not present

Dan Allen (JIRA) jira-events at lists.jboss.org
Tue Mar 31 15:52:22 EDT 2009


    [ https://jira.jboss.org/jira/browse/JBSEAM-3077?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12459903#action_12459903 ] 

Dan Allen commented on JBSEAM-3077:
-----------------------------------

There is actually an easy fix for this. When Seam scans for components, it registers all namespaces that it finds referenced in component names. So for instance, if it finds a component named org.jboss.seam.handledException, it registers the namespace org.jboss.seam (as the type org.jboss.seam.Namespace). Seam knows that there is at least one component whose name falls in that namespace.

When it goes to resolve the property name org.jboss.seam.handledException, it first resolves the base object as Namespace(org.jboss.seam). Then it looks in that Namespace to find an existing component instance (the property resolver step). If the component instance has not been created, or is null, the SeamELResolver incorrectly reports that it could not resolve the property. However, it in fact did resolve the value and determined it to be null. So when the base object is a namespace and Seam is resolving the property, it should always consider the property resolved.

To summarize, what I am saying is that if handledException is not found in the org.jboss.seam namespace, it means that there is no component instance bound to that name and the EL resolver should simply report a resolved property whose value is null.

private Object resolveInNamespace(ELContext context, Namespace namespace, Object property) {
    Object result = namespace.get((String) property);
    //if (result != null) {
        context.setPropertyResolved(true);
    //}
    return result;
}

> org.jboss.seam.handledException results in error "The class 'org.jboss.seam.Namespace' does not have the property 'handledException'" when this variable is not present
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: JBSEAM-3077
>                 URL: https://jira.jboss.org/jira/browse/JBSEAM-3077
>             Project: Seam
>          Issue Type: Bug
>            Reporter: Alex Savitsky
>
> This variable (org.jboss.seam.handledException) is normally defined by Seam when an unhandled exception is thrown, and is subsequently displayed on an error page. However, when user refreshes the error page, they would get an error "The class 'org.jboss.seam.Namespace' does not have the property 'handledException'", due to the way Seam evaluates expressions - "org.jboss.seam" evaluates to an instance of Namespace, and "org.jboss.seam.handledException" is interpreted as "property 'handledException' of an object 'org.jboss.seam'".
> What's worse, there's no way to prevent this error from appearing, as the usual way of checking for variable existence - "empty org.jboss.seam.handledException" wouldn't work here, as it never evaluates to null - it's either there, or throws an error if it's not.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list