You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by tm...@apache.org on 2002/04/16 19:39:20 UTC
cvs commit: xml-xalan/java/src/org/apache/xalan/xsltc/compiler Include.java
tmiller 02/04/16 10:39:20
Modified: java/src/org/apache/xalan/xsltc/compiler Tag:
jaxp-ri-1_2_0-fcs-branch Include.java
Log:
bug 7835, patch from Stefan Kost to better handle
empty strings and local paths in xsl:include
Revision Changes Path
No revision
No revision
1.13.4.1 +24 -6 xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Include.java
Index: Include.java
===================================================================
RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/Include.java,v
retrieving revision 1.13
retrieving revision 1.13.4.1
diff -u -r1.13 -r1.13.4.1
--- Include.java 1 Feb 2002 20:07:08 -0000 1.13
+++ Include.java 16 Apr 2002 17:39:19 -0000 1.13.4.1
@@ -1,5 +1,5 @@
/*
- * @(#)$Id: Include.java,v 1.13 2002/02/01 20:07:08 tmiller Exp $
+ * @(#)$Id: Include.java,v 1.13.4.1 2002/04/16 17:39:19 tmiller Exp $
*
* The Apache Software License, Version 1.1
*
@@ -65,6 +65,7 @@
package org.apache.xalan.xsltc.compiler;
import java.io.File;
+import java.io.FileNotFoundException;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.Enumeration;
@@ -106,11 +107,28 @@
input = loader.loadSource(docToLoad, currLoadedDoc, xsltc);
}
else {
- File file = new File(currLoadedDoc);
- if (file.exists()) currLoadedDoc = "file:"+currLoadedDoc;
- final URL url = new URL(new URL(currLoadedDoc), docToLoad);
- docToLoad = url.toString();
- input = new InputSource(docToLoad);
+ // bug 7835, patch by Stefan Kost (s.kost@webmacher.de)
+ if ((currLoadedDoc != null) && (currLoadedDoc.length() > 0)) {
+ File file = new File(currLoadedDoc);
+ if (file.exists()) {
+ currLoadedDoc = "file:" + file.getCanonicalPath();
+ }
+ final URL url = new URL(new URL(currLoadedDoc), docToLoad);
+ docToLoad = url.toString();
+ input = new InputSource(docToLoad);
+ }
+ else {
+ File file = new File(System.getProperty("user.dir"),
+ docToLoad);
+ if (file.exists()) {
+ docToLoad = "file:" + file.getCanonicalPath();
+ }
+ else {
+ throw new FileNotFoundException(
+ "Could not load file " + docToLoad);
+ }
+ input = new InputSource(docToLoad);
+ }
}
final SyntaxTreeNode root = parser.parse(input);
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org