HBASE-10238. TestAccessController#verifyDenied can fail even if ADE is thrown
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1553411 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ce61a9f638
commit
5c6d5731d7
|
@ -25,7 +25,6 @@ import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.UndeclaredThrowableException;
|
import java.lang.reflect.UndeclaredThrowableException;
|
||||||
import java.security.PrivilegedActionException;
|
|
||||||
import java.security.PrivilegedExceptionAction;
|
import java.security.PrivilegedExceptionAction;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -308,7 +307,7 @@ public class TestAccessController extends SecureTestUtil {
|
||||||
fail("Expected no results for user '" + user.getShortName() + "'");
|
fail("Expected no results for user '" + user.getShortName() + "'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
boolean isAccessDeniedException = false;
|
boolean isAccessDeniedException = false;
|
||||||
if (e instanceof RetriesExhaustedWithDetailsException) {
|
if (e instanceof RetriesExhaustedWithDetailsException) {
|
||||||
// in case of batch operations, and put, the client assembles a
|
// in case of batch operations, and put, the client assembles a
|
||||||
|
@ -335,20 +334,6 @@ public class TestAccessController extends SecureTestUtil {
|
||||||
if (!isAccessDeniedException) {
|
if (!isAccessDeniedException) {
|
||||||
fail("Not receiving AccessDeniedException for user '" + user.getShortName() + "'");
|
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() + "'");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue