You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Muir (JIRA)" <ji...@apache.org> on 2011/06/29 23:44:28 UTC

[jira] [Created] (LUCENE-3259) need to clarify/change D&Penum api for hasPayload/getPayload

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


[jira] [Resolved] (LUCENE-3259) need to clarify/change D&Penum api for hasPayload/getPayload

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3259?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Muir resolved LUCENE-3259.
---------------------------------

       Resolution: Fixed
    Fix Version/s: 4.0
    
> need to clarify/change D&Penum api for hasPayload/getPayload
> ------------------------------------------------------------
>
>                 Key: LUCENE-3259
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3259
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>             Fix For: 4.0
>
>
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators
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


[jira] [Commented] (LUCENE-3259) need to clarify/change D&Penum api for hasPayload/getPayload

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ 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


[jira] [Commented] (LUCENE-3259) need to clarify/change D&Penum api for hasPayload/getPayload

Posted by "Shai Erera (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3259?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13057593#comment-13057593 ] 

Shai Erera commented on LUCENE-3259:
------------------------------------

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().

But if we want to follow, e.g. DocIdSetIterator, where you call nextDoc() and get the doc ID back, without calling next() followed by docID(), then I think getPayload() should be enough here too. Especially for cases where we know a payload was written.

What do you think?

> 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