lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-3259) need to clarify/change D&Penum api for hasPayload/getPayload
Date Thu, 30 Jun 2011 03:03:31 GMT

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

Robert Muir commented on LUCENE-3259:
-------------------------------------

{quote}
If D&PEnum says getPayload() returns null if there is no payload, then why do you say
it's not defined? I don't mind if we change the contract to hasPayload() first, then getPayload().
{quote}

Let me rephrase what I mean: currently if you call getPayload(), and there is no payload,
it does not actually always return null :) So its "defined" but does not work as defined.

The only safe thing at the moment to do if you are not sure if there is a payload, is to check
hasPayload() first, and if this returns false, do not mess with getPayload().

If you are sure there is a payload, you don't need to do anything with hasPayload().


> need to clarify/change D&Penum api for hasPayload/getPayload
> ------------------------------------------------------------
>
>                 Key: LUCENE-3259
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3259
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Robert Muir
>
> We encountered this bug while integrating the faceting module:
> * D&PEnum says getPayload() will return null if there is no payload.
> * however, in some cases this is not what happens.
> * things do work (with no exceptions), if you always check hasPayload() first.
> The easiest fix could be to correct the javadocs, and say that you should always check
hasPayload() first... otherwise getPayload() is not defined.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message