This is an automated email from the ASF dual-hosted git repository.
vy pushed a commit to branch LOG4J2-3393
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git
The following commit(s) were added to refs/heads/LOG4J2-3393 by this push:
new 2e85b9d LOG4J2-3393 Fix StringBuilder sizing code typo in
JsonWriter#trimStringBuilder().
2e85b9d is described below
commit 2e85b9de853de40d42ee6aab3d03715945a6249d
Author: Volkan Yazici <[email protected]>
AuthorDate: Wed Feb 16 17:07:11 2022 +0100
LOG4J2-3393 Fix StringBuilder sizing code typo in
JsonWriter#trimStringBuilder().
---
.../org/apache/logging/log4j/layout/template/json/util/JsonWriter.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/util/JsonWriter.java
b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/util/JsonWriter.java
index 24c8f57..2d5df72 100644
---
a/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/util/JsonWriter.java
+++
b/log4j-layout-template-json/src/main/java/org/apache/logging/log4j/layout/template/json/util/JsonWriter.java
@@ -854,7 +854,7 @@ public final class JsonWriter implements AutoCloseable,
Cloneable {
private void trimStringBuilder(final StringBuilder stringBuilder, final
int length) {
final int trimLength = Math.max(maxStringLength, length);
- if (stringBuilder.length() > trimLength) {
+ if (stringBuilder.capacity() > trimLength) {
stringBuilder.setLength(trimLength);
stringBuilder.trimToSize();
}