|
1 | | -From ea035412d25a54e387e748c07a6c4f58b06ff10d Mon Sep 17 00:00:00 2001 |
| 1 | +From 124575963f02242904d655cfde7d05375c2c2d26 Mon Sep 17 00:00:00 2001 |
2 | 2 | From: Razvan-Daniel Mihai < [email protected]> |
3 | 3 | Date: Wed, 5 Nov 2025 12:27:34 +0100 |
4 | 4 | Subject: fix: move buffer into function to prevent race |
5 | 5 |
|
6 | 6 | --- |
7 | | - src/main/java/org/apache/log4j/xml/XMLLayout.java | 10 +--------- |
8 | | - 1 file changed, 1 insertion(+), 9 deletions(-) |
| 7 | + src/main/java/org/apache/log4j/helpers/Transform.java | 4 ++-- |
| 8 | + src/main/java/org/apache/log4j/xml/XMLLayout.java | 10 +--------- |
| 9 | + 2 files changed, 3 insertions(+), 11 deletions(-) |
9 | 10 |
|
| 11 | +diff --git a/src/main/java/org/apache/log4j/helpers/Transform.java b/src/main/java/org/apache/log4j/helpers/Transform.java |
| 12 | +index ad77e165..5f0aba25 100644 |
| 13 | +--- a/src/main/java/org/apache/log4j/helpers/Transform.java |
| 14 | ++++ b/src/main/java/org/apache/log4j/helpers/Transform.java |
| 15 | +@@ -76,11 +76,11 @@ public class Transform { |
| 16 | + /** |
| 17 | + * Ensures that embeded CDEnd strings (]]>) are handled properly within message, NDC and throwable tag text. |
| 18 | + * |
| 19 | +- * @param buf StringBuffer holding the XML data to this point. The initial CDStart (<![CDATA[) and final CDEnd |
| 20 | ++ * @param buf StringBuilder holding the XML data to this point. The initial CDStart (<![CDATA[) and final CDEnd |
| 21 | + * (]]>) of the CDATA section are the responsibility of the calling method. |
| 22 | + * @param str The String that is inserted into an existing CDATA Section within buf. |
| 23 | + */ |
| 24 | +- static public void appendEscapingCDATA(final StringBuffer buf, final String str) { |
| 25 | ++ static public void appendEscapingCDATA(final StringBuilder buf, final String str) { |
| 26 | + if (str != null) { |
| 27 | + int end = str.indexOf(CDATA_END); |
| 28 | + if (end < 0) { |
10 | 29 | diff --git a/src/main/java/org/apache/log4j/xml/XMLLayout.java b/src/main/java/org/apache/log4j/xml/XMLLayout.java |
11 | 30 | index 4f0d99f3..35ef30d8 100644 |
12 | 31 | --- a/src/main/java/org/apache/log4j/xml/XMLLayout.java |
|
0 commit comments