diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2021-10-22 10:38:45 -0500 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2021-10-25 20:03:24 +0000 |
commit | 6519110cd4f98fabf3bef46896eecbead3eb646a (patch) | |
tree | ad84a08da8ba0d590dd1a2d5e9bd2f85ff1c8a8e /sonar-plugin-api-impl | |
parent | 7525c90c3f489b47e902e5f8eecce2c9deab9658 (diff) | |
download | sonarqube-6519110cd4f98fabf3bef46896eecbead3eb646a.tar.gz sonarqube-6519110cd4f98fabf3bef46896eecbead3eb646a.zip |
Fix code quality issues
Diffstat (limited to 'sonar-plugin-api-impl')
3 files changed, 5 insertions, 3 deletions
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/TestInputFileBuilder.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/TestInputFileBuilder.java index f7e51447dbd..e9a7992a53f 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/TestInputFileBuilder.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/batch/fs/internal/TestInputFileBuilder.java @@ -208,7 +208,7 @@ public class TestInputFileBuilder { } public TestInputFileBuilder initMetadata(String content) { - AnalysisWarnings analysisWarnings = (warning) -> {}; + AnalysisWarnings analysisWarnings = warning -> {}; return setMetadata(new FileMetadata(analysisWarnings).readMetadata(new StringReader(content))); } diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java index 207bf8c2fab..0038733b2e4 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/impl/utils/AlwaysIncreasingSystem2.java @@ -34,6 +34,7 @@ import static org.sonar.api.utils.Preconditions.checkArgument; * </p> */ public class AlwaysIncreasingSystem2 extends System2 { + private static final Random rnd = new Random(); private final AtomicLong now; private final long increment; @@ -66,6 +67,6 @@ public class AlwaysIncreasingSystem2 extends System2 { } private static long randomInitialValue() { - return Math.abs(new Random().nextInt(2_000_000)); + return Math.abs(rnd.nextInt(2_000_000)); } } diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/internal/MetadataLoader.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/internal/MetadataLoader.java index 3955f53bad2..dab1b4134a8 100644 --- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/internal/MetadataLoader.java +++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/internal/MetadataLoader.java @@ -22,6 +22,7 @@ package org.sonar.api.internal; import java.io.IOException; import java.net.URL; import java.nio.charset.StandardCharsets; +import java.util.Locale; import java.util.Scanner; import org.sonar.api.SonarEdition; import org.sonar.api.utils.System2; @@ -68,7 +69,7 @@ public class MetadataLoader { } static SonarEdition parseEdition(String edition) { - String str = trimToEmpty(edition.toUpperCase()); + String str = trimToEmpty(edition.toUpperCase(Locale.ENGLISH)); try { return SonarEdition.valueOf(str); } catch (IllegalArgumentException e) { |