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



    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: 1.8
    • Fix Version/s: None
    • Component/s: SVG Viewer
    • Labels:
    • Environment:
      Operating System: All
      Platform: All


      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).


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



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


              • Created: