use of org.apache.tomcat.JarScannerCallback in project sonarqube by SonarSource.
the class NullJarScannerTest method does_nothing.
@Test
public void does_nothing() {
ServletContext context = mock(ServletContext.class);
JarScannerCallback callback = mock(JarScannerCallback.class);
NullJarScanner scanner = new NullJarScanner();
scanner.scan(JarScanType.PLUGGABILITY, context, callback);
verifyZeroInteractions(context, callback);
scanner.setJarScanFilter(mock(JarScanFilter.class));
assertThat(scanner.getJarScanFilter()).isNull();
}
use of org.apache.tomcat.JarScannerCallback in project tomee by apache.
the class TomEEJarScanner method doScan.
private void doScan(final JarScanType scanType, final JarScannerCallback callback, final Deque<URL> urls) {
Method process = null;
final boolean scanAllDirectories = isScanAllDirectories();
for (final URL url : urls) {
final File cpe = URLs.toFile(url);
if ((cpe.getName().endsWith(".jar") || scanType == JarScanType.PLUGGABILITY || scanAllDirectories) && getJarScanFilter().check(scanType, cpe.getName())) {
try {
if (process == null) {
process = StandardJarScanner.class.getDeclaredMethod("process", JarScanType.class, JarScannerCallback.class, URL.class, String.class, boolean.class, Deque.class);
if (!process.isAccessible()) {
process.setAccessible(true);
}
}
process.invoke(this, scanType, callback, url, null, true, urls);
} catch (final Exception ioe) {
// no-op
}
}
}
}
Aggregations