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: [email protected]
For additional commands, e-mail: [email protected]