--- Compiler.java.original 2005-03-26 14:22:46.000000000 -0700 +++ Compiler.java 2006-03-23 09:47:23.620185900 -0700 @@ -26,6 +26,7 @@ import java.net.URLConnection; import java.util.Iterator; import java.util.List; +import java.util.Map; import org.apache.jasper.JasperException; import org.apache.jasper.JspCompilationContext; @@ -368,11 +369,14 @@ return true; } - targetLastModified = targetFile.lastModified(); - if (checkClass && jsw != null) { - jsw.setServletClassLastModifiedTime(targetLastModified); - } - if (targetLastModified < jspRealLastModified) { + if (jsw != null) { + targetLastModified = jsw.getLastModified(); + } + else { + return false; + } + + if (targetLastModified != jspRealLastModified) { if( log.isDebugEnabled() ) { log.debug("Compiler: outdated: " + targetFile + " " + targetLastModified ); @@ -381,16 +385,17 @@ } // determine if source dependent files (e.g. includes using include - // directives) have been changed. - if( jsw==null ) { - return false; - } - + // directives) have been changed. List depends = jsw.getDependants(); + Map dependToLastModified = jsw.getDependantToLastModified(); if (depends == null) { return false; } - + + if (dependToLastModified == null) { + return true; + } + Iterator it = depends.iterator(); while (it.hasNext()) { String include = (String)it.next(); @@ -403,8 +408,9 @@ URLConnection includeUconn = includeUrl.openConnection(); long includeLastModified = includeUconn.getLastModified(); includeUconn.getInputStream().close(); - - if (includeLastModified > targetLastModified) { + + Long previousLastModified = (Long)dependToLastModified.get(include); + if ((previousLastModified == null) || (includeLastModified != previousLastModified.longValue())) { return true; } } catch (Exception e) {