From a57ee7d5c88fe5d7ad2b7b1d5c5f99a5024be296 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 16 Apr 2007 20:06:58 +0000 Subject: 2007-04-16 Chris Burdess * gnu/xml/stream/XMLParser.java: Work around a problem with incorrectly formatted file URLs. --- ChangeLog | 5 +++++ gnu/xml/stream/XMLParser.java | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dde32feb8..a71f175a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-04-16 Chris Burdess + + * gnu/xml/stream/XMLParser.java: Work around a problem with + incorrectly formatted file URLs. + 2007-04-11 Christian Thalinger * configure.ac: Added AC_C_INLINE. diff --git a/gnu/xml/stream/XMLParser.java b/gnu/xml/stream/XMLParser.java index 663a300f8..fae4afec8 100644 --- a/gnu/xml/stream/XMLParser.java +++ b/gnu/xml/stream/XMLParser.java @@ -439,6 +439,7 @@ public class XMLParser throw e2; } } + systemId = canonicalize(systemId); pushInput(new Input(in, null, null, systemId, null, null, false, true)); } @@ -513,6 +514,7 @@ public class XMLParser throw e2; } } + systemId = canonicalize(systemId); pushInput(new Input(null, reader, null, systemId, null, null, false, true)); } @@ -1540,7 +1542,7 @@ public class XMLParser { if (!externalEntities) return; - String url = absolutize(input.systemId, ids.systemId); + String url = canonicalize(absolutize(input.systemId, ids.systemId)); // Check for recursion for (Iterator i = inputStack.iterator(); i.hasNext(); ) { @@ -1586,6 +1588,20 @@ public class XMLParser this.input = input; } + /** + * Returns a canonicalized version of the specified URL. + * This is largely to work around a problem with the specification of + * file URLs. + */ + static String canonicalize(String url) + { + if (url == null) + return null; + if (url.startsWith("file:") && !url.startsWith("file://")) + url = "file://" + url.substring(5); + return url; + } + /** * "Absolutize" a URL. This resolves a relative URL into an absolute one. * @param base the current base URL -- cgit v1.2.1