Bump classgraph from 4.2.9 to 4.2.12 (#133)

* Bump classgraph from 4.2.9 to 4.2.12

Bumps [classgraph](https://github.com/classgraph/classgraph) from 4.2.9 to 4.2.12.
- [Release notes](https://github.com/classgraph/classgraph/releases)
- [Commits](https://github.com/classgraph/classgraph/commits)

Signed-off-by: dependabot[bot] <support@dependabot.com>

* Use try-with-resources to close ClassGraph's ScanResult

ClassGraph 4.2.10 highlighted the need to close the ScanResult over depending on
automated methods.

* [changelog] updated
This commit is contained in:
dependabot[bot] 2018-10-11 07:32:54 +01:00 committed by Paul Campbell
parent 007738b1eb
commit 2732c2ca47
3 changed files with 20 additions and 10 deletions

View file

@ -7,7 +7,7 @@ CHANGELOG
* Bump mockito-core from 2.22.0 to 2.23.0 (#129)
* Bump kemitix-parent from 5.1.1 to 5.2.0 (#130)
* [jenkins] Don't use verify profile with clean phase (#131)
* Bump classgraph from 4.2.8 to 4.2.9 (#132)
* Bump classgraph from 4.2.8 to 4.2.12 (#132)(#133)
5.1.0
-----

View file

@ -32,7 +32,7 @@
<mockito.version>2.23.0</mockito.version>
<assertj.version>3.11.1</assertj.version>
<conditional.version>0.7.0</conditional.version>
<classgraph.version>4.2.9</classgraph.version>
<classgraph.version>4.2.12</classgraph.version>
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
<kemitix.checkstyle.ruleset.version>${project.version}</kemitix.checkstyle.ruleset.version>

View file

@ -22,6 +22,7 @@
package net.kemitix.checkstyle.ruleset.builder;
import io.github.classgraph.ClassGraph;
import io.github.classgraph.ScanResult;
import org.springframework.stereotype.Service;
import java.util.List;
@ -37,12 +38,13 @@ import java.util.stream.Collectors;
@Service
public class ClassGraphPackageScanner implements PackageScanner {
private final ClassGraph classGraph = new ClassGraph();
@Override
public final List<String> apply(final RuleSource ruleSource) {
final String basePackage = ruleSource.getBasePackage();
return new ClassGraph()
.whitelistPackages(basePackage)
.scan()
try (ScanResult scanResult = scanPackage(classGraph, basePackage)) {
return scanResult
.getAllStandardClasses()
.getNames()
.stream()
@ -50,3 +52,11 @@ public class ClassGraphPackageScanner implements PackageScanner {
.collect(Collectors.toList());
}
}
private static ScanResult scanPackage(final ClassGraph classGraph, final String basePackage) {
return classGraph
.whitelistPackages(basePackage)
.scan();
}
}