You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Thangadurai <du...@siptech.co.in> on 2003/01/24 14:03:35 UTC

[PATCH] FOR THE BUG#1083

Hi All, 
    This is Thangadurai from SIP Technologies & Exports Ltd, I have attempted to fix issue 1083 which is in open state. Please find the attached patch for the issue. 

        Issueid -             1083   

        IssueDescription -     OutputStream or Writer inside StreamResult always get flushed by Transformer.transform() 

              (i). Interms of Writer, The SerializerToXML class has a flag m_shouldFlush which tells if flushWriter() should flush the writer, and its init(Writer, Properties) method does set the flag to false.  However, when Transformer.transform(StreamSource, StreamResult) method is called the SerializerToXML.init(Writer, Properties) method is never called, instead setWriter(Writer) is called, which does nothing with the flag.  And the m_shouldFlush flag defaults to true.  Thus the flush.  

         Fix: -
              a) Added the statement   m_shouldFlush = false;     in the setWriter(Writer) method of SerializerToXML class.

              b) In the flushWriter() method, the member 'm_shouldFlush ' is checked before flushing the underlying writer 
       added the 'if(m_shouldFlush)' in the else part of the flushWriter() method

            ii). Interms of OutputStream, the SerializerToXML.init(OutputStream, Properties) method is called to construct a writer to wrap around the OutputSream. In turns, it calls the SerializerToXML.init(Writer,Properties,boolean shouldFlush) with the 'true' value for the 'm_shouldFlush' flag, Thus the flush.

        Fix:
            The value for the 'shouldFlush' parameter is set to 'false' for the method call init(Writer,Properties,boolean) done in the SerializerToXML.init(OutputStream,Properties)


 Files - SerializerToXML.java                        package - org.apache.xalan.serialize 
  

            I would be happy if you let me know the status of the patch after review. 
  

Thanks & regards, 
- Thangadurai 
SIP Technologies & Exports Ltd.