tmiller     02/04/16 11:35:30

  Modified:    java/src/org/apache/xalan/xsltc/compiler Include.java
  Log:
  bug 7835, integrated patch by Stefan Kost which
  better handles empty strings and local paths in xsl:include
  
  Revision  Changes    Path
  1.14      +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.14
  diff -u -r1.13 -r1.14
  --- Include.java      1 Feb 2002 20:07:08 -0000       1.13
  +++ Include.java      16 Apr 2002 18:35:30 -0000      1.14
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: Include.java,v 1.13 2002/02/01 20:07:08 tmiller Exp $
  + * @(#)$Id: Include.java,v 1.14 2002/04/16 18:35:30 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 ([EMAIL PROTECTED])
  +                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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to