You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by cb...@apache.org on 2010/04/21 21:07:54 UTC

svn commit: r936447 - /xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java

Author: cbowditch
Date: Wed Apr 21 19:07:54 2010
New Revision: 936447

URL: http://svn.apache.org/viewvc?rev=936447&view=rev
Log:
recent change to cache CharacterSet exposed multi threading issue

Modified:
    xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java

Modified: xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java?rev=936447&r1=936446&r2=936447&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java (original)
+++ xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/fonts/CharacterSet.java Wed Apr 21 19:07:54 2010
@@ -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 {



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org