amiro       01/07/17 08:27:49

  Modified:    java/src/org/apache/xalan/xsltc/dom DocumentCache.java
  Log:
  Submitted by: Tom Amiro
  Fixes bug 1591. Changed the lastModified() method to return
  the correct timestamp for local files beginnig with the "file:"
  protocol. Incorporated Brian Ewin's suggestion to use URLdecode.
  Todd Miller and Morten Jorgensen
  
  Revision  Changes    Path
  1.4       +9 -1      xml-xalan/java/src/org/apache/xalan/xsltc/dom/DocumentCache.java
  
  Index: DocumentCache.java
  ===================================================================
  RCS file: 
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DocumentCache.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DocumentCache.java        2001/07/16 09:06:35     1.3
  +++ DocumentCache.java        2001/07/17 15:27:44     1.4
  @@ -1,5 +1,5 @@
   /*
  - * @(#)$Id: DocumentCache.java,v 1.3 2001/07/16 09:06:35 morten Exp $
  + * @(#)$Id: DocumentCache.java,v 1.4 2001/07/17 15:27:44 amiro Exp $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -66,6 +66,7 @@
   import java.io.File;
   import java.io.IOException;
   import java.net.URL;
  +import java.net.URLDecoder;
   import java.net.URLConnection;
   import java.net.MalformedURLException;
   import java.util.Hashtable;
  @@ -228,6 +229,13 @@
            URL url = new URL(uri);
            URLConnection connection = url.openConnection();
            long timestamp = connection.getLastModified();
  +         // Check for a "file:" URI (courtesy of Brian Ewins)
  +         if (timestamp == 0){ // get 0 for local URI
  +             if ("file".equals(url.getProtocol())){
  +                 File localfile = new File(URLDecoder.decode(url.getFile()));
  +                 timestamp = localfile.lastModified();
  +             }
  +         }
            return(timestamp);
        }
        catch (MalformedURLException e) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to