aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChris Bowditch <cbowditch@apache.org>2010-04-21 19:07:54 +0000
committerChris Bowditch <cbowditch@apache.org>2010-04-21 19:07:54 +0000
commitf90e643f6ae1ef50036a18a83f81ac74ffbe116c (patch)
tree1f7063e6ecc9024382d002489a5064da85214a34 /src
parent61bd8c0641569a923e4f10ea37ac522237d98fe7 (diff)
downloadxmlgraphics-fop-f90e643f6ae1ef50036a18a83f81ac74ffbe116c.tar.gz
xmlgraphics-fop-f90e643f6ae1ef50036a18a83f81ac74ffbe116c.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/afp/fonts/CharacterSet.java6
1 files changed, 5 insertions, 1 deletions
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 {