You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2019/03/01 09:46:07 UTC

[lucene-solr] branch branch_8x updated: LUCENE-8709: Set pointWriter to null when size of the HeapPointWriter is 0

This is an automated email from the ASF dual-hosted git repository.

ivera pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/branch_8x by this push:
     new beda852  LUCENE-8709: Set pointWriter to null when size of the HeapPointWriter is 0
beda852 is described below

commit beda852fc2c155217882ce8289f20c718132c4f1
Author: iverase <iv...@apache.org>
AuthorDate: Fri Mar 1 10:44:07 2019 +0100

    LUCENE-8709: Set pointWriter to null when size of the HeapPointWriter is 0
---
 .../src/java/org/apache/lucene/util/bkd/HeapPointReader.java   |  2 +-
 .../src/java/org/apache/lucene/util/bkd/HeapPointWriter.java   | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lucene/core/src/java/org/apache/lucene/util/bkd/HeapPointReader.java b/lucene/core/src/java/org/apache/lucene/util/bkd/HeapPointReader.java
index bc37f5b..735b313 100644
--- a/lucene/core/src/java/org/apache/lucene/util/bkd/HeapPointReader.java
+++ b/lucene/core/src/java/org/apache/lucene/util/bkd/HeapPointReader.java
@@ -41,7 +41,7 @@ public final class HeapPointReader implements PointReader {
       this.pointValue = new HeapPointValue(block, packedBytesLength);
     } else {
       //no values
-      this.pointValue = new HeapPointValue(block, 0);
+      this.pointValue = null;
     }
   }
 
diff --git a/lucene/core/src/java/org/apache/lucene/util/bkd/HeapPointWriter.java b/lucene/core/src/java/org/apache/lucene/util/bkd/HeapPointWriter.java
index 8397851..db30548 100644
--- a/lucene/core/src/java/org/apache/lucene/util/bkd/HeapPointWriter.java
+++ b/lucene/core/src/java/org/apache/lucene/util/bkd/HeapPointWriter.java
@@ -32,7 +32,7 @@ public final class HeapPointWriter implements PointWriter {
   private int nextWrite;
   private boolean closed;
 
-  private HeapPointReader.HeapPointValue offlinePointValue;
+  private HeapPointReader.HeapPointValue pointValue;
 
 
   public HeapPointWriter(int size, int packedBytesLength) {
@@ -42,18 +42,18 @@ public final class HeapPointWriter implements PointWriter {
     this.packedBytesLength = packedBytesLength;
     this.scratch = new byte[packedBytesLength];
     if (size > 0) {
-      offlinePointValue = new HeapPointReader.HeapPointValue(block, packedBytesLength);
+      pointValue = new HeapPointReader.HeapPointValue(block, packedBytesLength);
     } else {
       //no values
-      offlinePointValue =  new HeapPointReader.HeapPointValue(block, 0);
+      pointValue =  null;
     }
   }
 
   /** Returns a reference, in <code>result</code>, to the byte[] slice holding this value */
   public PointValue getPackedValueSlice(int index) {
     assert index < nextWrite : "nextWrite=" + (nextWrite) + " vs index=" + index;
-    offlinePointValue.setValue(index * packedBytesLength, docIDs[index]);
-    return offlinePointValue;
+    pointValue.setValue(index * packedBytesLength, docIDs[index]);
+    return pointValue;
   }
 
   @Override