MCPcopy Index your code
hub / github.com/apache/tomcat / getLastModified

Method getLastModified

java/org/apache/jasper/compiler/TldCache.java:161–189  ·  view source on GitHub ↗
(TldResourcePath tldResourcePath)

Source from the content-addressed store, hash-verified

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;

Callers 2

TldCacheMethod · 0.95
getTaglibXmlMethod · 0.95

Calls 10

openJarMethod · 0.80
getWebappPathMethod · 0.65
getResourceMethod · 0.65
getLastModifiedMethod · 0.65
equalsMethod · 0.65
getProtocolMethod · 0.65
closeMethod · 0.65
getInputStreamMethod · 0.65
getEntryNameMethod · 0.65
openConnectionMethod · 0.45

Tested by

no test coverage detected