DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22616>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22616

Serializer fails under heavy reuse

           Summary: Serializer fails under heavy reuse
           Product: Xerces2-J
           Version: 2.2.1
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


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.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to