From 676d2308e5e167727983551e3b162d8cec87ee3c Mon Sep 17 00:00:00 2001 From: frigoref Date: Sat, 24 Aug 2024 20:14:56 +0200 Subject: [PATCH] Fix 12855 Failed to start game (#12856) * Fix issue 12826 (UnitSeparator#categorize:213 - java.util.ConcurrentModificationException) PlacePanel.java - new method updateUnitsInUnitsToPlacePanel that ensures copying the unit collection (existed already in method updateStep, but not in gameDataChanged or updateUnits) - Cleanup: extract new methods from declaration of variable placeMapSelectionListener which are getUnitsToPlace, getScrollPaneFromChooser, getPreferredHeight and getPreferredWidth * PlayerUnitsPanel ToDo done via redraw Replace invalidate(); validate(); revalidate();getParent().invalidate(); with SwingComponents.redraw(this); * tab Players - tooltips for technologies Smaller fixes: - SwingConstants instead of JLable - method setStatColumns with List.toArray - rename gameData to gameDataSync - introduce synchronized method TechTableModel.getDataAndInitRowMap() * Fix 12855 Failed to start game Example map: World War II v3 1941 UnsupportedOperationException caused by Arrays.asList (=fixed size list) followed with method call add() --- .../main/java/games/strategy/triplea/ui/StatPanel.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/game-app/game-core/src/main/java/games/strategy/triplea/ui/StatPanel.java b/game-app/game-core/src/main/java/games/strategy/triplea/ui/StatPanel.java index a9c50a98239..f5ac68a7e6b 100644 --- a/game-app/game-core/src/main/java/games/strategy/triplea/ui/StatPanel.java +++ b/game-app/game-core/src/main/java/games/strategy/triplea/ui/StatPanel.java @@ -22,6 +22,7 @@ import java.awt.Component; import java.awt.GridLayout; import java.awt.Image; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -192,8 +193,11 @@ class StatTableModel extends AbstractTableModel { } void setStatColumns() { - final List statsList = - Arrays.asList(new PuStat(), new ProductionStat(), new UnitsStat(), new TuvStat()); + final List statsList = new ArrayList<>(); + statsList.add(new PuStat()); + statsList.add(new ProductionStat()); + statsList.add(new UnitsStat()); + statsList.add(new TuvStat()); if (gameData.getMap().getTerritories().stream().anyMatch(Matches.territoryIsVictoryCity())) { statsList.add(new VictoryCityStat()); }