Jens Berke created DELTASPIKE-1346:
--------------------------------------
Summary: ProjectStageProducer should log changed values only if
the value changed
Key: DELTASPIKE-1346
URL: https://issues.apache.org/jira/browse/DELTASPIKE-1346
Project: DeltaSpike
Issue Type: Bug
Components: Core
Affects Versions: 1.8.2
Reporter: Jens Berke
The change in DELTASPIKE-1329 logs a message every time the project stage is
set, even is the new value is the same as the previous one, and it can flood
your log with numerous messages "change project-stage from UnitTest to
UnitTest" when running unit tests.
I think it's better if the message is only logged if the new value is actually
different from the previous one - which also seems to have been the intention
of DELTASPIKE-1329 according to its summary.
Example for an implementation:
{code:java}
String psNameOld = projectStage == null ? "" : projectStage.toString();
String psNameNew = ps == null ? "" : ps.toString();
if (!psNameNew.equals(psNameOld)) {
LOG.info("change project-stage from " + projectStage + " to " + ps);
}{code}
For DeltaSpike versions which require at least Java 1.7. and later, and if
ProjectStage had a proper equals method, this could be simplified to:
{code:java}
if (!Objects.equals(projectStage, ps)) {
LOG.info("change project-stage from " + projectStage + " to " + ps);
}{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)