cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrus Adamchik (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CAY-1997) Difference in NULL handling inside the path between PropertyUtils and DataObject.readNestedProperty
Date Thu, 02 Apr 2015 13:29:56 GMT
Andrus Adamchik created CAY-1997:
------------------------------------

             Summary: Difference in NULL handling inside the path between PropertyUtils and
DataObject.readNestedProperty
                 Key: CAY-1997
                 URL: https://issues.apache.org/jira/browse/CAY-1997
             Project: Cayenne
          Issue Type: Bug
    Affects Versions: 4.0.M2
            Reporter: Andrus Adamchik
            Assignee: Andrus Adamchik


There is an inconsistency in handling of NULLs during property path resolving between Cayenne
PropertyUtils.getProperty(..) (used for POJOS) and CayenneDataObject.readNestedProperty(..).

PropertyUtils will throw an exception when encountering NULL value in the middle of the path.
CayenneDataObject simply returns NULL. 

I think both strategies have their place (and ideally should be either configurable or use
new Java 8 "Optional" return - http://www.oracle.com/technetwork/articles/java/java8-optional-2175753.html
). However as a practical matter if we want Expressions to evaluate seamlessly between DataObjects
and POJOs (something that I am doing all the time), at least the two evaluators should be
consistent. 

My vote is to use  CayenneDataObject.readNestedProperty strategy (return null), as this is
the older and more common scenario, and everyone is used to it. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message