Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-1287

BridgeException for SVGs with clip-path="url(...)" in JAR files

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.13
    • Fix Version/s: None
    • Component/s: SVG DOM
    • Labels:
      None

      Description

      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:

      new SAXSVGDocumentFactory(parser).createDocument("jar:file:/outerpath/app.jar!/innerpath/file.svg", inputStream);

      3. Transcode it to PDF using FOP:

      new PDFTranscoder().transcode(new TranscoderInput(document), ...);

      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:

      jar:file:/outerpath/app.jar!/innerpath/#anchor-id

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              sjulean Silviu Julean
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: