Skip to content

Apache Lucene open-source search software

Fix existential quantification bug in caller checks (#15878)

Uwe Schindlerbff8a8f1d436
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 12e244149e4..b8c121d2730 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -291,7 +291,7 @@ Bug Fixes
* GITHUB#12419, GITHUB#15119, GITHUB#15864: Fix circular dependency deadlock in
TestSecrets initialization (Namgyu Kim, Uwe Schindler)
-* GITHUB#15867: Use IllegalCallerException to signal wrong caller in internal classes
+* GITHUB#15878: Fix existential quantification bug in caller checks
(VectorizationProvider, TestSecrets). (Uwe Schindler)
Other
@@ -311,6 +311,9 @@ Other
* GITHUB#15826: Use ArrayUtil#copyOfSubArray to simplify manual array copy patterns. (Zhang Chao)
+* GITHUB#15867: Use IllegalCallerException to signal wrong caller in internal classes
+ (VectorizationProvider, TestSecrets). (Uwe Schindler)
+
======================= Lucene 10.4.0 =======================
API Changes
diff --git a/lucene/core/src/java/org/apache/lucene/internal/tests/TestSecrets.java b/lucene/core/src/java/org/apache/lucene/internal/tests/TestSecrets.java
index 74bb4ee9e54..5afdf10c080 100644
--- a/lucene/core/src/java/org/apache/lucene/internal/tests/TestSecrets.java
+++ b/lucene/core/src/java/org/apache/lucene/internal/tests/TestSecrets.java
@@ -142,7 +142,7 @@ public final class TestSecrets {
s.skip(2)
.limit(1)
.map(StackFrame::getClassName)
- .allMatch(allowedCaller.getName()::equals));
+ .anyMatch(allowedCaller.getName()::equals));
if (!validCaller || needsNull != null) {
throw new IllegalCallerException(
"The accessor can only be set once by " + allowedCaller.getName() + ".");
@@ -157,7 +157,7 @@ public final class TestSecrets {
s.skip(2)
.limit(1)
.map(StackFrame::getClassName)
- .allMatch(
+ .anyMatch(
c ->
c.startsWith("org.apache.lucene.tests.")
|| c.equals(
diff --git a/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java b/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java
index 12bf56c89d6..f77c1638fec 100644
--- a/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java
+++ b/lucene/core/src/java/org/apache/lucene/internal/vectorization/VectorizationProvider.java
@@ -222,7 +222,7 @@ public abstract class VectorizationProvider {
s.skip(2)
.limit(1)
.map(StackFrame::getClassName)
- .allMatch(VALID_CALLERS::contains));
+ .anyMatch(VALID_CALLERS::contains));
if (!validCaller) {
throw new IllegalCallerException(
"VectorizationProvider is internal and can only be used by known Lucene classes.");