You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Dhruvil Shah (JIRA)" <ji...@apache.org> on 2018/07/19 20:54:00 UTC

[jira] [Created] (KAFKA-7185) getMatchingAcls throws StringIndexOutOfBoundsException for empty resource name

Dhruvil Shah created KAFKA-7185:
-----------------------------------

             Summary: getMatchingAcls throws StringIndexOutOfBoundsException for empty resource name
                 Key: KAFKA-7185
                 URL: https://issues.apache.org/jira/browse/KAFKA-7185
             Project: Kafka
          Issue Type: Bug
    Affects Versions: 2.0.0
            Reporter: Dhruvil Shah
            Assignee: Dhruvil Shah


KIP-290 introduced a way to match ACLs based on prefix. Certain resource names like that for group id can be empty strings. When an empty string is passed into `getMatchingAcls`, it would throw a `StringIndexOutOfBoundsException` because of the following logic:

```

val prefixed = aclCache.range(
 Resource(resourceType, resourceName, PatternType.PREFIXED),
 Resource(resourceType, resourceName.substring(0, Math.min(1, resourceName.length)), PatternType.PREFIXED)
)
 .filterKeys(resource => resourceName.startsWith(resource.name))
 .flatMap \{ case (resource, versionedAcls) => versionedAcls.acls }
 .toSet

```

This is a regression introduced in 2.0.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)