Skip to content

Commit 7d5574f

Browse files
SCANMAVEN-279 Clean up old code (#290)
1 parent c472cfd commit 7d5574f

File tree

5 files changed

+5
-31
lines changed

5 files changed

+5
-31
lines changed

sonar-maven-plugin/src/main/java/org/sonarsource/scanner/maven/bootstrap/MavenUtils.java

-16
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,6 @@ public static String getPluginSetting(MavenProject project, String groupId, Stri
7272
return defaultValue;
7373
}
7474

75-
/**
76-
* Returns first non null object or null if all objects are null
77-
*
78-
* @param objs
79-
* @return First null argument, or null if they are all null
80-
*/
81-
@SafeVarargs
82-
public static <T> T coalesce(T... objs) {
83-
for (T o : objs) {
84-
if (o != null) {
85-
return o;
86-
}
87-
}
88-
return null;
89-
}
90-
9175
static void putAll(Properties src, Map<String, String> dest) {
9276
for (final String name : src.stringPropertyNames()) {
9377
dest.put(name, src.getProperty(name));

sonar-maven-plugin/src/main/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public void execute() throws MojoExecutionException {
7070
logEnvironmentInformation();
7171
try (ScannerEngineBootstrapResult bootstrapResult = bootstrapper.bootstrap()) {
7272
if (!bootstrapResult.isSuccessful()) {
73-
throw new MojoFailureException("The scanner boostrapping has failed! See the logs for more details.");
73+
throw new MojoFailureException("The scanner bootstrapping has failed! See the logs for more details.");
7474
}
7575
try (ScannerEngineFacade engineFacade = bootstrapResult.getEngineFacade()) {
7676
if (!engineFacade.isSonarQubeCloud()) {

sonar-maven-plugin/src/main/java/org/sonarsource/scanner/maven/bootstrap/SourceCollector.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public SourceCollector(Set<Path> existingSources, Set<Path> directoriesToIgnore,
100100
}
101101

102102
@Override
103-
public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes basicFileAttributes) throws IOException {
103+
public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes basicFileAttributes) {
104104
if (
105105
isHidden(path) ||
106106
isExcludedDirectory(path) ||
@@ -137,12 +137,12 @@ public FileVisitResult visitFile(Path path, BasicFileAttributes basicFileAttribu
137137
}
138138

139139
@Override
140-
public FileVisitResult visitFileFailed(Path path, IOException e) throws IOException {
140+
public FileVisitResult visitFileFailed(Path path, IOException e) {
141141
return null;
142142
}
143143

144144
@Override
145-
public FileVisitResult postVisitDirectory(Path path, IOException e) throws IOException {
145+
public FileVisitResult postVisitDirectory(Path path, IOException e) {
146146
return FileVisitResult.CONTINUE;
147147
}
148148
}

sonar-maven-plugin/src/test/java/org/sonarsource/scanner/maven/bootstrap/MavenUtilsTest.java

-10
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,6 @@
2727
import static org.assertj.core.api.Assertions.assertThat;
2828

2929
class MavenUtilsTest {
30-
@Test
31-
void testCoalesce() {
32-
Object o1 = null;
33-
Object o2 = null;
34-
Object o3 = new Object();
35-
36-
assertThat(MavenUtils.coalesce(o1, o2)).isNull();
37-
assertThat(MavenUtils.coalesce(o1, o3, o2)).isEqualTo(o3);
38-
}
39-
4030
@Test
4131
void testJoinAsCsv() {
4232
List<String> values = Arrays.asList("/home/users/me/artifact-123,456.jar", "/opt/lib");

sonar-maven-plugin/src/test/java/org/sonarsource/scanner/maven/bootstrap/ScannerBootstrapperTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void when_ScannerEngineBootstrapper_is_not_successful_getEngineFacade_should_not
160160

161161
assertThatThrownBy( () -> scannerBootstrapper.execute())
162162
.isInstanceOf(MojoExecutionException.class)
163-
.hasMessage("The scanner boostrapping has failed! See the logs for more details.");
163+
.hasMessage("The scanner bootstrapping has failed! See the logs for more details.");
164164
}
165165

166166
@Test

0 commit comments

Comments
 (0)