From ab074da873f1e0d9eb101a1aece7c79f8de1614b Mon Sep 17 00:00:00 2001 From: Mike McCandless Date: Thu, 25 Aug 2016 11:42:48 -0400 Subject: [PATCH] Don't illegally reuse scorer in this test Closes elastic/elasticsearch#3216 Original commit: elastic/x-pack-elasticsearch@63654c55859fb0c82a079b338845ee77ff563fca --- .../SecurityIndexSearcherWrapperUnitTests.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java index 885aba2f0f6..edfce32992a 100644 --- a/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java +++ b/elasticsearch/x-pack/security/src/test/java/org/elasticsearch/xpack/security/authz/accesscontrol/SecurityIndexSearcherWrapperUnitTests.java @@ -351,7 +351,6 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase { Weight weight = searcher.createNormalizedWeight(new TermQuery(new Term("field2", "value1")), false); LeafReaderContext leaf = directoryReader.leaves().get(0); - Scorer scorer = weight.scorer(leaf); SparseFixedBitSet sparseFixedBitSet = query(leaf, "field1", "value1"); LeafCollector leafCollector = new LeafBucketCollector() { @@ -360,7 +359,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase { assertThat(doc, equalTo(0)); } }; - intersectScorerAndRoleBits(scorer, sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs()); + intersectScorerAndRoleBits(weight.scorer(leaf), sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs()); sparseFixedBitSet = query(leaf, "field1", "value2"); leafCollector = new LeafBucketCollector() { @@ -369,7 +368,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase { assertThat(doc, equalTo(1)); } }; - intersectScorerAndRoleBits(scorer, sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs()); + intersectScorerAndRoleBits(weight.scorer(leaf), sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs()); sparseFixedBitSet = query(leaf, "field1", "value3"); @@ -379,7 +378,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase { fail("docId [" + doc + "] should have been deleted"); } }; - intersectScorerAndRoleBits(scorer, sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs()); + intersectScorerAndRoleBits(weight.scorer(leaf), sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs()); sparseFixedBitSet = query(leaf, "field1", "value4"); leafCollector = new LeafBucketCollector() { @@ -388,7 +387,7 @@ public class SecurityIndexSearcherWrapperUnitTests extends ESTestCase { assertThat(doc, equalTo(3)); } }; - intersectScorerAndRoleBits(scorer, sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs()); + intersectScorerAndRoleBits(weight.scorer(leaf), sparseFixedBitSet, leafCollector, leaf.reader().getLiveDocs()); directoryReader.close(); directory.close();