Skip to content

Commit

Permalink
MSONAR-188 Remove explicit classloader masks and rely on the default …
Browse files Browse the repository at this point in the history
…EmbeddedScanner masks (#179)
  • Loading branch information
ADarko22 authored Sep 8, 2023
1 parent f10b0b3 commit 2791f1b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 25 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
<dependency>
<groupId>org.sonarsource.scanner.api</groupId>
<artifactId>sonar-scanner-api</artifactId>
<version>2.16.2.588</version>
<version>2.16.3.1081</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ public ScannerBootstrapper(Log log, MavenSession session, EmbeddedScanner scanne

public void execute() throws MojoExecutionException {
try {
applyMasks();
scanner.start();
serverVersion = scanner.serverVersion();

Expand All @@ -68,26 +67,6 @@ public void execute() throws MojoExecutionException {
}
}

private void applyMasks() {
// Exclude log implementation to not conflict with Maven 3.1 logging impl
scanner.mask("org.slf4j.LoggerFactory");
// Include slf4j Logger that is exposed by some Sonar components
scanner.unmask("org.slf4j.Logger");
scanner.unmask("org.slf4j.ILoggerFactory");
// MSONAR-122
scanner.unmask("org.slf4j.Marker");
// Exclude other slf4j classes
// .unmask("org.slf4j.impl.")
scanner.mask("org.slf4j.");
// Exclude logback
scanner.mask("ch.qos.logback.");
scanner.mask("org.sonar.");
// Guava is not the same version in SonarQube classloader
scanner.mask("com.google.common");
// Include everything else (we need to unmask all extensions that might be passed to the batch)
scanner.unmask("");
}

private Map<String, String> collectProperties()
throws MojoExecutionException {
List<MavenProject> sortedProjects = session.getProjects();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,6 @@ public void testNullServerVersion() {
}

private void verifyCommonCalls() {
verify(scanner, atLeastOnce()).mask(anyString());
verify(scanner, atLeastOnce()).unmask(anyString());

verify(scanner).start();
verify(scanner).serverVersion();
verify(scanner).execute(projectProperties);
Expand Down

0 comments on commit 2791f1b

Please sign in to comment.