Skip to content

Commit b9b0d0e

Browse files
committed
Fix quality flaws
1 parent d6ee361 commit b9b0d0e

5 files changed

Lines changed: 29 additions & 10 deletions

File tree

lib/src/main/java/org/sonarsource/scanner/lib/internal/IsolatedLauncherFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private IsolatedClassloader createClassLoader(List<Path> jarFiles, ClassloadRule
5757
}
5858

5959
public IsolatedLauncherAndClassloader createLauncher(ClassloadRules rules, ServerConnection serverConnection, FileCache fileCache) {
60-
LegacyScannerEngineDownloader legacyScannerEngineDownloader = new JarDownloaderFactory(serverConnection, logger, fileCache).create();
60+
LegacyScannerEngineDownloader legacyScannerEngineDownloader = new LegacyScannerEngineDownloaderFactory(serverConnection, logger, fileCache).create();
6161
return createLauncher(legacyScannerEngineDownloader, rules);
6262
}
6363

lib/src/main/java/org/sonarsource/scanner/lib/internal/JarDownloaderFactory.java renamed to lib/src/main/java/org/sonarsource/scanner/lib/internal/LegacyScannerEngineDownloaderFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
import org.sonarsource.scanner.lib.internal.cache.Logger;
2424
import org.sonarsource.scanner.lib.internal.http.ServerConnection;
2525

26-
class JarDownloaderFactory {
26+
class LegacyScannerEngineDownloaderFactory {
2727
private final ServerConnection serverConnection;
2828
private final Logger logger;
2929
private final FileCache fileCache;
3030

31-
JarDownloaderFactory(ServerConnection conn, Logger logger, FileCache fileCache) {
31+
LegacyScannerEngineDownloaderFactory(ServerConnection conn, Logger logger, FileCache fileCache) {
3232
this.serverConnection = conn;
3333
this.logger = logger;
3434
this.fileCache = fileCache;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* SonarScanner Java Library
3+
* Copyright (C) 2011-2024 SonarSource SA
4+
* mailto:info AT sonarsource DOT com
5+
*
6+
* This program is free software; you can redistribute it and/or
7+
* modify it under the terms of the GNU Lesser General Public
8+
* License as published by the Free Software Foundation; either
9+
* version 3 of the License, or (at your option) any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14+
* Lesser General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU Lesser General Public License
17+
* along with this program; if not, write to the Free Software Foundation,
18+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19+
*/
20+
@ParametersAreNonnullByDefault
21+
package org.sonarsource.scanner.lib.internal.util;
22+
23+
import javax.annotation.ParametersAreNonnullByDefault;

lib/src/test/java/org/sonarsource/scanner/lib/internal/IsolatedLauncherFactoryTest.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,11 @@
1919
*/
2020
package org.sonarsource.scanner.lib.internal;
2121

22-
import java.nio.file.Path;
2322
import java.util.HashSet;
2423
import java.util.Map;
2524
import java.util.Properties;
2625
import org.junit.jupiter.api.BeforeEach;
2726
import org.junit.jupiter.api.Test;
28-
import org.junit.jupiter.api.io.TempDir;
2927
import org.sonarsource.scanner.lib.internal.batch.IsolatedLauncher;
3028
import org.sonarsource.scanner.lib.internal.batch.LogOutput;
3129
import org.sonarsource.scanner.lib.internal.cache.Logger;
@@ -40,7 +38,7 @@ class IsolatedLauncherFactoryTest {
4038
LegacyScannerEngineDownloader legacyScannerEngineDownloader;
4139

4240
@BeforeEach
43-
public void setUp(@TempDir Path sonarUserHome) {
41+
public void setUp() {
4442
tempCleaning = mock(TempCleaning.class);
4543
factory = new IsolatedLauncherFactory(FakeIsolatedLauncher.class.getName(), tempCleaning, mock(Logger.class));
4644
props = new Properties();

lib/src/test/java/org/sonarsource/scanner/lib/internal/LegacyScannerEngineDownloaderFactoryTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
*/
2020
package org.sonarsource.scanner.lib.internal;
2121

22-
import java.nio.file.Path;
2322
import org.junit.jupiter.api.Test;
24-
import org.junit.jupiter.api.io.TempDir;
2523
import org.sonarsource.scanner.lib.internal.cache.FileCache;
2624
import org.sonarsource.scanner.lib.internal.cache.Logger;
2725
import org.sonarsource.scanner.lib.internal.http.ServerConnection;
@@ -31,10 +29,10 @@
3129

3230
class LegacyScannerEngineDownloaderFactoryTest {
3331
@Test
34-
void should_create(@TempDir Path sonarUserHome) {
32+
void should_create() {
3533
ServerConnection conn = mock(ServerConnection.class);
3634
Logger logger = mock(Logger.class);
3735
FileCache cache = mock(FileCache.class);
38-
assertThat(new JarDownloaderFactory(conn, logger, cache).create()).isNotNull();
36+
assertThat(new LegacyScannerEngineDownloaderFactory(conn, logger, cache).create()).isNotNull();
3937
}
4038
}

0 commit comments

Comments
 (0)