[hibernate-issues] [Hibernate-JIRA] Commented: (HSEARCH-92) NPE for null fields on projection

Henning Treu (JIRA) noreply at atlassian.com
Mon Jul 2 02:46:52 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-92?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27368 ] 

Henning Treu commented on HSEARCH-92:
-------------------------------------

Attached test case.

Proposed solution: modify the TwoWayXXX2FieldBridgeAdaptors by adding a singele line to the get() method:

public Object get(String name, Document document) {
    Field field = document.getField( name );
    if(field==null){
        return null;
    }
    return stringBridge.stringToObject( field.stringValue() );
}

That fixed the bug for me.

> NPE for null fields on projection
> ---------------------------------
>
>                 Key: HSEARCH-92
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-92
>             Project: Hibernate Search
>          Issue Type: Bug
>          Components: engine
>    Affects Versions: 3.0.0.beta3
>            Reporter: Henning Treu
>         Attachments: ProjectionQueryTest.java
>
>
> the lucene document object returned from the lucene search does not contain fields which values are null in the index. When trying to project those fields (obtain fields from document by name and return their String representation) a NPE accours.
> See: http://forum.hibernate.org/viewtopic.php?t=976899&start=0&postdays=0&postorder=asc&highlight=

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

        



More information about the hibernate-issues mailing list