(TldResourcePath tldResourcePath)
| 159 | |
| 160 | |
| 161 | private long[] getLastModified(TldResourcePath tldResourcePath) { |
| 162 | long[] result = new long[2]; |
| 163 | result[0] = -1; |
| 164 | result[1] = -1; |
| 165 | try { |
| 166 | String webappPath = tldResourcePath.getWebappPath(); |
| 167 | if (webappPath != null) { |
| 168 | // webappPath will be null for JARs containing TLDs that are on |
| 169 | // the class path but not part of the web application |
| 170 | URL url = servletContext.getResource(tldResourcePath.getWebappPath()); |
| 171 | URLConnection conn = url.openConnection(); |
| 172 | result[0] = conn.getLastModified(); |
| 173 | if ("file".equals(url.getProtocol())) { |
| 174 | // Reading the last modified time opens an input stream so we |
| 175 | // need to make sure it is closed again otherwise the TLD file |
| 176 | // will be locked until GC runs. |
| 177 | conn.getInputStream().close(); |
| 178 | } |
| 179 | } |
| 180 | try (Jar jar = tldResourcePath.openJar()) { |
| 181 | if (jar != null) { |
| 182 | result[1] = jar.getLastModified(tldResourcePath.getEntryName()); |
| 183 | } |
| 184 | } |
| 185 | } catch (IOException ignore) { |
| 186 | // Ignore (shouldn't happen) |
| 187 | } |
| 188 | return result; |
| 189 | } |
| 190 | |
| 191 | private static class TaglibXmlCacheEntry { |
| 192 | private volatile TaglibXml taglibXml; |
no test coverage detected