Search in sources :

Example 66 with GameParseException

use of games.strategy.engine.data.GameParseException in project triplea by triplea-game.

the class GameChooserEntry method fullyParseGameData.

public GameData fullyParseGameData() throws GameParseException {
    // TODO: We should be setting this in the the constructor. At this point, you have to call methods in the
    // correct order for things to work, and that is bads.
    gameData = null;
    final Optional<InputStream> inputStream = UrlStreams.openStream(url);
    if (!inputStream.isPresent()) {
        return gameData;
    }
    try (InputStream input = inputStream.get()) {
        gameData = GameParser.parse(url.toString(), input);
        gameDataFullyLoaded = true;
    } catch (final EngineVersionException e) {
        ClientLogger.logQuietly("Game engine not compatible with: " + url, e);
        throw new GameParseException(e);
    } catch (final GameParseException e) {
        ClientLogger.logError("Could not parse:" + url, e);
        throw e;
    } catch (final Exception e) {
        ClientLogger.logError("Could not parse:" + url, e);
        throw new GameParseException(e);
    }
    return gameData;
}
Also used : InputStream(java.io.InputStream) EngineVersionException(games.strategy.engine.data.EngineVersionException) GameParseException(games.strategy.engine.data.GameParseException) GameParseException(games.strategy.engine.data.GameParseException) EngineVersionException(games.strategy.engine.data.EngineVersionException) IOException(java.io.IOException)

Aggregations

GameParseException (games.strategy.engine.data.GameParseException)66 UnitType (games.strategy.engine.data.UnitType)29 PlayerID (games.strategy.engine.data.PlayerID)13 Territory (games.strategy.engine.data.Territory)7 Resource (games.strategy.engine.data.Resource)6 GameChooserEntry (games.strategy.engine.framework.ui.GameChooserEntry)3 TechAdvance (games.strategy.triplea.delegate.TechAdvance)3 IntegerMap (games.strategy.util.IntegerMap)3 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 EngineVersionException (games.strategy.engine.data.EngineVersionException)2 IOException (java.io.IOException)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 GameMap (games.strategy.engine.data.GameMap)1 PlayerList (games.strategy.engine.data.PlayerList)1 ProductionFrontier (games.strategy.engine.data.ProductionFrontier)1 RelationshipType (games.strategy.engine.data.RelationshipType)1 ResourceCollection (games.strategy.engine.data.ResourceCollection)1 TerritoryEffect (games.strategy.engine.data.TerritoryEffect)1 InternalDoNotExport (games.strategy.engine.data.annotations.InternalDoNotExport)1