From fd73dc9ba1930d887eb2d50e8788e3afeb8d339a Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Thu, 5 Dec 2024 16:41:49 -0600 Subject: [PATCH 1/2] Change log level from info to debug for data operations Revised log levels from info to debug in AutoAwardsTableModel and AutoAwardsDialog to reduce verbosity in normal operation. This adjustment ensures that detailed internal state information is logged only when debug logging is enabled, which aids in troubleshooting without cluttering standard logs. --- MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java | 2 +- MekHQ/src/mekhq/gui/model/AutoAwardsTableModel.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java b/MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java index 29a5327663..534984568a 100644 --- a/MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java +++ b/MekHQ/src/mekhq/gui/dialog/AutoAwardsDialog.java @@ -145,7 +145,7 @@ private void initComponents() { AutoAwardsTableModel model = new AutoAwardsTableModel(campaign); // This is where we insert the external data logger.info("Trying to pass data to AutoAwardsTableModel.java"); - logger.info("Data being passed: {}", data); + logger.debug("Data being passed: {}", data); model.setData(data); logger.info("Attempt successful"); personnelTable = new AutoAwardsTable(model); diff --git a/MekHQ/src/mekhq/gui/model/AutoAwardsTableModel.java b/MekHQ/src/mekhq/gui/model/AutoAwardsTableModel.java index 14f78dd501..2f537f7c65 100644 --- a/MekHQ/src/mekhq/gui/model/AutoAwardsTableModel.java +++ b/MekHQ/src/mekhq/gui/model/AutoAwardsTableModel.java @@ -61,11 +61,11 @@ public void setData(Map> map) { if (map.isEmpty()) { logger.error("AutoAwardsDialog failed to pass 'data' into AutoAwardsTableModel"); } else { - logger.info("AutoAwardsDialog passed 'data' into AutoAwardsTableModel: {}", map); + logger.debug("AutoAwardsDialog passed 'data' into AutoAwardsTableModel: {}", map); } data = map; - logger.info("Translated data: {}", data); + logger.debug("Translated data: {}", data); } @Override From be8f60fcfc112ce7366a83167f65f6682013d683 Mon Sep 17 00:00:00 2001 From: IllianiCBT Date: Thu, 5 Dec 2024 16:58:04 -0600 Subject: [PATCH 2/2] Fix incorrect parameter order in processFaction call Reordered parameters in the processFaction method call to ensure proper functionality. Removed unnecessary instanceof check for AtBContract when verifying campaign options usage. These changes improve code accuracy and reliability in processing faction details. --- .../personnel/autoAwards/TheatreOfWarAwards.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/MekHQ/src/mekhq/campaign/personnel/autoAwards/TheatreOfWarAwards.java b/MekHQ/src/mekhq/campaign/personnel/autoAwards/TheatreOfWarAwards.java index a89b3a431f..0bcb490631 100644 --- a/MekHQ/src/mekhq/campaign/personnel/autoAwards/TheatreOfWarAwards.java +++ b/MekHQ/src/mekhq/campaign/personnel/autoAwards/TheatreOfWarAwards.java @@ -52,7 +52,13 @@ public static Map> TheatreOfWarAwardsProcessor(Campaign ca boolean isEligible; List eligibleAwards = new ArrayList<>(); - String employer = ((Contract) mission).getEmployer(); + // if the mission isn't an instance of 'AtBContract' we won't have the information we need, + // so abort processing. + if (!(mission instanceof AtBContract)) { + return AutoAwardsController.prepareAwardData(person, eligibleAwards); + } + + String employer = ((AtBContract) mission).getEmployerCode(); int contractStartYear = ((Contract) mission).getStartDate().getYear(); int currentYear = campaign.getGameYear(); @@ -103,10 +109,10 @@ public static Map> TheatreOfWarAwardsProcessor(Campaign ca } if (belligerents.size() == 1) { - if (!processFaction(belligerents.get(0), employer)) { + if (!processFaction(employer, belligerents.get(0))) { continue; } - } else if ((campaign.getCampaignOptions().isUseAtB()) && (mission instanceof AtBContract)) { + } else if (campaign.getCampaignOptions().isUseAtB()) { String enemy = ((AtBContract) mission).getEnemyCode(); if (hasLoyalty(employer, attackers)) {