[ 
https://issues.apache.org/jira/browse/LUCENE-1233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651944#action_12651944
 ] 

Nadav Har'El commented on LUCENE-1233:
--------------------------------------

Hi, I know this comment is a bit too late, but I thought I'd make it anyway as 
I assume many people will be switching from Lucene 2.3 to 2.4 soon and may 
encounter this.

The issue is that while this API change will indeed simplify life for some 
writers of new code, it may cause some existing code to break unless fixed.

For example, I have code which wanted to check whether or not there are any 
values to this field (e.g., to print a header before looping to show the 
values), and had the check doc.getFields(name)!=null. This check no longer 
works and needs to be changed to ...length()!=0. 

> Fix Document.getFieldables and others to never return null
> ----------------------------------------------------------
>
>                 Key: LUCENE-1233
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1233
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Index
>    Affects Versions: 2.1, 2.2, 2.3, 2.3.1
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 2.4
>
>
> Document.getFieldables (and other similar methods) returns null if there are 
> no fields matching the name.  We can avoid NPE in consumers of this API if 
> instead we return an empty array.
> Spinoff from http://markmail.org/message/g2nzstmce4cnf3zj

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to