This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 8.5.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push: new 1a3dd73 64398: Change default value separator for property replacement 1a3dd73 is described below commit 1a3dd7368f72a5b97e93a6a100e7797eddbd5eac Author: remm <r...@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 9cb648d..9cfab25 100644 --- a/java/org/apache/tomcat/util/IntrospectionUtils.java +++ b/java/org/apache/tomcat/util/IntrospectionUtils.java @@ -294,9 +294,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 0b40f5d..485fb83 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -93,6 +93,11 @@ <bug>64386</bug>: WebdavServlet does not send "getlastmodified" property for resource collections. (michaelo) </add> + <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 d547929..0d18973 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-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org