You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2020/04/30 14:41:46 UTC
[tomcat] branch 9.0.x updated: 64398: Change default value
separator for property replacement
This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/9.0.x by this push:
new c7da191 64398: Change default value separator for property replacement
c7da191 is described below
commit c7da1911c919a5c4639436615f28c6e9ca6534ac
Author: remm <re...@apache.org>
AuthorDate: Thu Apr 30 16:37:52 2020 +0200
64398: Change default value separator for property replacement
Due to conflicts, the syntax is now ${name:-default}.
---
java/org/apache/tomcat/util/IntrospectionUtils.java | 4 ++--
test/org/apache/tomcat/util/TestIntrospectionUtils.java | 8 ++++----
webapps/docs/changelog.xml | 5 +++++
webapps/docs/config/systemprops.xml | 2 +-
4 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/java/org/apache/tomcat/util/IntrospectionUtils.java b/java/org/apache/tomcat/util/IntrospectionUtils.java
index 9987533..cbf9679 100644
--- a/java/org/apache/tomcat/util/IntrospectionUtils.java
+++ b/java/org/apache/tomcat/util/IntrospectionUtils.java
@@ -282,9 +282,9 @@ public final class IntrospectionUtils {
String v = getProperty(n, staticProp, dynamicProp, classLoader);
if (v == null) {
// {name:default}
- int col = n.indexOf(':');
+ int col = n.indexOf(":-");
if (col != -1) {
- String dV = n.substring(col+1);
+ String dV = n.substring(col + 2);
n = n.substring(0, col);
v = getProperty(n, staticProp, dynamicProp, classLoader);
if (v == null) {
diff --git a/test/org/apache/tomcat/util/TestIntrospectionUtils.java b/test/org/apache/tomcat/util/TestIntrospectionUtils.java
index ef27174..ed9fe39 100644
--- a/test/org/apache/tomcat/util/TestIntrospectionUtils.java
+++ b/test/org/apache/tomcat/util/TestIntrospectionUtils.java
@@ -130,16 +130,16 @@ public class TestIntrospectionUtils {
Assert.assertEquals("abcvalue1xyz", IntrospectionUtils.replaceProperties(
"abc${normal}xyz", properties, null, null));
- properties.setProperty("prop_with:colon", "value2");
+ properties.setProperty("prop_with:-colon", "value2");
Assert.assertEquals("value2", IntrospectionUtils.replaceProperties(
- "${prop_with:colon}", properties, null, null));
+ "${prop_with:-colon}", properties, null, null));
Assert.assertEquals("value1", IntrospectionUtils.replaceProperties(
- "${normal:default}", properties, null, null));
+ "${normal:-default}", properties, null, null));
properties.remove("normal");
Assert.assertEquals("default", IntrospectionUtils.replaceProperties(
- "${normal:default}", properties, null, null));
+ "${normal:-default}", properties, null, null));
Assert.assertEquals("abc${normal}xyz", IntrospectionUtils.replaceProperties(
"abc${normal}xyz", properties, null, null));
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 5642724..5ceb6ca 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -94,6 +94,11 @@
<update>
Remove reason phrase on WebDAV Multi-Status (207) response. (michaelo)
</update>
+ <fix>
+ <bug>64398</bug>: Change default value separator for property
+ replacement to <code>:-</code> due to possible conflicts. The
+ syntax is now <code>${name:-default}</code>. (remm)
+ </fix>
</changelog>
</subsection>
<subsection name="Coyote">
diff --git a/webapps/docs/config/systemprops.xml b/webapps/docs/config/systemprops.xml
index c0b4e7a..106a8db 100644
--- a/webapps/docs/config/systemprops.xml
+++ b/webapps/docs/config/systemprops.xml
@@ -45,7 +45,7 @@
<code>org.apache.tomcat.util.IntrospectionUtils.PropertySource</code>.
Required to have a public constructor with no arguments.</p>
<p>Use this to add a property source, that will be invoked when
- <code>${parameter:default-value}</code> denoted parameters (with
+ <code>${parameter:-default-value}</code> denoted parameters (with
optional default values) are found in the XML files that Tomcat
parses.</p>
<p>Property replacement from the specified property source on the JVM
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org