This is an automated email from the ASF dual-hosted git repository.
remm pushed a commit to branch 10.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.0.x by this push:
new 16c2c3f Improve escaping for code in call method
16c2c3f is described below
commit 16c2c3f955338b5089cc9f56f736caf2762a11a9
Author: remm <[email protected]>
AuthorDate: Sat Jan 1 20:56:08 2022 +0100
Improve escaping for code in call method
---
java/org/apache/tomcat/util/digester/CallMethodRule.java | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/java/org/apache/tomcat/util/digester/CallMethodRule.java
b/java/org/apache/tomcat/util/digester/CallMethodRule.java
index 28176ab..bd65535 100644
--- a/java/org/apache/tomcat/util/digester/CallMethodRule.java
+++ b/java/org/apache/tomcat/util/digester/CallMethodRule.java
@@ -393,13 +393,9 @@ public class CallMethodRule extends Rule {
code.append(", ");
}
if (bodyText != null) {
- StringBuilder bodyTextParam = new StringBuilder();
- for (String bodyPart : bodyText.split("\n")) {
- bodyTextParam.append(bodyPart.trim()).append(' ');
- }
-
code.append("\"").append(bodyTextParam.toString().trim().replace("\"",
"\\\"")).append("\"");
+
code.append("\"").append(IntrospectionUtils.escape(bodyText)).append("\"");
} else if (paramValues[i] instanceof String) {
-
code.append("\"").append(paramValues[i].toString()).append("\"");
+
code.append("\"").append(IntrospectionUtils.escape(paramValues[i].toString())).append("\"");
} else {
code.append(digester.toVariableName(paramValues[i]));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]