[
https://issues.apache.org/jira/browse/HDDS-11669?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated HDDS-11669:
----------------------------------
Labels: pull-request-available (was: )
> In OmUtils.normalizeKey isDebugEnabled should be evaluated first
> ----------------------------------------------------------------
>
> Key: HDDS-11669
> URL: https://issues.apache.org/jira/browse/HDDS-11669
> Project: Apache Ozone
> Issue Type: Improvement
> Components: OM
> Reporter: Stephen O'Donnell
> Assignee: Stephen O'Donnell
> Priority: Major
> Labels: pull-request-available
>
> In OmUtils.normalizeKey(), the code:
> {code}
> if (!keyName.equals(normalizedKeyName) && LOG.isDebugEnabled()) {
> LOG.debug("Normalized key {} to {} ", keyName,
> normalizedKeyName.substring(1));
> }
> {code}
> Always executes the `String.equals()`, but it does not do anything unless
> debug is enabled.
> Debug should be first in the if statement as predicates are evaluated left to
> right and if isDebugEnabled returns false, the more expensive string compare
> will not execute.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]