Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #25288 asadmin delete-log-levels command fails if the --target option is specified #25289

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

tnagao7
Copy link
Member

@tnagao7 tnagao7 commented Dec 17, 2024

Fixes #25288.

Fixes the LoggingConfigImpl#deleteLoggingProperties method to handle the target argument.

@@ -385,7 +385,7 @@ public synchronized Map<String, String> deleteLoggingProperties(final Collection
LOG.log(Level.INFO, "deleteLoggingProperties(properties={0})", properties);
loadLoggingProperties();
remove(properties);
rewritePropertiesFileAndNotifyMonitoring();
rewritePropertiesFileAndNotifyMonitoring("");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null would be better

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your suggestion.
But existing code uses "" instead of null as below, and using "" and null mixedly would not be desirable...

If we want to refactor this code, method overloading (i.e. defining rewritePropertiesFileAndNotifyMonitoring() and closePropFile() without arguments) would be better rather than using "" and null.
Since doing such refactoring in the current pull request obscures the essense of the bug fix, I think we can do it in another pull request if needed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just replace all those empty strings with null (and in the future this class should never get an empty string target, it should be resolved when parsing the user input). Adding overloaded methods doesn't bring a value in private methods. Refactoring is ok if you put it to separate commit from the fix.

Additional PR means more work to each of us and waiting on CI ;-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I've modified the code to use null instead of "".

@dmatej dmatej added this to the 7.0.21 milestone Dec 17, 2024
@dmatej dmatej added the bug Something isn't working label Dec 17, 2024
@dmatej dmatej merged commit bebc07c into eclipse-ee4j:master Dec 19, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

asadmin delete-log-levels command fails if the --target option is specified
2 participants