Permalink
Browse files

Attempt to make jar: URIs work correctly.

  • Loading branch information...
1 parent 453c166 commit 59eaa4de21a81b4eeb949abb870a4728a6af6c26 @ndw committed Feb 12, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/com/xmlcalabash/util/XProcURIResolver.java
@@ -22,8 +22,10 @@
import com.xmlcalabash.core.XProcConstants;
import com.xmlcalabash.core.XProcRuntime;
+import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URL;
import java.util.Hashtable;
import java.util.logging.Logger;
import java.io.IOException;
@@ -88,7 +90,17 @@ public Source resolve(String href, String base) throws TransformerException {
}
if (uriResolver != null) {
- Source resolved = uriResolver.resolve(href, base);
+ URL absoluteURI = null;
+
+ // This is an attempt to deal with jar: URIs, pipelines run from inside jar files.
+ try {
+ absoluteURI = new URL(new URL(base), href);
+ } catch (MalformedURLException mue) {
+ throw new XProcException(mue);
+ }
+
+ Source resolved = uriResolver.resolve(absoluteURI.toString(), base);
+
// FIXME: This is a grotesque hack. This is wrong. Wrong. Wrong.
// To support caching, XMLResolver (xmlresolver.org) returns a Source even when it hasn't
// found the resource. Problem is, it doesn't setup the entity resolver correctly for that

0 comments on commit 59eaa4d

Please sign in to comment.