Hi Susan,

Might help if you showed what your ContentHandler is doing and perhaps also
how you're setting up and invoking the parser. There are some fairly common
usage errors, for example assuming that contiguous text will always be
returned in a single call to characters() [1], that could result in your
application behaving strangely.

Thanks.

[1] http://xerces.apache.org/xerces2-j/faq-sax.html#faq-2

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrgla...@ca.ibm.com
E-mail: mrgla...@apache.org

"Susan J. Barretta" <barre...@mii.ucla.edu> wrote on 10/05/2009 03:21:56
PM:

> Hi everybody,
>
> I am following the bug-reporting instructions at
> http://xerces.apache.org/xerces2-j/jira.html  and just want to be
> sure this is not already a known bug.
> It seems that when I use xercesImpl.jar in conjunction with Commons
> Codec I end up with corrupted images.
>
> I have code that reads base64 encoded data via a sql connection and
> then uses the commons-codec to generate the image and write out the
> file.  What comes out of SQL is actually XML, so the ASCII streams
> get written to an output stream which then gets connected to an input
> stream which serves as an InputSource to a SAX XML parser.  The parse
> chugs along just fine.
>
> In my original version of this code I did not encounter the problem
> initially because from the characters() method of the parser, I was
> simply writing the characters to a temporary hard disk file.  Then
> the next part of my code read that temporary file as input and
> generated the image as file output.  I wanted to change my code to
> avoid having to do the extra file I/O.
>
> It turns out that the image that revealed the problem I am having is
> an odd number of decoded bytes.  When I have xercesImpl.jar in my
> classpath either one byte too many gets written out ( 272718, using
> commons-codec-1.4.jar) or one byte too few gets written out (272716,
> commons-codec-1.3.jar).  If I take out xercesImpl.jar from my
> classpath and just default to whatever is in Java 1.6, I get the
> correct number of bytes (272717), no matter which version of
> commons-codec that I use.
>
> I tried three difference xercesImpl.jar versions and the problem
> still occurs.  It doesn't matter whether I use byte array streams or
> piped streams in my code, I get the same problem.
>
> This sounds like some kind of weird memory alignment problem with an
> odd number of bytes.
>
> Thanks in advance,
> Susan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
> For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to