SonarQube reports bugs
There are 2 critical level bugs found by SonarQube.
https://sonarcloud.io/project/issues?id=com.iluwatar%3Ajava-design-patterns&resolved=false&severities=BLOCKER%2CCRITICAL&types=BUG
@iluwatar I will take a look at this.
Ok @IAmPramod
Hi The sonarQube says as a possible solution is to use: SecureRandom.getInstanceStrong() Instead using new Random().
But it throws a NoSuchAlgorithmException and I don't know what to put in the catch block. I would leave it blank because I'm setting idx variable to 0 and if the exception is thrown the method will return the first Player.
Here a snippet of my solution: (Please, take a look)
private static PlayerDetails getRandomPlayerDetails() {
int idx = 0;
try {
idx = SecureRandom.getInstanceStrong().nextInt(PLAYERS.size());
} catch (NoSuchAlgorithmException e) {}
return PLAYERS.get(idx);
}
Thank you
@IAmPramod : Are you working on this?
Ping @IAmPramod
I am willing to take a look at this issue if @IAmPramod doesn't answer. I'm on the hunt for a "good first issue" :)
Go ahead @matheusrc the issue is yours