hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apurt...@apache.org
Subject svn commit: r1553444 - /hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
Date Thu, 26 Dec 2013 03:51:12 GMT
Author: apurtell
Date: Thu Dec 26 03:51:12 2013
New Revision: 1553444

URL: http://svn.apache.org/r1553444
Log:
Revert HBASE-10238. Revert initial commit and addendum

Modified:
    hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java

Modified: hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java?rev=1553444&r1=1553443&r2=1553444&view=diff
==============================================================================
--- hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
(original)
+++ hbase/branches/0.98/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
Thu Dec 26 03:51:12 2013
@@ -25,6 +25,7 @@ import static org.junit.Assert.fail;
 
 import java.io.IOException;
 import java.lang.reflect.UndeclaredThrowableException;
+import java.security.PrivilegedActionException;
 import java.security.PrivilegedExceptionAction;
 import java.util.List;
 import java.util.Map;
@@ -307,9 +308,9 @@ public class TestAccessController extend
             fail("Expected no results for user '" + user.getShortName() + "'");
           }
         }
-      } catch (Exception e) {
+      } catch (IOException e) {
         boolean isAccessDeniedException = false;
-        if (e instanceof RetriesExhaustedWithDetailsException) {
+        if(e instanceof RetriesExhaustedWithDetailsException) {
           // in case of batch operations, and put, the client assembles a
           // RetriesExhaustedWithDetailsException instead of throwing an
           // AccessDeniedException
@@ -321,9 +322,9 @@ public class TestAccessController extend
           }
         }
         else {
-          // AccessDeniedException can be buried in the stack trace
-          Throwable ex = (e instanceof UndeclaredThrowableException) ?
-            ((UndeclaredThrowableException)e).getUndeclaredThrowable() : e;
+          // For doBulkLoad calls AccessDeniedException
+          // is buried in the stack trace
+          Throwable ex = e;
           do {
             if (ex instanceof AccessDeniedException) {
               isAccessDeniedException = true;
@@ -334,6 +335,20 @@ public class TestAccessController extend
         if (!isAccessDeniedException) {
           fail("Not receiving AccessDeniedException for user '" + user.getShortName() + "'");
         }
+      } catch (UndeclaredThrowableException ute) {
+        // TODO why we get a PrivilegedActionException, which is unexpected?
+        Throwable ex = ute.getUndeclaredThrowable();
+        if (ex instanceof PrivilegedActionException) {
+          ex = ((PrivilegedActionException) ex).getException();
+        }
+        if (ex instanceof ServiceException) {
+          ServiceException se = (ServiceException)ex;
+          if (se.getCause() != null && se.getCause() instanceof AccessDeniedException)
{
+            // expected result
+            return;
+          }
+        }
+        fail("Not receiving AccessDeniedException for user '" + user.getShortName() + "'");
       }
     }
   }



Mime
View raw message