Skip to content

Commit

Permalink
Fix quality flow
Browse files Browse the repository at this point in the history
  • Loading branch information
axel3rd committed Aug 8, 2023
1 parent 920d714 commit a40191b
Showing 1 changed file with 13 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,27 @@ public Player getPlayer(ChampionshipOutType championship, String playerName, Pos
throw new UnsupportedOperationException("Main parameters (championship, playerName, position, teamName) can not be null");
}
if (ChampionshipOutType.LIGUE_2.equals(championship)) {
if (!maLigue2Reachable) {
return null;
}
try {
return maLigue2Client.getPlayer(playerName, teamName);
if (maLigue2Reachable) {
return maLigue2Client.getPlayer(playerName, teamName);
}
} catch (ServiceUnavailableException e) {
LOG.error("WARN: Maligue2.fr is unavailable, L2 injured/suspended players not taken into account :-(");
maLigue2Reachable = false;
return null;

}
}
try {
if (sportsGamblerReachable) {
return useDirectlyOnlyForTestGetSportsGamblerClient().getPlayer(championship, playerName, teamName);
} else {
try {
if (sportsGamblerReachable) {
return sportsGamblerClient.getPlayer(championship, playerName, teamName);
}
} catch (UrlForbiddenException | ServiceUnavailableException | TeamsNotFoundException e) {
LOG.error("WARN: SportsGambler is unavailable, injured/suspended players not taken into account :-(");
LOG.error("(Your IP is perhaps temporary ban, try to increase 'request.wait.time' parameter)");
sportsGamblerReachable = false;
}
} catch (UrlForbiddenException | ServiceUnavailableException | TeamsNotFoundException e) {
LOG.error("WARN: SportsGambler is unavailable, injured/suspended players not taken into account :-(");
LOG.error("(Your IP is perhaps temporary ban, try to increase 'request.wait.time' parameter)");
}
return null;
}

public InjuredSuspendedSportsGamblerClient useDirectlyOnlyForTestGetSportsGamblerClient() {
return sportsGamblerClient;
}

}

0 comments on commit a40191b

Please sign in to comment.