This is an automated email from the ASF dual-hosted git repository.
epugh 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 81599b4081c SOLR-18167: Fix deprecated sysprop migration for camelCase
flags (#4507)
81599b4081c is described below
commit 81599b4081c5e64156a54a6bb56ee3d7cc033ad3
Author: Utsav <[email protected]>
AuthorDate: Mon Jun 8 20:59:15 2026 +0530
SOLR-18167: Fix deprecated sysprop migration for camelCase flags (#4507)
Co-authored-by: Eric Pugh <[email protected]>
---
.../unreleased/SOLR-18167-old-to-new-prop.yml | 7 +++
.../java/org/apache/solr/common/util/EnvUtils.java | 54 ++++++++++++----------
.../org/apache/solr/common/util/EnvUtilsTest.java | 8 ++++
3 files changed, 45 insertions(+), 24 deletions(-)
diff --git a/changelog/unreleased/SOLR-18167-old-to-new-prop.yml
b/changelog/unreleased/SOLR-18167-old-to-new-prop.yml
new file mode 100644
index 00000000000..0d0718e20b3
--- /dev/null
+++ b/changelog/unreleased/SOLR-18167-old-to-new-prop.yml
@@ -0,0 +1,7 @@
+title: "Solr 9 to 10 upgrade: old JWT property solr.auth.jwt.allowOutboundHttp
set via SOLR_OPTS now correctly maps to solr.auth.jwt.outbound.http.enabled,
fixing a startup failure when connecting to an HTTP identity provider."
+type: fixed
+authors:
+ - name: Utsav Parmar
+links:
+ - name: SOLR-18167
+ url: https://issues.apache.org/jira/browse/SOLR-18167
diff --git a/solr/solrj/src/java/org/apache/solr/common/util/EnvUtils.java
b/solr/solrj/src/java/org/apache/solr/common/util/EnvUtils.java
index d557f726b97..d0b24ca0f31 100644
--- a/solr/solrj/src/java/org/apache/solr/common/util/EnvUtils.java
+++ b/solr/solrj/src/java/org/apache/solr/common/util/EnvUtils.java
@@ -216,34 +216,40 @@ public class EnvUtils {
}
}
- // Convert deprecated keys to non deprecated versions
- for (String key : sysProperties.stringPropertyNames()) {
- if (DEPRECATED_MAPPINGS.containsKey(key) ||
DEPRECATED_MAPPINGS.containsKey("!" + key)) {
- String deprecatedKey = key;
- boolean invertValue = false;
- key = DEPRECATED_MAPPINGS.get(deprecatedKey);
- if (key == null) {
- key = DEPRECATED_MAPPINGS.get("!" + deprecatedKey);
- invertValue = true;
- }
- log.warn(
- "You are passing in deprecated system property {} and should
upgrade to using {} instead. The deprecated property support will be removed
in future version of Solr.",
- deprecatedKey,
- key);
-
- if (invertValue) {
- log.warn(
- "Converting from legacy system property {} to modern equivalent
{} by inverting the boolean value.",
- deprecatedKey,
- key);
- setProperty(key, String.valueOf(!Boolean.getBoolean(deprecatedKey)));
- } else {
- setProperty(key, sysProperties.getProperty(deprecatedKey));
- }
+ for (String deprecatedKey : sysProperties.stringPropertyNames()) {
+ String lookupKey = findDeprecatedMappingKey(deprecatedKey);
+ if (lookupKey != null) {
+ applyDeprecatedPropertyMapping(deprecatedKey, lookupKey,
sysProperties);
}
}
}
+ // "-D" flags land in system properties as typed - often camelCase - but our
mapping file uses
+ // dot-separated keys, so normalise before looking up.
+ private static String findDeprecatedMappingKey(String sysPropKey) {
+ var dotKey = camelCaseToDotSeparated(sysPropKey);
+ return isInDeprecatedMappings(dotKey) ? dotKey : null;
+ }
+
+ private static boolean isInDeprecatedMappings(String key) {
+ return DEPRECATED_MAPPINGS.containsKey(key) ||
DEPRECATED_MAPPINGS.containsKey("!" + key);
+ }
+
+ private static void applyDeprecatedPropertyMapping(
+ String deprecatedKey, String lookupKey, Properties sysProperties) {
+ var newPropName =
+ DEPRECATED_MAPPINGS.getOrDefault(lookupKey,
DEPRECATED_MAPPINGS.get("!" + lookupKey));
+ var newValue =
+ DEPRECATED_MAPPINGS.containsKey(lookupKey)
+ ? sysProperties.getProperty(deprecatedKey)
+ : String.valueOf(!Boolean.getBoolean(deprecatedKey));
+ log.warn(
+ "Deprecated system property {} has been replaced by {}. Support for
the old property will be removed in a future version of Solr.",
+ deprecatedKey,
+ newPropName);
+ setProperty(newPropName, newValue);
+ }
+
protected static String envNameToSyspropName(String envName) {
return CUSTOM_MAPPINGS.containsKey(envName)
? CUSTOM_MAPPINGS.get(envName)
diff --git a/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java
b/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java
index 7b360dd49cf..cce0a483bcb 100644
--- a/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java
+++ b/solr/solrj/src/test/org/apache/solr/common/util/EnvUtilsTest.java
@@ -110,6 +110,14 @@ public class EnvUtilsTest extends SolrTestCase {
assertEquals("xml,json,jar",
EnvUtils.getProperty("solr.configset.forbidden.file.types"));
}
+ @Test
+ public void deprecatedCamelCaseDFlagIsTranslatedToCurrentPropertyName() {
+ Properties sysprops = new Properties();
+ sysprops.setProperty("solr.auth.jwt.allowOutboundHttp", "true");
+ EnvUtils.init(false, Map.of(), sysprops);
+
assertTrue(EnvUtils.getPropertyAsBool("solr.auth.jwt.outbound.http.enabled"));
+ }
+
@Test
public void testFlippingDisabledToEnabledPropertyName() {