You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2002/06/13 20:55:39 UTC

DO NOT REPLY [Bug 9839] - Printer disregards OutputFormat line separator string

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=9839>.
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=9839

Printer disregards OutputFormat line separator string





------- Additional Comments From gmarcy@us.ibm.com  2002-06-13 18:55 -------
You need to fix the bounds check or you could get an exception when the line 
seperator crosses the buffer boundary.  Something like:

            String lineSeparator = _format.getLineSeparator();
            int lineSepLength = lineSeperator.length();

            if ( _pos + lineSepLength > BufferSize ) {
                _writer.write( _buffer );
                _pos = 0;
            }

            for ( int i = 0 ; i < lineSepLength ; i++ ) {
                _buffer[ _pos ] = lineSeparator.charAt(i);
                ++_pos;
            }

All that leaves is the unlikely possibility that lineSepLength is greater than 
BufferSize, which would require either copying in parts or putting the bounds 
check inside of the loop.

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org