Details
-
Bug
-
Status: Resolved
-
Resolution: Fixed
-
1.8
-
None
-
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).