From b47bf38fc202a765e4b22363073712b1aa8ff070 Mon Sep 17 00:00:00 2001 From: asvitkine Date: Wed, 5 Jul 2023 10:30:53 -0400 Subject: [PATCH] Fix stats export on 2.6. (#11730) This was broken by my History revamp changes. Also fixes formatting on a comment and removes an unnecessary toString() on a param. --- .../main/java/games/strategy/engine/history/History.java | 1 - .../java/games/strategy/triplea/ui/menubar/ExportMenu.java | 7 +++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/game-app/game-core/src/main/java/games/strategy/engine/history/History.java b/game-app/game-core/src/main/java/games/strategy/engine/history/History.java index 6ec8c781e0f..a36383065a7 100644 --- a/game-app/game-core/src/main/java/games/strategy/engine/history/History.java +++ b/game-app/game-core/src/main/java/games/strategy/engine/history/History.java @@ -56,7 +56,6 @@ public HistoryWriter getHistoryWriter() { } public HistoryNode enableSeeking(final HistoryPanel panel) { - Preconditions.checkNotNull(panel); Preconditions.checkState(!seekingEnabled); this.panel = panel; nextChangeIndex = changes.size(); diff --git a/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java b/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java index c7fc007d873..2cbd28c7a55 100644 --- a/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java +++ b/game-app/game-headed/src/main/java/games/strategy/triplea/ui/menubar/ExportMenu.java @@ -167,8 +167,7 @@ private void createAndSaveStats(final boolean showPhaseStats) { if (clone == null) { return; } - try (PrintWriter writer = - new PrintWriter(chooser.getSelectedFile(), StandardCharsets.UTF_8.toString()); + try (PrintWriter writer = new PrintWriter(chooser.getSelectedFile(), StandardCharsets.UTF_8); GameData.Unlocker ignored = gameData.acquireReadLock()) { writer.append(defaultFileName).println(','); writer.append("TripleA Engine Version: ,"); @@ -257,8 +256,7 @@ private void createAndSaveStats(final boolean showPhaseStats) { final List players = clone.getPlayerList().getSortedPlayers(); // extended stats covers stuff that doesn't show up in the game stats menu bar, like custom - // resources or tech - // tokens or # techs, etc. + // resources or tech tokens or # techs, etc. final Iterable stats = Iterables.concat( List.of(statPanel.getStats()), List.of(statPanel.getStatsExtended(gameData))); @@ -273,6 +271,7 @@ private void createAndSaveStats(final boolean showPhaseStats) { } } writer.println(); + clone.getHistory().enableSeeking(null); clone.getHistory().gotoNode(clone.getHistory().getLastNode()); final Enumeration nodes = ((DefaultMutableTreeNode) clone.getHistory().getRoot()).preorderEnumeration();