You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Folke Behrens (JIRA)" <ji...@apache.org> on 2009/02/04 16:45:59 UTC

[jira] Created: (TAP5-497) When traversing a property path a null should be handled more gracefully

When traversing a property path a null should be handled more gracefully
------------------------------------------------------------------------

                 Key: TAP5-497
                 URL: https://issues.apache.org/jira/browse/TAP5-497
             Project: Tapestry 5
          Issue Type: Improvement
          Components: tapestry-core
    Affects Versions: 5.0.18
            Reporter: Folke Behrens


It would be nice if no NullPointerException is thrown if a parent property is null.

E.g. When the value of "user.status.flag" is resolved and the "user" property or the "status" sub-property is null then an NPE is thrown. Here it would be nice if there's a way to say that it's ok to just return null and not the value of "flag". I think OGNL solves this by allowing a question mark instead of period in the property path: "user?status?flag", ugly but very convenient.

This is especially useful with embedded entities (JPA) and Hibernate. Hibernate sets embedded entities to null if all their properties are null in the database.

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


[jira] Closed: (TAP5-497) When traversing a property path a null should be handled more gracefully

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAP5-497.
-------------------------------------

    Resolution: Invalid
      Assignee: Howard M. Lewis Ship

Use the ?. operator:

user?.status?.flag

> When traversing a property path a null should be handled more gracefully
> ------------------------------------------------------------------------
>
>                 Key: TAP5-497
>                 URL: https://issues.apache.org/jira/browse/TAP5-497
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.0.18
>            Reporter: Folke Behrens
>            Assignee: Howard M. Lewis Ship
>
> It would be nice if no NullPointerException is thrown if a parent property is null.
> E.g. When the value of "user.status.flag" is resolved and the "user" property or the "status" sub-property is null then an NPE is thrown. Here it would be nice if there's a way to say that it's ok to just return null and not the value of "flag". I think OGNL solves this by allowing a question mark instead of period in the property path: "user?status?flag", ugly but very convenient.
> This is especially useful with embedded entities (JPA) and Hibernate. Hibernate sets embedded entities to null if all their properties are null in the database.

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


[jira] Closed: (TAP5-497) When traversing a property path a null should be handled more gracefully

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-497?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAP5-497.
-------------------------------------

    Resolution: Invalid
      Assignee: Howard M. Lewis Ship

Use the ?. operator:

user?.status?.flag

> When traversing a property path a null should be handled more gracefully
> ------------------------------------------------------------------------
>
>                 Key: TAP5-497
>                 URL: https://issues.apache.org/jira/browse/TAP5-497
>             Project: Tapestry 5
>          Issue Type: Improvement
>          Components: tapestry-core
>    Affects Versions: 5.0.18
>            Reporter: Folke Behrens
>            Assignee: Howard M. Lewis Ship
>
> It would be nice if no NullPointerException is thrown if a parent property is null.
> E.g. When the value of "user.status.flag" is resolved and the "user" property or the "status" sub-property is null then an NPE is thrown. Here it would be nice if there's a way to say that it's ok to just return null and not the value of "flag". I think OGNL solves this by allowing a question mark instead of period in the property path: "user?status?flag", ugly but very convenient.
> This is especially useful with embedded entities (JPA) and Hibernate. Hibernate sets embedded entities to null if all their properties are null in the database.

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