tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Luehe <Jan.Lu...@Sun.COM>
Subject Re: cvs commit: jakarta-tomcat-catalina/webapps/docs changelog.xml
Date Fri, 13 May 2005 00:11:51 GMT


remm@apache.org wrote:
> remm        2005/05/12 06:01:05
> 
>   Modified:    jasper2/src/share/org/apache/jasper/servlet
>                         JspCServletContext.java
>                webapps/docs changelog.xml
>   Log:
>   - 34465: jspc without web.xml.
>   - Submitted by Yoichi Hirose.
>   
>   Revision  Changes    Path
>   1.4       +7 -1      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspCServletContext.java
>   
>   Index: JspCServletContext.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspCServletContext.java,v
>   retrieving revision 1.3
>   retrieving revision 1.4
>   diff -u -r1.3 -r1.4
>   --- JspCServletContext.java	17 Mar 2004 19:23:05 -0000	1.3
>   +++ JspCServletContext.java	12 May 2005 13:01:04 -0000	1.4
>   @@ -235,7 +235,13 @@
>            if (!path.startsWith("/"))
>                throw new MalformedURLException("Path '" + path +
>                                                "' does not start with '/'");
>   -        return (new URL(myResourceBaseURL, path.substring(1)));
>   +        URL url = new URL(myResourceBaseURL, path.substring(1));
>   +        if ("file".equals(url.getProtocol())) {
>   +            if (!(new File(url.getFile())).exists()) {
>   +                return null;
>   +            }
>   +        }
>   +        return url;
>    
>        }

I don't think this is very efficient. Normally, the resource
with the given path will exist. It is just in the case
of web.xml that it may not exist.

Why not check specifically for existence of web.xml, as follows:


Index: JspConfig.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspConfig.java,v
retrieving revision 1.18
diff -u -r1.18 JspConfig.java
--- JspConfig.java      24 Mar 2005 04:08:01 -0000      1.18
+++ JspConfig.java      13 May 2005 00:09:22 -0000
@@ -16,6 +16,7 @@

 package org.apache.jasper.compiler;

+import java.io.File;
 import java.io.InputStream;
 import java.util.Iterator;
 import java.util.Vector;
@@ -63,10 +64,12 @@

         try {
             URL uri = ctxt.getResource(WEB_XML);
-            if (uri == null) {
+            if (uri == null
+                || ("file".equals(uri.getProtocol())
+                    && !(new File(uri.getFile())).exists())) {
                // no web.xml
                 return;
-           }
+            }

             is = uri.openStream();
             InputSource ip = new InputSource(is);


Jan




Jan


>   
>   
>   
>   1.308     +7 -0      jakarta-tomcat-catalina/webapps/docs/changelog.xml
>   
>   Index: changelog.xml
>   ===================================================================
>   RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
>   retrieving revision 1.307
>   retrieving revision 1.308
>   diff -u -r1.307 -r1.308
>   --- changelog.xml	11 May 2005 21:39:41 -0000	1.307
>   +++ changelog.xml	12 May 2005 13:01:04 -0000	1.308
>   @@ -153,6 +153,10 @@
>            default encoding. A side effect of this fix is that the bodies of POST requests
that
>            require FORM authentication are now buffered and made available after a sucessful
login. (markt)
>          </fix>
>   +      <fix>
>   +        <bug>34840</bug>: Better handling of external WARs redeployment,
and ignore docBase specified
>   +        in context file if within the Host appBase (remm)
>   +      </fix>
>        </changelog>
>      </subsection>
>      
>   @@ -199,6 +203,9 @@
>            <bug>34652</bug>: Add the ability to get SMAPs when precompiling,
submitted by
>            Daryl Robbins (remm)
>          </update>
>   +      <fix>
>   +        <bug>34465</bug>: Jspc failure if there is no web.xml, submitted
by Yoichi Hirose (remm)
>   +      </fix>
>        </changelog>
>      </subsection>
>      
>   
>   
>   
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message