import java.io.File;
import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.JarURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
+import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
return jspUri;
}
+ public long getJspLastModified() {
+ long result = -1;
+ URLConnection uc = null;
+ try {
+ URL jspUrl = getResource(getJspFile());
+ if (jspUrl == null) {
+ incrementRemoved();
+ return result;
+ }
+ uc = jspUrl.openConnection();
+ if (uc instanceof JarURLConnection) {
+ result = ((JarURLConnection) uc).getJarEntry().getTime();
+ } else {
+ result = uc.getLastModified();
+ }
+ } catch (IOException e) {
+ if (log.isDebugEnabled()) {
+ log.debug(Localizer.getMessage(
+ "jsp.error.lastModified", getJspFile()), e);
+ }
+ result = -1;
+ } finally {
+ if (uc != null) {
+ try {
+ uc.getInputStream().close();
+ } catch (IOException e) {
+ if (log.isDebugEnabled()) {
+ log.debug(Localizer.getMessage(
+ "jsp.error.lastModified", getJspFile()), e);
+ }
+ result = -1;
+ }
+ }
+ }
+ return result;
+ }
+
public boolean isTagFile() {
return isTagFile;
}
*/
public boolean isOutDated(boolean checkClass) {
- String jsp = ctxt.getJspFile();
-
if (jsw != null
&& (ctxt.getOptions().getModificationTestInterval() > 0)) {
jsw.setLastModificationTest(System.currentTimeMillis());
}
- long jspRealLastModified = 0;
- try {
- URL jspUrl = ctxt.getResource(jsp);
- if (jspUrl == null) {
- ctxt.incrementRemoved();
- return true;
- }
- URLConnection uc = jspUrl.openConnection();
- if (uc instanceof JarURLConnection) {
- jspRealLastModified =
- ((JarURLConnection) uc).getJarEntry().getTime();
- } else {
- jspRealLastModified = uc.getLastModified();
- }
- uc.getInputStream().close();
- } catch (Exception e) {
- if (log.isDebugEnabled())
- log.debug("Problem accessing resource. Treat as outdated.", e);
+ long jspRealLastModified = ctxt.getJspLastModified();
+ if (jspRealLastModified < 0) {
+ // Something went wrong - assume modification
return true;
}
jsp.error.unbalanced.endtag=The end tag \"</{0}\" is unbalanced
jsp.error.invalid.bean=The value for the useBean class attribute {0} is invalid.
jsp.error.prefix.use_before_dcl=The prefix {0} specified in this tag directive has been previously used by an action in file {1} line {2}.
+jsp.error.lastModified=Unable to determine last modified date for file [{0}]
jsp.exception=An exception occurred processing JSP page {0} at line {1}
xmlParser.skipBomFail=Failed to skip BOM when parsing XML input stream
-jsp.tldCache.noTldInJar=No TLD files were found in [{0}]. Consider adding the JAR to to the tomcat.util.scan.DefaultJarScanner.jarsToSkip in CATALINA_BASE/catalina.properties
\ No newline at end of file
+jsp.tldCache.noTldInJar=No TLD files were found in [{0}]. Consider adding the JAR to to the tomcat.util.scan.DefaultJarScanner.jarsToSkip in CATALINA_BASE/catalina.properties