[jira] [Commented] (BATIK-1246) [PATCH] PrettyPrinter fails when removing DOCTYPE with internal DTD

"Pablo Oyhenard (JIRA)" <[email protected]> Thu, 11 Apr 2019 19:11:00 +0000 (UTC)
Newsgroups gmane.text.xml.batik.devel
Message-ID <[email protected]>
    [ https://issues.apache.org/jira/browse/BATIK-1246?page=3Dcom.atlassian=
.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D1681=
5726#comment-16815726 ]=20

Pablo Oyhenard commented on BATIK-1246:
---------------------------------------

Hey [~ssteiner1], we're hoping to get this fix in. Can you let us know if t=
here's any update? Thx!

> [PATCH] PrettyPrinter fails when removing DOCTYPE with internal DTD
> -------------------------------------------------------------------
>
>                 Key: BATIK-1246
>                 URL: https://issues.apache.org/jira/browse/BATIK-1246
>             Project: Batik
>          Issue Type: Bug
>    Affects Versions: 1.10
>            Reporter: Gustavo Juan Cairo
>            Priority: Critical
>              Labels: patch, pull-request-available
>
> This change fixes a bug with PrettyPrinter where, if the `DOCTYPE_REMOVE`=
 option is passed and there is an internal DTD (square brackets) in the DOC=
TYPE, an exception will always be (incorrectly) thrown.
> I found this while using the `SVGTranscoder` and passing the hint `KEY_DO=
CTYPE` with value `VALUE_DOCTYPE_REMOVE`. Calling `transcode()` on it fails=
 because of the PrettyPrinter bug. As a consequence, this bug essentially r=
enders the SGV Transcoder useless in some scenarios.
> [You can find the Pull Request here.|https://github.com/apache/batik/pull=
/16]
> =C2=A0
> +Replication steps+
>  # Create an SVGTranscoder
>  # Add a transcoding hint: (KEY_DOCTYPE, VALUE_DOCTYPE_REMOVE)
>  # Transcode using an SVG with an internal DTD in the DOCTYPE
>  # Notice an exception with description "end" is incorrectly thrown.
> The following snippet could be used to replicate this:
> {code:java}
> import org.apache.batik.transcoder.TranscoderInput
> import org.apache.batik.transcoder.TranscoderOutput
> import org.apache.batik.transcoder.svg2svg.SVGTranscoder
> String svg =3D "<!DOCTYPE svg [<!ENTITY test \"TEST\">]><svg xmlns=3D\"ht=
tp://www.w3.org/2000/svg\"></svg>"
> StringWriter stringWriter =3D new StringWriter();
> TranscoderInput input =3D new TranscoderInput(new StringReader(svg));
> TranscoderOutput output =3D new TranscoderOutput(stringWriter);
> SVGTranscoder svgTranscoder =3D new SVGTranscoder();
> svgTranscoder.addTranscodingHint(SVGTranscoder.KEY_DOCTYPE, SVGTranscoder=
.VALUE_DOCTYPE_REMOVE);
> svgTranscoder.transcode(input, output);
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)