[ 
https://issues.apache.org/jira/browse/XERCESJ-789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Elliotte Rusty Harold closed XERCESJ-789.
-----------------------------------------

> Serializer fails under heavy reuse
> ----------------------------------
>
>                 Key: XERCESJ-789
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-789
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: Serialization
>    Affects Versions: 2.2.1
>         Environment: Operating System: Other
> Platform: All
>            Reporter: Pasi Tuulosniemi
>
> The following code is used by multiple threads simutanuously:
>   static OutputFormat frmt = new OutputFormat();
>   private static final ThreadLocal serializerHolder = new ThreadLocal() {
>       protected synchronized Object initialValue() {
>         return new XMLSerializer();
>       }
>     };
>   public static void serialize(Document doc, OutputStream out, String 
> outputFormat)
>     throws IOException {
>     XMLSerializer serializer = (XMLSerializer)serializerHolder.get();
>     serializer.setOutputFormat(frmt);
>     serializer.setOutputByteStream(out);
>     serializer.asDOMSerializer().serialize(doc);
>   }
> The OutputStream is always a ByteArrayOutputStream so no IOExceptions occur. 
> After a while this exception gets thrown:
> java.lang.IllegalStateException: ResetInMiddle: The serializer may not be 
> reset 
> in the middle of serialization.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to