This is an automated email from the ASF dual-hosted git repository.

arshad pushed a commit to branch branch-3.7
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.7 by this push:
     new dfa262b  ZOOKEEPER-3128: Get CLI Command displays Authentication error 
for Authorization error
dfa262b is described below

commit dfa262bfa9dd04ea5017fa29bd68f19800a07d32
Author: Mohammad Arshad <[email protected]>
AuthorDate: Sat Mar 27 22:53:02 2021 +0530

    ZOOKEEPER-3128: Get CLI Command displays Authentication error for 
Authorization error
    
    Handled the scenario missed in ZOOKEEPER-3891
    
    Author: Mohammad Arshad <[email protected]>
    
    Reviewers: Damien Diederen <[email protected]>
    
    Closes #1634 from arshadmohammad/ZOOKEEPER-3128-master
    
    (cherry picked from commit de726d0a824582e482d4a725210fcd6051cb3bd0)
    Signed-off-by: Mohammad Arshad <[email protected]>
---
 .../src/main/java/org/apache/zookeeper/cli/GetCommand.java         | 2 +-
 .../src/test/java/org/apache/zookeeper/ZooKeeperTest.java          | 7 +++++++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git 
a/zookeeper-server/src/main/java/org/apache/zookeeper/cli/GetCommand.java 
b/zookeeper-server/src/main/java/org/apache/zookeeper/cli/GetCommand.java
index 4cdb48d..a10272e 100644
--- a/zookeeper-server/src/main/java/org/apache/zookeeper/cli/GetCommand.java
+++ b/zookeeper-server/src/main/java/org/apache/zookeeper/cli/GetCommand.java
@@ -90,7 +90,7 @@ public class GetCommand extends CliCommand {
         } catch (IllegalArgumentException ex) {
             throw new MalformedPathException(ex.getMessage());
         } catch (KeeperException | InterruptedException ex) {
-            throw new CliException(ex);
+            throw new CliWrapperException(ex);
         }
         data = (data == null) ? "null".getBytes() : data;
         out.println(new String(data, UTF_8));
diff --git 
a/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java 
b/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java
index f69e0c6..47ab6c4 100644
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java
@@ -702,6 +702,13 @@ public class ZooKeeperTest extends ClientBase {
         String zNodeToBeCreated = "/permZNode/child1";
         String errorMessage = executeLine(zkMain, "create " + 
zNodeToBeCreated);
         assertEquals("Insufficient permission : " + zNodeToBeCreated, 
errorMessage);
+
+        // Test Get command error message when there is not read access
+        List<ACL> writeAcl = Arrays.asList(new ACL(ZooDefs.Perms.WRITE, 
Ids.ANYONE_ID_UNSAFE));
+        String noReadPermZNodePath = "/noReadPermZNode";
+        zk.create(noReadPermZNodePath, "newData".getBytes(), writeAcl, 
CreateMode.PERSISTENT);
+        errorMessage = executeLine(zkMain, "get " + noReadPermZNodePath);
+        assertEquals("Insufficient permission : " + noReadPermZNodePath, 
errorMessage);
     }
 
     @Test

Reply via email to