@Test void unknown_pmd_ruleset() { when(pmdConfiguration.dumpXmlRuleSet(eq(PmdConstants.REPOSITORY_KEY), anyString())).thenReturn(new File("unknown")); DefaultInputFile srcFile = file("src/Class.java", Type.MAIN); fileSystem.add(srcFile); final Throwable thrown = catchThrowable(() -> pmdExecutor.execute()); assertThat(thrown) .isInstanceOf(IllegalStateException.class) .hasCauseInstanceOf(RuleSetNotFoundException.class); }
public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; }
PmdExecutor { public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; } }
PmdExecutor { public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; } PmdExecutor(FileSystem fileSystem, ActiveRules rulesProfile,
                       PmdConfiguration pmdConfiguration, JavaResourceLocator javaResourceLocator, Configuration settings); }
PmdExecutor { public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; } PmdExecutor(FileSystem fileSystem, ActiveRules rulesProfile,
                       PmdConfiguration pmdConfiguration, JavaResourceLocator javaResourceLocator, Configuration settings); Report execute(); }
PmdExecutor { public Report execute() { final Profiler profiler = Profiler.create(LOGGER).startInfo("Execute PMD " + PMDVersion.VERSION); final ClassLoader initialClassLoader = Thread.currentThread().getContextClassLoader(); try (URLClassLoader classLoader = createClassloader()) { Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); return executePmd(classLoader); } catch (IOException e) { LOGGER.error("Failed to close URLClassLoader.", e); } finally { Thread.currentThread().setContextClassLoader(initialClassLoader); profiler.stopInfo(); } return null; } PmdExecutor(FileSystem fileSystem, ActiveRules rulesProfile,
                       PmdConfiguration pmdConfiguration, JavaResourceLocator javaResourceLocator, Configuration settings); Report execute();  }