You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-commits@xmlgraphics.apache.org by he...@apache.org on 2010/10/06 07:44:12 UTC

svn commit: r1004896 - in /xmlgraphics/batik/trunk: CHANGES sources/org/apache/batik/util/ParsedURLData.java

Author: helder
Date: Wed Oct  6 05:44:11 2010
New Revision: 1004896

URL: http://svn.apache.org/viewvc?rev=1004896&view=rev
Log:
Feature:
  Batik does not support missing (returning HTTP code 404) linked images from Web servers
    (submitted by  Andrew Craig <an...@gmail.com>);
    (closes bug 49889).

Modified:
    xmlgraphics/batik/trunk/CHANGES
    xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java

Modified: xmlgraphics/batik/trunk/CHANGES
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/CHANGES?rev=1004896&r1=1004895&r2=1004896&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/CHANGES (original)
+++ xmlgraphics/batik/trunk/CHANGES Wed Oct  6 05:44:11 2010
@@ -33,6 +33,9 @@ Bug fixing is an on-going task, so it is
   * Allow SVGGenerator2D to embed fonts that weren't obtained from the
     standard AWT font lookup mechanism.
   * ttf2svg no longer outputs hkern elements outside user-provided glyph range.
+  * Batik now tries to access content in HTTP error responses (for example, one
+    is able to setup custom content for missing - HTTP code 404 - and/or other
+    erroneous situations).
 
 4. Bug fixes
 

Modified: xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java
URL: http://svn.apache.org/viewvc/xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java?rev=1004896&r1=1004895&r2=1004896&view=diff
==============================================================================
--- xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java (original)
+++ xmlgraphics/batik/trunk/sources/org/apache/batik/util/ParsedURLData.java Wed Oct  6 05:44:11 2010
@@ -550,7 +550,18 @@ loop2:          while (i < len) {
             postConnectionURL = urlC.getURL();
         }
 
-        return (stream = urlC.getInputStream());
+        try {
+            return (stream = urlC.getInputStream());
+        } catch (IOException e) {
+            if (urlC instanceof HttpURLConnection) {
+                // bug 49889: if available, return the error stream
+                // (allow interpretation of content in the HTTP error response)
+                return (stream = ((HttpURLConnection) urlC).getErrorStream());
+            } else {
+                throw e;
+            }
+        }
+
     }
 
     /**