-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Null Boolean Values in Hibernate Search
PostPosted: Wed May 09, 2007 1:01 pm 
Newbie

Joined: Fri Jan 26, 2007 6:39 pm
Posts: 3
I ran across this problem when using Hibernate Search to build an index for pre-existing data. Our data contains a Boolean field recommended that, in our database, can contain null values. When Search attempted to index documents with null Boolean values, it crashed, showing a NullPointerException at BooleanBridge.java@20. When I looked through the source, it appears that the code reads:
Code:
Boolean b = (Boolean) object;
return b.toString();

As such, a null Boolean value was crashing on the toString() method. The fix that I implemented was changing
Code:
return b.toString();

to
Code:
return (b == null) ? null : b.toString();

This issue does not appear to happen in any of the other Bridges, they already seem to handle null values. I wanted to verify that this is indeed a bug before submitting the issue to JIRA.

Thank you.


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 14, 2007 12:08 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
You are correct
http://opensource.atlassian.com/project ... HSEARCH-50

I fixed in in SVN
You can use a @FieldBridge in the meanwhile if you don't want to use the SVN HEAD version

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.