You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/06/19 21:30:32 UTC
svn commit: r1686487 - in /lucene/dev/branches/branch_5x/lucene: CHANGES.txt
core/src/java/org/apache/lucene/store/DataOutput.java
Author: mikemccand
Date: Fri Jun 19 19:30:31 2015
New Revision: 1686487
URL: http://svn.apache.org/r1686487
Log:
LUCENE-6591: never write a negative vlong
Modified:
lucene/dev/branches/branch_5x/lucene/CHANGES.txt
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/DataOutput.java
Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1686487&r1=1686486&r2=1686487&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Fri Jun 19 19:30:31 2015
@@ -122,6 +122,9 @@ Bug fixes
* LUCENE-6593: Fixed ToChildBlockJoinQuery's scorer to not refuse to advance
to a document that belongs to the parent space. (Adrien Grand)
+* LUCENE-6591: Never write a negative vLong (Robert Muir, Ryan Ernst,
+ Adrien Grand, Mike McCandless)
+
Changes in Runtime Behavior
* LUCENE-6501: The subreader structure in ParallelCompositeReader
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/DataOutput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/DataOutput.java?rev=1686487&r1=1686486&r2=1686487&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/DataOutput.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/store/DataOutput.java Fri Jun 19 19:30:31 2015
@@ -221,12 +221,14 @@ public abstract class DataOutput {
* @see DataInput#readVLong()
*/
public final void writeVLong(long i) throws IOException {
- assert i >= 0L;
- writeNegativeVLong(i);
+ if (i < 0) {
+ throw new IllegalArgumentException("cannot write negative vLong (got: " + i + ")");
+ }
+ writeSignedVLong(i);
}
- // write a pontentially negative vLong
- private void writeNegativeVLong(long i) throws IOException {
+ // write a potentially negative vLong
+ private void writeSignedVLong(long i) throws IOException {
while ((i & ~0x7FL) != 0L) {
writeByte((byte)((i & 0x7FL) | 0x80L));
i >>>= 7;
@@ -241,7 +243,7 @@ public abstract class DataOutput {
* @see DataInput#readZLong()
*/
public final void writeZLong(long i) throws IOException {
- writeNegativeVLong(BitUtil.zigZagEncode(i));
+ writeSignedVLong(BitUtil.zigZagEncode(i));
}
/** Writes a string.