Stephen O'Donnell created HDDS-11669:
----------------------------------------

             Summary: 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


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]

Reply via email to