MCPcopy
hub / github.com/OpenTSDB/opentsdb / searchForJars

Method searchForJars

src/utils/PluginLoader.java:227–244  ·  view source on GitHub ↗

Recursive method to search for JAR files starting at a given level @param file The directory to search in @param jars A list of file objects that will be loaded with discovered jar files @throws SecurityException if a security manager exists and prevents reading

(final File file, List<File> jars)

Source from the content-addressed store, hash-verified

225 * @throws SecurityException if a security manager exists and prevents reading
226 */
227 private static void searchForJars(final File file, List<File> jars) {
228 if (file.isFile()) {
229 if (file.getAbsolutePath().toLowerCase().endsWith(".jar")) {
230 jars.add(file);
231 LOG.debug("Found a jar: " + file.getAbsolutePath());
232 }
233 } else if (file.isDirectory()) {
234 File[] files = file.listFiles();
235 if (files == null) {
236 // if this is null, it's due to a security issue
237 LOG.warn("Access denied to directory: " + file.getAbsolutePath());
238 } else {
239 for (File f : files) {
240 searchForJars(f, jars);
241 }
242 }
243 }
244 }
245
246 /**
247 * Attempts to add the given file object to the class loader

Callers 1

loadJARsMethod · 0.95

Calls 1

addMethod · 0.45

Tested by

no test coverage detected