import java.util.Base64;
-import org.hedgecode.chess.scanner.ChessHogScannerException;
import org.hedgecode.chess.scanner.Scanner;
+import org.hedgecode.chess.scanner.ScannerException;
import org.hedgecode.chess.scanner.entity.PGNGame;
import org.hedgecode.chess.scanner.entity.PGNTournament;
import org.hedgecode.chess.scanner.format.chessbomb.ArenaFormat;
}
@Override
- public PGNTournament scanTournament(String tournamentId) throws ChessHogScannerException {
+ public PGNTournament scanTournament(String tournamentId) throws ScannerException {
String decodeTournament = decodeUrlByRegex(
assignUrl(tournamentId, null),
getSettings().getTournamentJsonUrlRegex()
}
@Override
- public PGNTournament findTournament(String tournamentName) throws ChessHogScannerException {
+ public PGNTournament findTournament(String tournamentName) throws ScannerException {
String decodeArena = decodeUrlByRegex(
assignUrl(tournamentName, false),
getSettings().getTournamentQueryUrlRegex()
}
@Override
- public PGNGame scanGame(String gameId) throws ChessHogScannerException {
- throw new ChessHogScannerException(
+ public PGNGame scanGame(String gameId) throws ScannerException {
+ throw new ScannerException(
"ChessBomb does not support searching game without a tournament name!"
);
}
@Override
- public PGNGame scanGame(String gameId, String tournamentId) throws ChessHogScannerException {
+ public PGNGame scanGame(String gameId, String tournamentId) throws ScannerException {
return scanGameByRegex(
assignUrl(gameId, tournamentId, true),
getSettings().getGameJsonUrlRegex()
}
@Override
- public PGNGame scanUrl(String gameUrl) throws ChessHogScannerException {
+ public PGNGame scanUrl(String gameUrl) throws ScannerException {
return scanGameByRegex(
gameUrl,
getSettings().getGameJsonUrlRegex()
);
}
- private PGNGame scanGameByRegex(String gameUrl, String regex) throws ChessHogScannerException {
+ private PGNGame scanGameByRegex(String gameUrl, String regex) throws ScannerException {
String decodeGame = decodeUrlByRegex(
gameUrl,
regex
}
- private String decodeUrlByRegex(String url, String regex) throws ChessHogScannerException {
+ private String decodeUrlByRegex(String url, String regex) throws ScannerException {
String encodeString = match(
url,
regex
);
if (encodeString == null) {
- throw new ChessHogScannerException(
+ throw new ScannerException(
String.format("Failed to decode source data for requesting URL: %s", url)
);
}