This is an automated email from the ASF dual-hosted git repository. dlmarion pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
commit aff0cf9ca419de266a12c63b7b827cb9a76699d7 Merge: 7ad91eb32a 8e22bf3e39 Author: Dave Marion <[email protected]> AuthorDate: Wed Apr 5 11:37:55 2023 +0000 Merge remote-tracking branch 'upstream/1.10' into 2.1 .../accumulo/core/security/Authorizations.java | 52 +++++++++++++++++++--- 1 file changed, 46 insertions(+), 6 deletions(-) diff --cc core/src/main/java/org/apache/accumulo/core/security/Authorizations.java index e51196d859,5228107ff8..1cfeebb8b9 --- a/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java +++ b/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java @@@ -152,9 -180,13 +176,13 @@@ public class Authorizations implements if (authsString.startsWith(HEADER)) { // it's the new format authsString = authsString.substring(HEADER.length()); + String[] parts = authsString.split(","); + + this.auths = createInternalSet(parts.length); + this.authsList = createInternalList(parts.length); - if (authsString.length() > 0) { + if (!authsString.isEmpty()) { - for (String encAuth : authsString.split(",")) { - byte[] auth = Base64.getDecoder().decode(encAuth); + for (String encAuth : parts) { + byte[] auth = Base64.getDecoder().decode(encAuth.getBytes(UTF_8)); auths.add(new ArrayByteSequence(auth)); } checkAuths(); @@@ -177,10 -218,15 +214,13 @@@ /** * Constructs an authorizations object from a set of human-readable authorizations. * - * @param authorizations - * array of authorizations - * @throws IllegalArgumentException - * if authorizations is null + * @param authorizations array of authorizations + * @throws IllegalArgumentException if authorizations is null */ public Authorizations(String... authorizations) { + checkArgument(authorizations != null, "authorizations is null"); + this.auths = createInternalSet(authorizations.length); + this.authsList = createInternalList(authorizations.length); setAuthorizations(authorizations); }
