Skip to content

Commit

Permalink
fix : thread block on some unix system when creating demo project
Browse files Browse the repository at this point in the history
  • Loading branch information
z15lross committed May 5, 2022
1 parent 2d897b8 commit 810b485
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ public class DemoExecutionLoader {

private static final Pattern POSTMAN_ECHO_HOST_PATTERN = Pattern.compile("postman-echo.com");

private static final Random RANDOM = new Random();

private static final BiPredicate<Path, BasicFileAttributes> JSON_FILE_FILTER = (path, attributes) -> attributes.isRegularFile() && path.getFileName().toString().endsWith(".json");

private final SettingService settingService;
Expand Down Expand Up @@ -306,15 +308,9 @@ private void copyStreamToFile(InputStream stream, File destinationFile) throws I
}

private String randomGitCommitId() {
Random random;
try {
random = SecureRandom.getInstanceStrong();
} catch (NoSuchAlgorithmException e) {
random = new SecureRandom();
}
char[] id = new char[40];
for (int i = 0; i < id.length; i++) {
id[i] = Integer.toHexString(random.nextInt(16)).charAt(0);
id[i] = Integer.toHexString(RANDOM.nextInt(16)).charAt(0);
}
return new String(id);
}
Expand Down

0 comments on commit 810b485

Please sign in to comment.