cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/util NetUtils.java
Date Thu, 01 Feb 2001 21:22:29 GMT
bloritsch    01/02/01 13:22:29

  Modified:    src/org/apache/cocoon/util Tag: xml-cocoon2 NetUtils.java
  Log:
  Fixed assumptions on valid URLs.  Handle psuedo-protocols first.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +8 -3      xml-cocoon/src/org/apache/cocoon/util/Attic/NetUtils.java
  
  Index: NetUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/util/Attic/NetUtils.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- NetUtils.java	2001/01/31 20:43:50	1.1.2.6
  +++ NetUtils.java	2001/02/01 21:22:25	1.1.2.7
  @@ -13,13 +13,14 @@
   import java.net.URL;
   import java.net.MalformedURLException;
   import javax.servlet.ServletContext;
  +import org.apache.log.LogKit;
   
   /**
    * A collection of <code>File</code>, <code>URL</code> and filename
    * utility methods
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.1.2.6 $ $Date: 2001/01/31 20:43:50 $
  + * @version CVS $Revision: 1.1.2.7 $ $Date: 2001/02/01 21:22:25 $
    */
   
   public class NetUtils {
  @@ -65,9 +66,13 @@
               URL u = NetUtils.context.getResource(location.substring("context://".length()));
               if (u != null) return u;
               else throw new RuntimeException(location + " could not be found. (possible
classloader problem)");
  -        } else if (location.indexOf("://") > 0) {
  +        }
  +
  +        try {
               return new URL(location);
  -        } else {
  +        } catch (MalformedURLException mue) {
  +            LogKit.getLoggerFor("cocoon").debug("Making URL a File relative to context
root", mue);
  +
               if (NetUtils.root != null) {
                   return (new File(NetUtils.root, location)).toURL();
               }
  
  
  

Mime
View raw message