aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-scanner-engine
diff options
context:
space:
mode:
Diffstat (limited to 'sonar-scanner-engine')
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectInfoTest.java10
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/externalissue/ExternalIssueImporterTest.java12
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java6
-rw-r--r--sonar-scanner-engine/src/test/java/org/sonar/scm/git/ChangedFileTest.java4
4 files changed, 16 insertions, 16 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectInfoTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectInfoTest.java
index 943a40144c0..b27bfdd4423 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectInfoTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/ProjectInfoTest.java
@@ -34,7 +34,7 @@ import org.sonar.api.CoreProperties;
import org.sonar.api.config.internal.MapSettings;
import org.sonar.api.utils.MessageException;
-import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
+import static org.apache.commons.lang3.RandomStringUtils.secure;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock;
@@ -79,7 +79,7 @@ class ProjectInfoTest {
@Test
void fail_with_too_long_version() {
- String version = randomAlphabetic(101);
+ String version = secure().nextAlphabetic(101);
settings.setProperty(CoreProperties.PROJECT_DATE_PROPERTY, "2017-01-01");
settings.setProperty(CoreProperties.PROJECT_VERSION_PROPERTY, version);
@@ -91,7 +91,7 @@ class ProjectInfoTest {
@Test
void fail_with_too_long_buildString() {
- String buildString = randomAlphabetic(101);
+ String buildString = secure().nextAlphabetic(101);
settings.setProperty(CoreProperties.PROJECT_DATE_PROPERTY, "2017-01-01");
settings.setProperty(CoreProperties.BUILD_STRING_PROPERTY, buildString);
@@ -114,7 +114,7 @@ class ProjectInfoTest {
@Test
void getProjectVersion_contains_value_of_property() {
- String value = RandomStringUtils.randomAlphabetic(10);
+ String value = RandomStringUtils.secure().nextAlphabetic(10);
settings.setProperty(CoreProperties.PROJECT_DATE_PROPERTY, "2017-01-01");
settings.setProperty(CoreProperties.PROJECT_VERSION_PROPERTY, value);
@@ -136,7 +136,7 @@ class ProjectInfoTest {
@Test
void getBuildString_contains_value_of_property() {
- String value = RandomStringUtils.randomAlphabetic(10);
+ String value = RandomStringUtils.secure().nextAlphabetic(10);
settings.setProperty(CoreProperties.PROJECT_DATE_PROPERTY, "2017-01-01");
settings.setProperty(CoreProperties.BUILD_STRING_PROPERTY, value);
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/externalissue/ExternalIssueImporterTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/externalissue/ExternalIssueImporterTest.java
index e8ff234901d..1daf50a155c 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/externalissue/ExternalIssueImporterTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/externalissue/ExternalIssueImporterTest.java
@@ -43,7 +43,7 @@ import org.sonar.api.testfixtures.log.LogTester;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
-import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
+import static org.apache.commons.lang3.RandomStringUtils.secure;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.sonar.api.issue.impact.Severity.BLOCKER;
@@ -102,7 +102,7 @@ public class ExternalIssueImporterTest {
ExternalIssueReport.Issue input = new ExternalIssueReport.Issue();
input.primaryLocation = new ExternalIssueReport.Location();
input.primaryLocation.filePath = sourceFile.getProjectRelativePath();
- input.primaryLocation.message = randomAlphabetic(5);
+ input.primaryLocation.message = secure().nextAlphabetic(5);
runOn(input);
@@ -254,7 +254,7 @@ public class ExternalIssueImporterTest {
input.type = "BUG";
input.primaryLocation = new ExternalIssueReport.Location();
input.primaryLocation.filePath = sourceFile.getProjectRelativePath();
- input.primaryLocation.message = randomAlphabetic(5);
+ input.primaryLocation.message = secure().nextAlphabetic(5);
report.issues = new ExternalIssueReport.Issue[]{input};
ExternalIssueImporter underTest = new ExternalIssueImporter(this.context, report);
@@ -381,14 +381,14 @@ public class ExternalIssueImporterTest {
private ExternalIssueReport.Issue newIssue(@Nullable ExternalIssueReport.TextRange textRange) {
ExternalIssueReport.Issue input = new ExternalIssueReport.Issue();
- input.engineId = randomAlphabetic(5);
- input.ruleId = randomAlphabetic(5);
+ input.engineId = secure().nextAlphabetic(5);
+ input.ruleId = secure().nextAlphabetic(5);
input.severity = "CRITICAL";
input.type = "BUG";
input.effortMinutes = random.nextInt(Integer.MAX_VALUE);
input.primaryLocation = new ExternalIssueReport.Location();
input.primaryLocation.filePath = sourceFile.getProjectRelativePath();
- input.primaryLocation.message = randomAlphabetic(5);
+ input.primaryLocation.message = secure().nextAlphabetic(5);
input.primaryLocation.textRange = textRange;
return input;
}
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
index 91607834d0d..129a3c79450 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/MetadataPublisherTest.java
@@ -60,7 +60,7 @@ import org.sonar.scanner.scm.ScmConfiguration;
import org.sonar.scanner.scm.ScmRevision;
import static java.util.Collections.emptyMap;
-import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
+import static org.apache.commons.lang3.RandomStringUtils.secure;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.entry;
import static org.mockito.ArgumentMatchers.any;
@@ -179,7 +179,7 @@ public class MetadataPublisherTest {
@DataProvider
public static Object[][] projectVersions() {
- String version = randomAlphabetic(15);
+ String version = secure().nextAlphabetic(15);
return new Object[][] {
{null, ""},
{"", ""},
@@ -201,7 +201,7 @@ public class MetadataPublisherTest {
@DataProvider
public static Object[][] buildStrings() {
- String randomBuildString = randomAlphabetic(15);
+ String randomBuildString = secure().nextAlphabetic(15);
return new Object[][] {
{null, ""},
{"", ""},
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scm/git/ChangedFileTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scm/git/ChangedFileTest.java
index 1bb25a29438..20ee5a69035 100644
--- a/sonar-scanner-engine/src/test/java/org/sonar/scm/git/ChangedFileTest.java
+++ b/sonar-scanner-engine/src/test/java/org/sonar/scm/git/ChangedFileTest.java
@@ -27,7 +27,7 @@ import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.SensorStrategy;
import static org.apache.commons.lang3.RandomStringUtils.random;
-import static org.apache.commons.lang3.RandomStringUtils.randomNumeric;
+import static org.apache.commons.lang3.RandomStringUtils.secure;
import static org.assertj.core.api.Assertions.assertThat;
public class ChangedFileTest {
@@ -87,7 +87,7 @@ public class ChangedFileTest {
random(5),
InputFile.Type.MAIN,
random(5),
- Integer.parseInt(randomNumeric(5)),
+ Integer.parseInt(secure().nextNumeric(5)),
new SensorStrategy(),
oldRelativePath);
}