diff --git a/src/main/java/org/blondin/mpg/out/InjuredSuspendedWrapperClient.java b/src/main/java/org/blondin/mpg/out/InjuredSuspendedWrapperClient.java index e44f52c..beb7e42 100644 --- a/src/main/java/org/blondin/mpg/out/InjuredSuspendedWrapperClient.java +++ b/src/main/java/org/blondin/mpg/out/InjuredSuspendedWrapperClient.java @@ -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; - } - }