Author: remm
Date: Tue Mar  6 14:00:04 2018
New Revision: 1825987

URL: http://svn.apache.org/viewvc?rev=1825987&view=rev
Log:
62160: Allow more flexible linked property replacement using the configured 
property source and system properties.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java?rev=1825987&r1=1825986&r2=1825987&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/digester/Digester.java Tue Mar  6 
14:00:04 2018
@@ -1924,10 +1924,14 @@ public class Digester extends DefaultHan
         for (int i = 0; i < nAttributes; ++i) {
             String value = newAttrs.getValue(i);
             try {
-                String newValue = IntrospectionUtils.replaceProperties(value, 
null, source);
-                if (value != newValue) {
-                    newAttrs.setValue(i, newValue);
-                }
+                String newValue = value;
+                do {
+                    value = newValue;
+                    newValue = IntrospectionUtils.replaceProperties(value, 
null, source);
+                    if (!value.equals(newValue)) {
+                        newAttrs.setValue(i, newValue);
+                    }
+                } while (!value.equals(newValue));
             } catch (Exception e) {
                 log.warn(sm.getString("digester.failedToUpdateAttributes", 
newAttrs.getLocalName(i), value), e);
             }
@@ -1945,14 +1949,17 @@ public class Digester extends DefaultHan
      */
     private StringBuilder updateBodyText(StringBuilder bodyText) {
         String in = bodyText.toString();
-        String out;
+        String out = in;
         try {
-            out = IntrospectionUtils.replaceProperties(in, null, source);
+            do {
+                in = out;
+                out = IntrospectionUtils.replaceProperties(in, null, source);
+            } while (!out.equals(in));
         } catch (Exception e) {
             return bodyText; // return unchanged data
         }
 
-        if (out == in) {
+        if (out.equals(in)) {
             // No substitutions required. Don't waste memory creating
             // a new buffer
             return bodyText;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1825987&r1=1825986&r2=1825987&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Tue Mar  6 14:00:04 2018
@@ -59,6 +59,10 @@
       <fix>
         Avoid potential loop in APR/Native poller. (markt)
       </fix>
+      <update>
+        <bug>62160</bug>: Allow more flexible linked property replacement
+        using the configured property source and system properties. (remm)
+      </update>
     </changelog>
   </subsection>
   <subsection name="Other">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to