Attila Doroszlai created HDDS-14605:
---------------------------------------

             Summary: Remove usage of Netty internal StringUtil
                 Key: HDDS-14605
                 URL: https://issues.apache.org/jira/browse/HDDS-14605
             Project: Apache Ozone
          Issue Type: Sub-task
          Components: build, common
            Reporter: Attila Doroszlai


{{OzoneIdentityProvider}} should not use {{io.netty.util.internal.StringUtil}}.

{code:title=https://github.com/apache/ozone/blob/a04072e870bd43489d577ef546c7cedf7f9aa8cf/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OzoneIdentityProvider.java#L61-L64}
      if (Objects.nonNull(callerContext) &&
          !StringUtil.isNullOrEmpty(callerContext.getContext()) &&
          callerContext.getContext()
              .startsWith(OM_S3_CALLER_CONTEXT_PREFIX)) {
{code}

Replace {{\!StringUtil.isNullOrEmpty}} with a simple {{!= null}} check.  No 
need to check for empty string, since the next condition verifies the string 
starts with some prefix.

Remove dependency on {{netty-common}} in {{ozone-common}}:

{code:title=https://github.com/apache/ozone/blob/4ea7bb1aece49576e412ff8c6e057f8130e58558/hadoop-ozone/common/pom.xml#L64-L67}
    <dependency>
      <groupId>io.netty</groupId>
      <artifactId>netty-common</artifactId>
    </dependency>
{code}

Ban import of {{io.netty.util.internal.**}} in root POM, like:

{code}
                  <restrictImports>
                    <includeTestCode>true</includeTestCode>
                    <reason>Avoid using private API</reason>
                    <bannedImports>
                      <bannedImport>io.netty.util.internal.**</bannedImport>
                    </bannedImports>
                  </restrictImports>
{code}



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