This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo-access.git
The following commit(s) were added to refs/heads/main by this push:
new 402d65d Reduce method calls (#106)
402d65d is described below
commit 402d65d643561e61044230ed663b8b89b8326e07
Author: Dave Marion <[email protected]>
AuthorDate: Tue Mar 10 15:20:52 2026 -0400
Reduce method calls (#106)
Reduce calls to term.length() and short-circuit when term
is known to be length of 2 and contain '""'.
---
.../java/org/apache/accumulo/access/impl/AccessExpressionImpl.java | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git
a/modules/core/src/main/java/org/apache/accumulo/access/impl/AccessExpressionImpl.java
b/modules/core/src/main/java/org/apache/accumulo/access/impl/AccessExpressionImpl.java
index 0f47c14..6f4e5bf 100644
---
a/modules/core/src/main/java/org/apache/accumulo/access/impl/AccessExpressionImpl.java
+++
b/modules/core/src/main/java/org/apache/accumulo/access/impl/AccessExpressionImpl.java
@@ -77,8 +77,9 @@ public final class AccessExpressionImpl extends
AccessExpression {
}
public static CharSequence unquote(CharSequence term) {
- if (term.length() >= 2 && term.charAt(0) == '"' &&
term.charAt(term.length() - 1) == '"') {
- term = AccessEvaluatorImpl.unescape(term.subSequence(1, term.length() -
1));
+ int len = term.length();
+ if (len >= 2 && term.charAt(0) == '"' && term.charAt(len - 1) == '"') {
+ term = len == 2 ? "" : AccessEvaluatorImpl.unescape(term.subSequence(1,
term.length() - 1));
}
if (term.isEmpty()) {
throw new IllegalArgumentException("Empty strings are not legal
authorizations.");