You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ho...@apache.org on 2001/01/25 03:46:03 UTC

cvs commit: jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler TagLibraryInfoImpl.java

horwat      01/01/24 18:46:03

  Modified:    jasper/src/share/org/apache/jasper/compiler
                        TagLibraryInfoImpl.java
  Log:
  If real file does exist, use the context to get the resource.
  
  Revision  Changes    Path
  1.17      +11 -9     jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java
  
  Index: TagLibraryInfoImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- TagLibraryInfoImpl.java	2000/12/08 20:45:12	1.16
  +++ TagLibraryInfoImpl.java	2001/01/25 02:46:02	1.17
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v 1.16 2000/12/08 20:45:12 pierred Exp $
  - * $Revision: 1.16 $
  - * $Date: 2000/12/08 20:45:12 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/jasper/src/share/org/apache/jasper/compiler/TagLibraryInfoImpl.java,v 1.17 2001/01/25 02:46:02 horwat Exp $
  + * $Revision: 1.17 $
  + * $Date: 2001/01/25 02:46:02 $
    *
    * The Apache Software License, Version 1.1
    *
  @@ -150,15 +150,17 @@
       private InputStream getResourceAsStream(String uri) 
           throws FileNotFoundException 
       {
  -        if (uri.indexOf(":") > 0) {
  -            // may be fully qualified (Windows) or may be a URL.  Let
  -            // getResourceAsStream deal with it.
  -            return ctxt.getResourceAsStream(uri);
  -        } else {
  -            // assume it translates to a real file, and use getRealPath
  +        try {
  +            // see if file exists on the filesystem first
               String real = ctxt.getRealPath(uri);
               return (real == null) ? null : new FileInputStream(real);
           }
  +        catch (FileNotFoundException ex) {
  +            // if file not found on filesystem, get the resource through
  +            // the context
  +            return ctxt.getResourceAsStream(uri);
  +        }
  +       
       }
   
       public TagLibraryInfoImpl(JspCompilationContext ctxt, String prefix,