You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Stephen O'Donnell (Jira)" <ji...@apache.org> on 2024/11/08 12:15:00 UTC

[jira] [Created] (HDDS-11669) In OmUtils.normalizeKey isDebugEnabled should be evaluated first

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: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org