From 5af68d92a0e545655888d65ecbb0296410a2afb2 Mon Sep 17 00:00:00 2001 From: Joerg Pietschmann Date: Tue, 16 Jul 2002 20:04:44 +0000 Subject: [PATCH] Fixed some remaining problems with the TextBuffer patch for FObjMixed Slightly Optimized extensions.Label git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/fop-0_20_2-maintain@195003 13f79535-47bb-0310-9956-ffa450edef68 --- src/org/apache/fop/extensions/Label.java | 11 +++++++---- src/org/apache/fop/fo/XMLObj.java | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/org/apache/fop/extensions/Label.java b/src/org/apache/fop/extensions/Label.java index aa6bf1c31..c46384f38 100644 --- a/src/org/apache/fop/extensions/Label.java +++ b/src/org/apache/fop/extensions/Label.java @@ -11,7 +11,7 @@ import org.apache.fop.fo.*; public class Label extends ExtensionObj { - private String _label = ""; + private StringBuffer textBuffer; public static class Maker extends FObj.Maker { public FObj make(FObj parent, PropertyList propertyList) { @@ -28,12 +28,15 @@ public class Label extends ExtensionObj { super(parent, propertyList); } - protected void addCharacters(char data[], int start, int end) { - _label += new String(data, start, end - start); + protected void addCharacters(char data[], int start, int length) { + if (textBuffer==null) { + textBuffer = new StringBuffer(); + } + textBuffer.append(data,start,length); } public String toString() { - return _label; + return textBuffer.toString(); } diff --git a/src/org/apache/fop/fo/XMLObj.java b/src/org/apache/fop/fo/XMLObj.java index c7631efac..f4df1cb2b 100644 --- a/src/org/apache/fop/fo/XMLObj.java +++ b/src/org/apache/fop/fo/XMLObj.java @@ -128,7 +128,7 @@ public abstract class XMLObj extends FObj { } protected void addCharacters(char data[], int start, int length) { - String str = new String(data, start, length - start); + String str = new String(data, start, length); org.w3c.dom.Text text = doc.createTextNode(str); element.appendChild(text); } -- 2.39.5