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

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


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

commit 62f2e2f0ea1ee78282e7fc51f97dc781614a4a27
Author: Mohammad Arshad <[email protected]>
AuthorDate: Sun Mar 28 09:56:18 2021 +0530

    ZOOKEEPER-3128: Get CLI Command displays Authentication error for 
Authorization error
    
    Author: Mohammad Arshad <[email protected]>
    
    Reviewers: Enrico Olivelli <[email protected]>
    
    Closes #1656 from arshadmohammad/ZOOKEEPER-3128-branch-3.6
---
 .../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 57821ed..0558f09 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));
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 859d13c..8fc3df2 100644
--- a/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java
+++ b/zookeeper-server/src/test/java/org/apache/zookeeper/ZooKeeperTest.java
@@ -698,6 +698,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