Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 02B57DC0C for ; Thu, 13 Sep 2012 22:02:28 +0000 (UTC) Received: (qmail 90259 invoked by uid 500); 13 Sep 2012 22:02:27 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 90217 invoked by uid 500); 13 Sep 2012 22:02:27 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 90209 invoked by uid 99); 13 Sep 2012 22:02:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Sep 2012 22:02:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Sep 2012 22:02:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 980CC23889D7 for ; Thu, 13 Sep 2012 22:01:41 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1384558 - in /accumulo/trunk/core/src: main/java/org/apache/accumulo/core/security/Authorizations.java test/java/org/apache/accumulo/core/security/AuthorizationsTest.java Date: Thu, 13 Sep 2012 22:01:41 -0000 To: commits@accumulo.apache.org From: kturner@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120913220141.980CC23889D7@eris.apache.org> Author: kturner Date: Thu Sep 13 22:01:41 2012 New Revision: 1384558 URL: http://svn.apache.org/viewvc?rev=1384558&view=rev Log: ACCUMULO-241 fixed bug in Authorizations serialization introduced in recent changes Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java accumulo/trunk/core/src/test/java/org/apache/accumulo/core/security/AuthorizationsTest.java Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java?rev=1384558&r1=1384557&r2=1384558&view=diff ============================================================================== --- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java (original) +++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/security/Authorizations.java Thu Sep 13 22:01:41 2012 @@ -111,11 +111,14 @@ public class Authorizations implements I String authsString = new String(authorizations); if (authsString.startsWith(HEADER)) { // its the new format - for (String encAuth : authsString.substring(HEADER.length()).split(",")) { - byte[] auth = Base64.decodeBase64(encAuth.getBytes()); - auths.add(new ArrayByteSequence(auth)); + authsString = authsString.substring(HEADER.length()); + if (authsString.length() > 0) { + for (String encAuth : authsString.split(",")) { + byte[] auth = Base64.decodeBase64(encAuth.getBytes()); + auths.add(new ArrayByteSequence(auth)); + } + checkAuths(); } - checkAuths(); } else { // its the old format ArgumentChecker.notNull(authorizations); Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/security/AuthorizationsTest.java URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/security/AuthorizationsTest.java?rev=1384558&r1=1384557&r2=1384558&view=diff ============================================================================== --- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/security/AuthorizationsTest.java (original) +++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/security/AuthorizationsTest.java Thu Sep 13 22:01:41 2012 @@ -35,6 +35,12 @@ public class AuthorizationsTest { byte[] array = a.getAuthorizationsArray(); Authorizations b = new Authorizations(array); assertEquals(a, b); + + // test encoding empty auths + a = new Authorizations(); + array = a.getAuthorizationsArray(); + b = new Authorizations(array); + assertEquals(a, b); } }