From f90e643f6ae1ef50036a18a83f81ac74ffbe116c Mon Sep 17 00:00:00 2001 From: Chris Bowditch Date: Wed, 21 Apr 2010 19:07:54 +0000 Subject: [PATCH] recent change to cache CharacterSet exposed multi threading issue git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@936447 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/fop/afp/fonts/CharacterSet.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/java/org/apache/fop/afp/fonts/CharacterSet.java b/src/java/org/apache/fop/afp/fonts/CharacterSet.java index 555d70158..24c53a1c3 100644 --- a/src/java/org/apache/fop/afp/fonts/CharacterSet.java +++ b/src/java/org/apache/fop/afp/fonts/CharacterSet.java @@ -362,7 +362,11 @@ public class CharacterSet { */ public byte[] encodeChars(CharSequence chars) throws CharacterCodingException { if (encoder != null) { - ByteBuffer bb = encoder.encode(CharBuffer.wrap(chars)); + ByteBuffer bb; + // encode method is not thread safe + synchronized (encoder) { + bb = encoder.encode(CharBuffer.wrap(chars)); + } if (bb.hasArray()) { return bb.array(); } else { -- 2.39.5