santiagopg 2002/08/12 12:31:32
Modified: java/src/org/apache/xalan/xsltc/dom LoadDocument.java
Log:
Use unmodified URI when retrieving the document via the DOM cache.
Revision Changes Path
1.12 +23 -14
xml-xalan/java/src/org/apache/xalan/xsltc/dom/LoadDocument.java
Index: LoadDocument.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/LoadDocument.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- LoadDocument.java 31 Oct 2001 07:29:39 -0000 1.11
+++ LoadDocument.java 12 Aug 2002 19:31:32 -0000 1.12
@@ -62,8 +62,9 @@
package org.apache.xalan.xsltc.dom;
-import java.io.File;
import java.net.URL;
+import java.io.File;
+import java.io.FileNotFoundException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
@@ -90,22 +91,24 @@
*/
public static NodeIterator document(String uri, String base,
AbstractTranslet translet, DOM dom)
- throws Exception {
-
+ throws Exception
+ {
+ final String originalUri = uri;
MultiDOM multiplexer = (MultiDOM)dom;
// Return an empty iterator if the URI is clearly invalid
// (to prevent some unncessary MalformedURL exceptions).
- if ((uri == null) || (uri.equals("")))
- return(new SingletonIterator(DOM.NULL,true));
+ if (uri == null || uri.equals("")) {
+ return new SingletonIterator(DOM.NULL,true);
+ }
// Prepend URI base to URI (from context)
- if ((base != null) && (!base.equals(""))) {
- if ((!uri.startsWith(base)) && // unless URI contains base
- (!uri.startsWith("/")) && // unless URI is abs. file path
- (!uri.startsWith("http:/")) && // unless URI is abs. http URL
- (!uri.startsWith("file:/"))) { // unless URI is abs. file URL
- uri = base+uri;
+ if (base != null && !base.equals("")) {
+ if (!uri.startsWith(base) && // unless URI contains base
+ !uri.startsWith("/") && // unless URI is abs. file path
+ !uri.startsWith("http:/") && // unless URI is abs. http URL
+ !uri.startsWith("file:/")) { // unless URI is abs. file URL
+ uri = base + uri;
}
}
@@ -128,7 +131,11 @@
mask = multiplexer.nextMask(); // peek
if (cache != null) {
- newdom = cache.retrieveDocument(uri, mask, translet);
+ newdom = cache.retrieveDocument(originalUri, mask, translet);
+ if (newdom == null) {
+ final Exception e = new FileNotFoundException(originalUri);
+ throw new TransletException(e);
+ }
}
else {
// Parse the input document and construct DOM object
@@ -247,8 +254,10 @@
throw new IllegalArgumentException(err);
}
}
+ catch (TransletException e) {
+ throw e;
+ }
catch (Exception e) {
- e.printStackTrace();
throw new TransletException(e);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]