xalan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mm...@apache.org
Subject cvs commit: xml-xalan/java/src/org/apache/xml/utils SystemIDResolver.java
Date Thu, 09 Aug 2001 18:32:55 GMT
mmidy       01/08/09 11:32:55

  Modified:    java/src/org/apache/xalan/processor
                        TransformerFactoryImpl.java
               java/src/org/apache/xalan/transformer
                        TransformerIdentityImpl.java
               java/src/org/apache/xml/utils SystemIDResolver.java
  Log:
  Fix code to handle absolute paths from unix systems. This fix is part of an ongoing process
and is just meant to fix a few pending bugs. More changes are expected in this area.
  
  Revision  Changes    Path
  1.39      +7 -3      xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java
  
  Index: TransformerFactoryImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/processor/TransformerFactoryImpl.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- TransformerFactoryImpl.java	2001/07/28 00:25:57	1.38
  +++ TransformerFactoryImpl.java	2001/08/09 18:32:55	1.39
  @@ -827,9 +827,13 @@
         try
         {
           String currentDir = System.getProperty("user.dir");
  -
  -        baseID = "file:///" + currentDir + java.io.File.separatorChar
  -                 + source.getClass().getName();
  +        
  +        if (currentDir.startsWith(java.io.File.separator))
  +          baseID = "file://" + currentDir + java.io.File.separatorChar
  +                   + source.getClass().getName();
  +        else
  +          baseID = "file:///" + currentDir + java.io.File.separatorChar
  +                   + source.getClass().getName();
         }
         catch (SecurityException se)
         {
  
  
  
  1.18      +4 -1      xml-xalan/java/src/org/apache/xalan/transformer/TransformerIdentityImpl.java
  
  Index: TransformerIdentityImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerIdentityImpl.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- TransformerIdentityImpl.java	2001/07/28 00:25:58	1.17
  +++ TransformerIdentityImpl.java	2001/08/09 18:32:55	1.18
  @@ -244,7 +244,10 @@
   
             if (fileURL.startsWith("file:///"))
             {
  -            fileURL = fileURL.substring(8);
  +            if (fileURL.substring(8).indexOf(":") >0)
  +              fileURL = fileURL.substring(8);
  +            else 
  +              fileURL = fileURL.substring(7);
             }
   
             m_outputStream = new java.io.FileOutputStream(fileURL);
  
  
  
  1.10      +37 -10    xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java
  
  Index: SystemIDResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/utils/SystemIDResolver.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- SystemIDResolver.java	2001/06/12 19:16:00	1.9
  +++ SystemIDResolver.java	2001/08/09 18:32:55	1.10
  @@ -90,10 +90,15 @@
   
       if (null != curdir)
       {
  -                        if (uri != null)
  -                                uri = "file:///" + curdir + System.getProperty("file.separator")
+ uri;
  -                        else
  -                                uri = "file:///" + curdir + System.getProperty("file.separator");
  +      String base;
  +      if (curdir.startsWith(File.separator))
  +        base = "file://" + curdir;
  +      else
  +        base = "file:///" + curdir;
  +      if (uri != null)
  +        uri = base + System.getProperty("file.separator") + uri;
  +      else
  +        uri = base + System.getProperty("file.separator");
       }
   
       if (null != uri && (uri.indexOf('\\') > -1))
  @@ -113,10 +118,18 @@
     public static String getAbsoluteURI(String url)
             throws TransformerException
     {
  -    if (url.indexOf(':') < 0)
  +    if (url.startsWith(".."))
  +      url = new File(url).getAbsolutePath();
  +    if (url.startsWith(File.separator))
  +      url = "file://" + url;
  +    else if (url.indexOf(':') < 0)
       {
         url = getAbsoluteURIFromRelative(url);
       }
  +    else if (url.startsWith("file:") && url.charAt(5) != '/') 
  +    {
  +      url = getAbsoluteURIFromRelative(url.substring(5));
  +    }
       return url;
     }
   
  @@ -134,8 +147,22 @@
             throws TransformerException
     {
       boolean isAbsouteUrl = false;
  -    if (urlString.indexOf(':') > 0)
  -            isAbsouteUrl = true;
  +    boolean needToResolve = false;
  +    
  +    if (urlString.startsWith("..") && base == null)
  +      urlString = new File(urlString).getAbsolutePath();
  +    
  +    if(urlString.startsWith("file:") && urlString.charAt(5) != '/') 
  +    {
  +      needToResolve = true;
  +    }
  +    else if (urlString.indexOf(':') > 0)
  +      isAbsouteUrl = true;
  +    else if (urlString.startsWith(File.separator))
  +    {
  +      urlString = "file://" + urlString;
  +      isAbsouteUrl = true;
  +    }
   
       if ((!isAbsouteUrl) && ((null == base)
               || (base.indexOf(':') < 0)))
  @@ -144,8 +171,8 @@
       }
   
       // bit of a hack here.  Need to talk to URI person to see if this can be fixed.
  -    if ((null != base) && urlString.startsWith("file:")
  -            && (urlString.charAt(5) != '/'))
  +    if ((null != base) && needToResolve) 
  +         
       {
         if(base.equals(urlString))
         {
  @@ -154,7 +181,7 @@
         else
         {
           urlString = urlString.substring(5);
  -                                isAbsouteUrl = false;
  +        isAbsouteUrl = false;
         }
       }   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org


Mime
View raw message