summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2007-04-16 20:06:58 +0000
committerMark Wielaard <mark@klomp.org>2007-04-16 20:06:58 +0000
commita57ee7d5c88fe5d7ad2b7b1d5c5f99a5024be296 (patch)
treee359893ad30a31d249061d39cb89c921eecf1bfa
parent8757c83d40abdab30ee1436cc3944ed6aa3fc9c0 (diff)
downloadclasspath-a57ee7d5c88fe5d7ad2b7b1d5c5f99a5024be296.tar.gz
2007-04-16 Chris Burdess <dog@gnu.org>
* gnu/xml/stream/XMLParser.java: Work around a problem with incorrectly formatted file URLs.
-rw-r--r--ChangeLog5
-rw-r--r--gnu/xml/stream/XMLParser.java18
2 files changed, 22 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index dde32feb8..a71f175a6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-04-16 Chris Burdess <dog@gnu.org>
+
+ * gnu/xml/stream/XMLParser.java: Work around a problem with
+ incorrectly formatted file URLs.
+
2007-04-11 Christian Thalinger <twisti@complang.tuwien.ac.at>
* 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(); )
{
@@ -1587,6 +1589,20 @@ public class XMLParser
}
/**
+ * 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
* @param href the (absolute or relative) URL to resolve