Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-6948: Fix ArrayIndexOutOfBoundsException in PagedBytes$Reader.fill by removing an unnecessary long-to-int cast. Also, unrelated, 2 ArrayList<>(initialCapacity) tweaks in getChildResources methods.

Christine Poerschke162d8caf7797
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index bb317a3a686..d56cb1add3a 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -197,6 +197,10 @@ Bug Fixes
stop words following a span can unduly make the fragment way too long.
(Elmer Garduno, Lukhnos Liu via David Smiley)
+* LUCENE-6948: Fix ArrayIndexOutOfBoundsException in PagedBytes$Reader.fill
+ by removing an unnecessary long-to-int cast.
+ (Michael Lawley via Christine Poerschke)
+
Other
* LUCENE-6924: Upgrade randomizedtesting to 2.3.2. (Dawid Weiss)
diff --git a/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCacheImpl.java b/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCacheImpl.java
index a4cb8b5f94f..85c1bbadba6 100644
--- a/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCacheImpl.java
+++ b/lucene/misc/src/java/org/apache/lucene/uninverting/FieldCacheImpl.java
@@ -605,7 +605,7 @@ class FieldCacheImpl implements FieldCache {
@Override
public Collection<Accountable> getChildResources() {
- List<Accountable> resources = new ArrayList<>();
+ List<Accountable> resources = new ArrayList<>(3);
resources.add(Accountables.namedAccountable("term bytes", bytes));
resources.add(Accountables.namedAccountable("ord -> term", termOrdToBytesOffset));
resources.add(Accountables.namedAccountable("doc -> ord", docToTermOrd));
@@ -730,7 +730,7 @@ class FieldCacheImpl implements FieldCache {
return new BinaryDocValues() {
@Override
public BytesRef get(int docID) {
- final int pointer = (int) docToOffset.get(docID);
+ final long pointer = docToOffset.get(docID);
if (pointer == 0) {
term.length = 0;
} else {
@@ -748,7 +748,7 @@ class FieldCacheImpl implements FieldCache {
@Override
public Collection<Accountable> getChildResources() {
- List<Accountable> resources = new ArrayList<>();
+ List<Accountable> resources = new ArrayList<>(2);
resources.add(Accountables.namedAccountable("term bytes", bytes));
resources.add(Accountables.namedAccountable("addresses", docToOffset));
return Collections.unmodifiableList(resources);