lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3590) minimize bytesref to be a ref to a byte[]
Date Sun, 27 Nov 2011 16:24:40 GMT


Robert Muir commented on LUCENE-3590:

BytesRef.copyBytes and equivalents are also heavily broken if offset != 0, and the javadoc
is non-intuitive:

   * NOTE: this method resets the offset to 0 and resizes the reference array
   * if needed.

This is ambiguous, its not obvious that it will reset offset to 0 *always* and then copy,
resizing if needed. 

This is in comparison to e.g. append(), which is less broken because it at least tries to
append to the 
existing offset, and if it needs to resize it resets offset to 0, but thats fine as its a
new byte[].

The former will overwrite unrelated data if bytesrefs are pointing to different slices of
the same array.
> minimize bytesref to be a ref to a byte[]
> -----------------------------------------
>                 Key: LUCENE-3590
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Bug
>    Affects Versions: 4.0
>            Reporter: Robert Muir
>            Priority: Blocker
>         Attachments: LUCENE-3590_copyCtor.patch, LUCENE-3590_deprecate_comparators.patch,
LUCENE-3590_equals_init.patch, LUCENE-3590_equals_init.patch, LUCENE-3590_with_clone.patch
> Setting this as blocker for 4.0, as this class is used in every API there.
> Currently this API is a little of a everything, sometimes its like a stringbuffer, it
> does numeric conversions, all kinds of stuff.
> We need this to be a ref to a byte[], nothing else. This other stuff can go somewhere

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


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

View raw message