keith-turner commented on a change in pull request #9: ACCUMULO-4717 Refactor 
WalkingSecurity to use API
URL: https://github.com/apache/accumulo-testing/pull/9#discussion_r146929943
 
 

 ##########
 File path: 
core/src/main/java/org/apache/accumulo/testing/core/randomwalk/security/AlterTable.java
 ##########
 @@ -34,13 +35,26 @@
 
   @Override
   public void visit(State state, RandWalkEnv env, Properties props) throws 
Exception {
-    Connector conn = 
env.getAccumuloInstance().getConnector(WalkingSecurity.get(state, 
env).getSysUserName(), WalkingSecurity.get(state, env).getSysToken());
+    String systemUser = WalkingSecurity.get(state, env).getSysUserName();
+    Connector conn = env.getAccumuloInstance().getConnector(systemUser, 
WalkingSecurity.get(state, env).getSysToken());
 
     String tableName = WalkingSecurity.get(state, env).getTableName();
 
     boolean exists = WalkingSecurity.get(state, env).getTableExists();
-    boolean hasPermission = 
conn.securityOperations().hasTablePermission(WalkingSecurity.get(state, 
env).getSysUserName(), tableName,
-        TablePermission.ALTER_TABLE);
+    boolean hasPermission;
+    try {
+      hasPermission = conn.securityOperations().hasTablePermission(systemUser, 
tableName, TablePermission.ALTER_TABLE)
+          || conn.securityOperations().hasSystemPermission(systemUser, 
SystemPermission.ALTER_TABLE);
+    } catch (AccumuloSecurityException ae) {
+      if 
(ae.getSecurityErrorCode().equals(SecurityErrorCode.TABLE_DOESNT_EXIST)) {
+        if (exists)
+          throw new TableExistsException(null, tableName, "Got a 
TableNotFoundException but it should exist", ae);
 
 Review comment:
   why throw TableExistsExcep?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to