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

[PATCH] Batik does not support missing (returning HTTP code 404) linked images from Web servers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Fixed
    • 1.8
    • None
    • SVG Viewer
    • Operating System: All
      Platform: All

    Description

      If an SVG image contains a reference to an external image that should be read from a webserver, and that webserver returns the image back with a 404 header (indicating that the desired address was not found), the contents of the response is discarded, and Batik throws an exception.

      This prevents using Apache ErrorDocument directives to have default images as the back-end.

      As there's no reason to assume that just because the response was an error we should discard the result (the response could still be a valid image), a better approach would be to catch the corresponding error when trying to read the stream and switch the ErrorStream instead.

      I've attached a patch to org.apache.util.ParsedURLData.java that supports this modification.

      Other SVG Renderers (e.g. Google Chrome, Firefox, etc.) seem to operate this way (i.e. they pull in the data from the image regardless of the status code of the response).

      Attachments

        1. Batik-Bug49889-PatchV2.patch
          0.9 kB
          Helder Magalhães
        2. Batik-Bug49889-Testcase.svg
          0.2 kB
          Helder Magalhães
        3. Batik-Bug49889-Patch.patch
          0.9 kB
          Helder Magalhães
        4. useErrorStream.patch
          0.7 kB
          Andrew Craig

        Activity

          People

            batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
            andrewsc@gmail.com Andrew Craig
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: