lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <>
Subject [jira] [Commented] (LUCENE-6321) Make oal.index.Term more defensive
Date Wed, 04 Mar 2015 16:07:05 GMT


Robert Muir commented on LUCENE-6321:

Is the ctor copy enough for safety, or do we still also need deep clone? I'm just wondering
because it could maybe make things simpler in 5.x branch for the filter case...

> Make oal.index.Term more defensive
> ----------------------------------
>                 Key: LUCENE-6321
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Adrien Grand
>            Assignee: Adrien Grand
>            Priority: Minor
>         Attachments: LUCENE-6321.patch, LUCENE-6321.patch
> oal.index.Term has a Term(String field, BytesRef termBytes) constructor. Even though
it warns that the term bytes should not be reused, I'm wondering that we should make it more
> {noformat}
>    * <p>WARNING: the provided BytesRef is not copied, but used directly.
>    * Therefore the bytes should not be modified after construction, for
>    * example, you should clone a copy by {@link BytesRef#deepCopyOf}
>    * rather than pass reused bytes from a TermsEnum.
> {noformat} 
> For example if you have term queries in your query cache and they are modified in-place,
it would have very bad consequences and would be hard to diagnose.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message