https://issues.apache.org/bugzilla/show_bug.cgi?id=51745

             Bug #: 51745
           Summary: getLastModified of compilation context returns 0 on
                    Android and it issues all time recompilation
           Product: Tomcat 7
           Version: 7.0.20
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Jasper
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: metricstr...@gmail.com
    Classification: Unclassified


URLConnection implementation 
org.apache.harmony.luni.internal.net.www.protocol.file.FileURLConnection
returns 0 for getLastModified and it breaks normal working of the wrapper
method in compilation context. It seems happens on Android platfrom 2.1 and can
happen for other. So I modified the method to avoid the problem like below:

try {
            URL jspUrl = getResource(resource);
            if (jspUrl == null) {
                incrementRemoved();
                return Long.valueOf(result);
            }
            File resFile = new File(jspUrl.getFile()); // TJWS on Android
            if (resFile.exists()) {
                result = resFile.lastModified();
            } else {
                uc = jspUrl.openConnection();
                if (uc instanceof JarURLConnection) {
                    result = ((JarURLConnection) uc).getJarEntry().getTime();
                } else {
                    result = uc.getLastModified();
                }
            }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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

Reply via email to