Skip to content

Fix Logger counter bugs and FileManager validation logic errors#2

Draft
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-dff445c7-e573-49e8-aa96-0a9a3880ebb1
Draft

Fix Logger counter bugs and FileManager validation logic errors#2
Copilot wants to merge 2 commits into
masterfrom
copilot/fix-dff445c7-e573-49e8-aa96-0a9a3880ebb1

Conversation

Copy link
Copy Markdown

Copilot AI commented Aug 25, 2025

This PR fixes critical bugs in the logging system and server configuration validation that were causing incorrect behavior in the MCSL application.

Issues Fixed

Logger Counter Bugs

The Logger class had two critical bugs where counter properties were being incremented with values from the wrong counters:

// Before (incorrect)
public static void warn(String text) {
    // ...
    WARN_COUNT_PROP.setValue(ERROR_COUNT_PROP.getValue() + 1); // Wrong!
}

public static void error(String text) {
    // ...
    ERROR_COUNT_PROP.setValue(WARN_COUNT_PROP.getValue() + 1); // Wrong!
}

// After (fixed)
public static void warn(String text) {
    // ...
    WARN_COUNT_PROP.setValue(WARN_COUNT_PROP.getValue() + 1); // Correct
}

public static void error(String text) {
    // ...
    ERROR_COUNT_PROP.setValue(ERROR_COUNT_PROP.getValue() + 1); // Correct
}

This bug meant that warning counts would increment based on error counts and vice versa, making the logging metrics completely unreliable.

FileManager Validation Logic Error

The checkServerFiles method had a logical error in validating external server plugin port configuration:

// Before (incorrect logic)
(!settings.hasProp("pluginport") && DataTypeUtil.isInt(settings.getProp("pluginport")))

// After (fixed)
!(settings.hasProp("pluginport") && DataTypeUtil.isInt(settings.getProp("pluginport")))

The original condition was logically impossible - it tried to check if a property is both missing AND a valid integer at the same time. The fix ensures proper validation: the property must exist AND be a valid integer for the validation to pass.

Impact

  • Logger: Warning and error counters now increment independently and correctly
  • FileManager: External server configuration validation now works properly
  • Reliability: Eliminates logical errors that could cause application misbehavior

These are minimal, surgical changes that fix clear bugs without affecting any other functionality.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: S3nS3IW00 <22691959+S3nS3IW00@users.noreply.github.com>
Copilot AI changed the title [WIP] Solve issues Fix Logger counter bugs and FileManager validation logic errors Aug 25, 2025
Copilot AI requested a review from S3nS3IW00 August 25, 2025 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants