From 89191230ea84ebb917fb01d41a3a0c17fc2d4bec Mon Sep 17 00:00:00 2001 From: Ted Yu Date: Tue, 21 Oct 2014 20:09:14 +0000 Subject: [PATCH] HBASE-12302 VisibilityClient getAuths does not propagate remote service exception correctly (Jerry He) --- .../security/visibility/VisibilityClient.java | 18 +++++++++++++++--- .../visibility/VisibilityController.java | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java index 6ac1d3f395c..6eafb6fb912 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityClient.java @@ -92,7 +92,11 @@ public class VisibilityClient { } } service.addLabels(controller, builder.build(), rpcCallback); - return rpcCallback.get(); + VisibilityLabelsResponse response = rpcCallback.get(); + if (controller.failedOnException()) { + throw controller.getFailedOn(); + } + return response; } }; Map result = ht.coprocessorService( @@ -140,7 +144,11 @@ public class VisibilityClient { GetAuthsRequest.Builder getAuthReqBuilder = GetAuthsRequest.newBuilder(); getAuthReqBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(user))); service.getAuths(controller, getAuthReqBuilder.build(), rpcCallback); - return rpcCallback.get(); + GetAuthsResponse response = rpcCallback.get(); + if (controller.failedOnException()) { + throw controller.getFailedOn(); + } + return response; } }; Map result = ht.coprocessorService(VisibilityLabelsService.class, @@ -191,7 +199,11 @@ public class VisibilityClient { } else { service.clearAuths(controller, setAuthReqBuilder.build(), rpcCallback); } - return rpcCallback.get(); + VisibilityLabelsResponse response = rpcCallback.get(); + if (controller.failedOnException()) { + throw controller.getFailedOn(); + } + return response; } }; Map result = ht.coprocessorService( diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java index ffec917d017..753a75f40f9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/security/visibility/VisibilityController.java @@ -740,7 +740,7 @@ public class VisibilityController extends BaseMasterAndRegionObserver implements User requestingUser = VisibilityUtils.getActiveUser(); throw new AccessDeniedException("User '" + (requestingUser != null ? requestingUser.getShortName() : "null") - + " is not authorized to perform this action."); + + "' is not authorized to perform this action."); } labels = this.visibilityLabelService.getAuths(user, false); } catch (IOException e) {