cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lai, Harry" <H...@coremetrics.com>
Subject RE: [Possible Bug] TextSerializer loses characters with ASCII enc oding?
Date Wed, 03 Jul 2002 14:12:30 GMT
Hi all,

So I _think_ I've fixed this bug.  In the AbstractTextSerializer, the
setOutputStream method wraps the incoming output stream in a
BufferedOutputStream.  However, no class reference is kept to this BOS, so
it never gets flushed at the end of the document.  I made the BOS a class
variable (instead of a local method variable), and added an endDocument()
implementation that flushes the BOS and sets it to null (and then invokes
the superclass's endDocument() method).  This seems to fix the problem.

What I still don't understand, though, is why this only occurred when I used
the ASCII encoding.  I'm guessing this is because I don't fully understand
how the serializers handle encoding, but if anyone can provide some
insights, that would be great.  Thanks!

Harry



-----Original Message-----
From: Lai, Harry [mailto:HLai@coremetrics.com]
Sent: Tuesday, July 02, 2002 2:30 PM
To: 'cocoon-users@xml.apache.org'
Subject: RE: [Possible Bug] TextSerializer loses characters with ASCII
enc odin g?


I should also mention that I'm using Saxon 6.5 as my XSLT engine.

Harry

-----Original Message-----
From: Lai, Harry [mailto:HLai@coremetrics.com]
Sent: Tuesday, July 02, 2002 2:19 PM
To: 'Cocoon Users'
Subject: [Possible Bug] TextSerializer loses characters with ASCII
encodin g?


Hi folks,

I'm seeing some really odd behavior with serializers, and wanted to see if
anyone had seen this before (or better yet) knows what's causing this.  =)

PROBLEM:
If I set an XML, HTML, or Text serializer's encoding to ASCII, I end up
losing the tail end of my output (roughly 1-1000 characters).  I think it
has to do with the buffered output stream not being properly closed/flushed,
but I'm not sure.

ENVIRONMENT:
Cocoon 2.0.2 running on JBoss 2.4.5 with Tomcat 4.0.3.  Win2k.

WORKAROUNDS:
I can make this problem go away by doing either of the following:
  1. Change the encoding to UTF-8 or ISO-8859-1.
  2. Change the buffer-size to 1 (tried with values from 1-2048;
     was still seeing the problem with values as low as 10).

REPRODUCING THE BUG:
>From what I'm seeing, you can reproduce this bug by having a reasonably
large buffer (larger than 10 bytes) and switching any TextSerializer-based
serializer's encoding to ASCII.  Here's a sample from my sitemap:

	<map:serializer name="css" mime-type="text/css"
logger="sitemap.serializer.css"
                    src="org.apache.cocoon.serialization.TextSerializer"
                    pool-max="64" pool-min="16" pool-grow="4">
		<buffer-size>2048</buffer-size>
		<encoding>ASCII</encoding>
	</map:serializer>

Any thoughts, suggestions, ideas, etc. would be greatly appreciated.
Thanks!

Harry

PS  The main reason this comes up is for a dynamic css pipeline, which I'd
like to be character set agnostic (hence, the ASCII encoding).  I only
tested it with the HTML and XML serializer to make sure it wasn't something
specific to my css pipeline.

-------------- 
Harry Lai 
hlai@coremetrics.com 
512.682.1101 x2170 

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail:   <cocoon-users-help@xml.apache.org>


Mime
View raw message