Skip to content

Commit

Permalink
Replace deprecated function RandomStringUtils.randomAlphanumeric (#1073)
Browse files Browse the repository at this point in the history
  • Loading branch information
dexamundsen authored Nov 22, 2024
1 parent 08a4ecb commit c82ec6d
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions service/src/main/java/bio/terra/tanagra/db/ArtifactsDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public String cloneCohort(
String displayName,
String description) {
// Cohort
String clCohortId = RandomStringUtils.randomAlphanumeric(10);
String clCohortId = RandomStringUtils.secure().nextAlphanumeric(10);

// underlay: same as that of the original rows
MapSqlParameterSource cohortParamSets =
Expand Down Expand Up @@ -72,7 +72,7 @@ public String cloneCohort(
ogReviews.forEach(
review -> {
String ogReviewId = review.getId();
String clReviewId = RandomStringUtils.randomAlphanumeric(10);
String clReviewId = RandomStringUtils.secure().nextAlphanumeric(10);
ogRevisionIdReviewIdMap.put(review.getRevision().getId(), ogReviewId);
reviewIdMap.put(ogReviewId, clReviewId);

Expand Down Expand Up @@ -118,7 +118,7 @@ public String cloneCohort(
builderPair -> {
CohortRevision ogRevision = builderPair.getValue().build();
String ogRevisionId = ogRevision.getId();
String clRevisionId = RandomStringUtils.randomAlphanumeric(10);
String clRevisionId = RandomStringUtils.secure().nextAlphanumeric(10);

revisionParamSets.add(
CohortDao.buildRevisionParam(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void addEnumVal(String enumVal) {

public AnnotationKey build() {
if (id == null) {
id = RandomStringUtils.randomAlphanumeric(10);
id = RandomStringUtils.secure().nextAlphanumeric(10);
}
if (displayName == null) {
throw new BadRequestException("Annotation key requires a display name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public Builder isDeleted(boolean isDeleted) {

public Cohort build() {
if (id == null) {
id = RandomStringUtils.randomAlphanumeric(10);
id = RandomStringUtils.secure().nextAlphanumeric(10);
}
if (displayName != null && displayName.length() > MAX_DISPLAY_NAME_LENGTH) {
throw new BadRequestException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public Builder recordsCount(Long recordsCount) {

public CohortRevision build() {
if (id == null) {
id = RandomStringUtils.randomAlphanumeric(10);
id = RandomStringUtils.secure().nextAlphanumeric(10);
}
if (lastModifiedBy == null) {
lastModifiedBy = createdBy;
Expand Down Expand Up @@ -390,7 +390,7 @@ public Builder setIsDisabled(boolean isDisabled) {

public CriteriaGroupSection build() {
if (id == null) {
id = RandomStringUtils.randomAlphanumeric(10);
id = RandomStringUtils.secure().nextAlphanumeric(10);
}
return new CriteriaGroupSection(
id,
Expand Down Expand Up @@ -520,7 +520,7 @@ public Builder isDisabled(boolean isDisabled) {

public CriteriaGroup build() {
if (id == null) {
id = RandomStringUtils.randomAlphanumeric(10);
id = RandomStringUtils.secure().nextAlphanumeric(10);
}
return new CriteriaGroup(id, displayName, criteria, isDisabled);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public Builder tags(Map<String, String> tags) {

public Criteria build() {
if (id == null) {
id = RandomStringUtils.randomAlphanumeric(10);
id = RandomStringUtils.secure().nextAlphanumeric(10);
}
return new Criteria(
id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public Builder isDeleted(boolean isDeleted) {

public FeatureSet build() {
if (id == null) {
id = RandomStringUtils.randomAlphanumeric(10);
id = RandomStringUtils.secure().nextAlphanumeric(10);
}
if (displayName != null && displayName.length() > MAX_DISPLAY_NAME_LENGTH) {
throw new BadRequestException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public Builder isDeleted(boolean isDeleted) {

public Review build() {
if (id == null) {
id = RandomStringUtils.randomAlphanumeric(10);
id = RandomStringUtils.secure().nextAlphanumeric(10);
}
if (displayName != null && displayName.length() > MAX_DISPLAY_NAME_LENGTH) {
throw new BadRequestException(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public Builder isDeleted(boolean isDeleted) {
public Study build() {
// true if the id is empty or null
if (StringUtils.isEmpty(id)) {
id = RandomStringUtils.randomAlphanumeric(10);
id = RandomStringUtils.secure().nextAlphanumeric(10);
}
// Always have a map, even if it is empty
if (properties == null) {
Expand Down

0 comments on commit c82ec6d

Please sign in to comment.