sonatype-lift[bot] commented on a change in pull request #438: URL: https://github.com/apache/lucene/pull/438#discussion_r751055798
########## File path: lucene/core/src/java/org/apache/lucene/util/SparseFixedBitSet.java ########## @@ -530,4 +530,33 @@ public long ramBytesUsed() { public String toString() { return "SparseFixedBitSet(size=" + length + ",cardinality=~" + approximateCardinality(); } + + public static SparseFixedBitSet fromWords(int maxDoc, int base, long[] words) { + assert (base & 63) == 0; + SparseFixedBitSet sparseFixedBitSet = new SparseFixedBitSet(maxDoc + 1); + final int baseWord = base >> 6; + final long[] indices = sparseFixedBitSet.indices; + final long[][] bits = sparseFixedBitSet.bits; + int nonZeroWordCounts = 0; + int lastIndex = -1; + int bitsPos = 0; + long[] currentBits = null; + for (int i = 0; i < words.length; i++) { + long word = words[i]; + if (word != 0) { + int actualI = i + baseWord; + int index = actualI >> 6; + if (index != lastIndex) { + currentBits = bits[index] = new long[64]; + bitsPos = 0; + lastIndex = index; + } + nonZeroWordCounts++; + indices[index] |= 1L << actualI; + currentBits[bitsPos++] = word; Review comment: *NULL_DEREFERENCE:* object `currentBits` last assigned on line 543 could be null and is dereferenced at line 556. (at-me [in a reply](https://help.sonatype.com/lift/talking-to-lift) with `help` or `ignore`) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org