[MAGNOLIA-8337] CommandsManager spams startup logs with deprecation warnings Created: 08/Mar/22  Updated: 20/Jul/22  Resolved: 22/Apr/22

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 6.2.17
Fix Version/s: 6.2.19

Type: Bug Priority: Neutral
Reporter: Tim Molenaar Assignee: Alejandro Gomez
Resolution: Fixed Votes: 0
Labels: nucleus
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
duplicate
is duplicated by MGNLEE-685 Deprecation warning from CommandManager. Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[X]* Doc/release notes changes? Comment present?
[X]* Downstream builds green?
[X]* Solution information and context easily available?
[X]* Tests
[X]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[X]* Steps to reproduce, expected, and actual results filled
[X]* Affected version filled
Date of First Response:
Epic Link: Nucleus Quality Maintenance
Sprint: Nucleus 8
Story Points: 1
Team: Nucleus

 Description   

Steps to reproduce

  1. Start Magnolia 6
  2. See the following deprecation warning(s) in the startup-logs:
2022-03-08T10:46:59,202 WARN  info.magnolia.cms.util.WorkspaceObservingManager  : A deprecated class or method was used: Use reload() instead. Check the following trace: info.magnolia.commands.CommandsManager.reload(CommandsManager.java:269), info.magnolia.cms.util.WorkspaceObservingManager.start(WorkspaceObservingManager.java:91), the full stacktrace will be logged in debug mode in the info.magnolia.cms.util.DeprecationUtil category.
2022-03-08T10:46:59,202 WARN  info.magnolia.cms.util.DeprecationUtil            : A deprecated class or method was used: Use reload() instead. Check the following trace: info.magnolia.commands.CommandsManager.reload(CommandsManager.java:269), info.magnolia.cms.util.WorkspaceObservingManager.start(WorkspaceObservingManager.java:91), the full stacktrace will be logged in debug mode in the info.magnolia.cms.util.DeprecationUtil category.
A deprecated class or method was used: Use reload() instead. Check the following trace: info.magnolia.commands.CommandsManager.reload(CommandsManager.java:269), info.magnolia.cms.util.WorkspaceObservingManager.start(WorkspaceObservingManager.java:91), the full stacktrace will be logged in debug mode in the info.magnolia.cms.util.DeprecationUtil category.
A deprecated class or method was used: Use reload() instead. Check the following trace: info.magnolia.commands.CommandsManager.reload(CommandsManager.java:269), info.magnolia.cms.util.WorkspaceObservingManager.start(WorkspaceObservingManager.java:91), the full stacktrace will be logged in debug mode in the info.magnolia.cms.util.DeprecationUtil category.
 

Expected results

No warnings about deprecated classes CommandsManager and WorkspaceObservingManager 

Actual results

CommandsManager still uses the deprecated method reload()

(line 268)

and produces warnings in the logs

Workaround

Development notes

Remove the deprecation utility call and leave the annotation
 



 Comments   
Comment by Fernando Cherchi [ 23/Mar/22 ]

Discovery Completed:

The method reload() from CommandsManager should not be public. If that method would be removed, the warning would be gone and the protected super.reload method would be called. There is no extra logic to that method except the Deprecated Message and a call to super.reload.

However, the method is being called from the outside of the hierarchy at least on the class CacheMonitor, providing a logic to reload in case the command would not be available yet.

That code in CacheMonitor.getCommand(String) includes a TODO:

 

// TODO: why does it happen that commands are not ready?  

commandsManager.reload();

 

In this case, we cannot remove the CommandsManager because the CacheMonitor would not compile as the reload would become protected and thus, not accessible.

 

Comment by Rabie Hayoun [ 25/Mar/22 ]

Remove the deprecation utility call and leave the annotation

Generated at Mon Feb 12 04:31:49 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.