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

Method file

java/org/apache/catalina/session/FileStore.java:341–358  ·  view source on GitHub ↗

Return a File object representing the pathname to our session persistence file, if any. @param id The ID of the Session to be retrieved. This is used in the file naming.

(String id)

Source from the content-addressed store, hash-verified

339 * @param id The ID of the Session to be retrieved. This is used in the file naming.
340 */
341 private File file(String id) throws IOException {
342 File storageDir = directory();
343 if (storageDir == null) {
344 return null;
345 }
346
347 String filename = id + FILE_EXT;
348 File file = new File(storageDir, filename);
349 File canonicalFile = file.getCanonicalFile();
350
351 // Check the file is within the storage directory
352 if (!canonicalFile.toPath().startsWith(storageDir.getCanonicalFile().toPath())) {
353 log.warn(sm.getString("fileStore.invalid", file.getPath(), id));
354 return null;
355 }
356
357 return canonicalFile;
358 }
359}

Callers 3

loadMethod · 0.95
removeMethod · 0.95
saveMethod · 0.95

Calls 5

directoryMethod · 0.95
warnMethod · 0.65
getStringMethod · 0.65
getPathMethod · 0.65
startsWithMethod · 0.45

Tested by

no test coverage detected