You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by co...@apache.org on 2023/09/01 13:05:41 UTC

[solr] branch main updated: SOLR-16958: Fix spurious warning about LATEST luceneMatchVersion (#1879)

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

colvinco pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 8c0d1a0698c SOLR-16958: Fix spurious warning about LATEST luceneMatchVersion (#1879)
8c0d1a0698c is described below

commit 8c0d1a0698ca8a9d8d95d0e1de5ccc8a4ec7dc56
Author: Colvin Cowie <co...@gmail.com>
AuthorDate: Fri Sep 1 14:05:34 2023 +0100

    SOLR-16958: Fix spurious warning about LATEST luceneMatchVersion (#1879)
---
 solr/CHANGES.txt                                        | 2 ++
 solr/core/src/java/org/apache/solr/core/SolrConfig.java | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e7e31b686d5..9bfc1191052 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -151,6 +151,8 @@ Bug Fixes
 * SOLR-16916: Use of the JSON Query DSL should ignore the defType parameter
   (Christina Chortaria, Max Kadel, Ryan Laddusaw, Jane Sandberg, David Smiley)
 
+* SOLR-16958: Fix spurious warning about LATEST luceneMatchVersion (Colvin Cowie)
+
 Dependency Upgrades
 ---------------------
 
diff --git a/solr/core/src/java/org/apache/solr/core/SolrConfig.java b/solr/core/src/java/org/apache/solr/core/SolrConfig.java
index 563d817803e..7fb27347818 100644
--- a/solr/core/src/java/org/apache/solr/core/SolrConfig.java
+++ b/solr/core/src/java/org/apache/solr/core/SolrConfig.java
@@ -409,6 +409,7 @@ public class SolrConfig implements MapSerializable {
 
   private static final AtomicBoolean versionWarningAlreadyLogged = new AtomicBoolean(false);
 
+  @SuppressWarnings("ReferenceEquality") // Use of == is intentional here
   public static final Version parseLuceneVersionString(final String matchVersion) {
     final Version version;
     try {
@@ -420,7 +421,9 @@ public class SolrConfig implements MapSerializable {
           pe);
     }
 
-    if (Objects.equals(version, Version.LATEST) && !versionWarningAlreadyLogged.getAndSet(true)) {
+    // The use of == is intentional here because the latest 'V.V.V' version will be equal() to
+    // Version.LATEST, but will not be == to Version.LATEST unless 'LATEST' was supplied.
+    if (version == Version.LATEST && !versionWarningAlreadyLogged.getAndSet(true)) {
       log.warn(
           "You should not use LATEST as luceneMatchVersion property: "
               + "if you use this setting, and then Solr upgrades to a newer release of Lucene, "