[jira] [Created] (BATIK-1287) BridgeException for SVGs with clip-path="url(...)" in JAR files

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Created] (BATIK-1287) BridgeException for SVGs with clip-path="url(...)" in JAR files

Simon Steiner (Jira)
Silviu Julean created BATIK-1287:
------------------------------------

             Summary: BridgeException for SVGs with clip-path="url(...)" in JAR files
                 Key: BATIK-1287
                 URL: https://issues.apache.org/jira/browse/BATIK-1287
             Project: Batik
          Issue Type: Bug
          Components: SVG DOM
    Affects Versions: 1.13
            Reporter: Silviu Julean


BATIK-1127 was fixed (in FOP-2489) by modifying {{ParsedURLDefaultProtocolHandler}}.

No fix was applied to {{ParsedURLJarProtocolHandler}}, therefore the issue still reproduces with SVG files inside of JAR files.

*Steps to reproduce*

1. Embed a SVG file with an anchor clip path inside a JAR file.
 2. Parse the document:
{noformat}
new SAXSVGDocumentFactory(parser).createDocument("jar:file:/outerpath/app.jar!/innerpath/file.svg", inputStream);{noformat}
3. Transcode it to PDF using FOP:
{noformat}
new PDFTranscoder().transcode(new TranscoderInput(document), ...);{noformat}
*Expected results*

The PDF file is generated as it would be if the document URL was a not a JAR url.

*Actual results*

The anchor URL incorrectly resolves to:
{noformat}
jar:file:/outerpath/app.jar!/innerpath/#anchor-id{noformat}
Note the missing SVG file name.

{{batik-bridge}} then attempts to load an SVG document with this URL, resulting in a {{TranscoderException}} caused by a "Premature end of file" {{EOFException}}.

*Workaround*

1. Make a copy of {{ParsedURLJarProtocolHandler}}. The copy must still extend {{ParsedURLDefaultProtocolHandler}}.
 2. At the beginning of {{parseURL}}, return {{super.parseUrl(baseURL, urlStr)}} if the {{urlStr}} starts with "#".
 3. Create {{META-INF/services/org.apache.batik.util.ParsedURLProtocolHandler}} containing the full class name of the patched class.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]