This is an automated email from the ASF dual-hosted git repository. remm pushed a commit to branch 7.0.x in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/7.0.x by this push: new e1d122f 64398: Change default value separator for property replacement e1d122f is described below commit e1d122f3853c16bdac9cfb2faa40920c662cd423 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 b33254c..1bf3019 100644 --- a/java/org/apache/tomcat/util/IntrospectionUtils.java +++ b/java/org/apache/tomcat/util/IntrospectionUtils.java @@ -562,9 +562,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 8773e6d..c5e3095 100644 --- a/test/org/apache/tomcat/util/TestIntrospectionUtils.java +++ b/test/org/apache/tomcat/util/TestIntrospectionUtils.java @@ -131,16 +131,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 2596f72..8cf7d02 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -104,6 +104,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 556298e..5ba7e8b 100644 --- a/webapps/docs/config/systemprops.xml +++ b/webapps/docs/config/systemprops.xml @@ -44,7 +44,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><code>org.apache.tomcat.util.digester.EnvironmentPropertySource</code> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org