Skip to content

Commit

Permalink
fix: [RTD-955] random generator gives negative numbers (#300)
Browse files Browse the repository at this point in the history
* [RTD-955] fix random generator positive numbers

* [RTD-955] replace long random with int

* [RTD-955] replace int with uuid truncated
  • Loading branch information
and-mora committed Nov 28, 2022
1 parent 7432d52 commit 7c6efe9
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -2,6 +2,7 @@

import it.gov.pagopa.rtd.transaction_filter.service.TransactionWriterService;
import java.security.SecureRandom;
import java.util.UUID;
import lombok.Data;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -226,7 +227,7 @@ private File getDestionationFileByStatus(String sourceFilePath, boolean isComple
if (isCompleted) {
String archivalPath = resolver.getResources(successPath)[0].getFile().getAbsolutePath();
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS");
destinationPath = archivalPath + File.separator + SecureRandom.getInstanceStrong().nextLong() +
destinationPath = archivalPath + File.separator + UUID.randomUUID().toString().replace("-", "").substring(0, 20) +
"_" + OffsetDateTime.now().format(fmt) + "_" + filename;
} else {
String archivalPath = resolver.getResources(uploadPendingPath)[0].getFile().getAbsolutePath();
Expand Down

0 comments on commit 7c6efe9

Please sign in to comment.