HBASE-12302 VisibilityClient getAuths does not propagate remote service exception correctly (Jerry He)

This commit is contained in:
Ted Yu 2014-10-21 20:09:46 +00:00
parent 5d1e9a32a4
commit 6c70f4f7f7
2 changed files with 16 additions and 4 deletions

View File

@ -92,7 +92,11 @@ public class VisibilityClient {
} }
} }
service.addLabels(controller, builder.build(), rpcCallback); service.addLabels(controller, builder.build(), rpcCallback);
return rpcCallback.get(); VisibilityLabelsResponse response = rpcCallback.get();
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
return response;
} }
}; };
Map<byte[], VisibilityLabelsResponse> result = ht.coprocessorService( Map<byte[], VisibilityLabelsResponse> result = ht.coprocessorService(
@ -140,7 +144,11 @@ public class VisibilityClient {
GetAuthsRequest.Builder getAuthReqBuilder = GetAuthsRequest.newBuilder(); GetAuthsRequest.Builder getAuthReqBuilder = GetAuthsRequest.newBuilder();
getAuthReqBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(user))); getAuthReqBuilder.setUser(ByteStringer.wrap(Bytes.toBytes(user)));
service.getAuths(controller, getAuthReqBuilder.build(), rpcCallback); service.getAuths(controller, getAuthReqBuilder.build(), rpcCallback);
return rpcCallback.get(); GetAuthsResponse response = rpcCallback.get();
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
return response;
} }
}; };
Map<byte[], GetAuthsResponse> result = ht.coprocessorService(VisibilityLabelsService.class, Map<byte[], GetAuthsResponse> result = ht.coprocessorService(VisibilityLabelsService.class,
@ -191,7 +199,11 @@ public class VisibilityClient {
} else { } else {
service.clearAuths(controller, setAuthReqBuilder.build(), rpcCallback); service.clearAuths(controller, setAuthReqBuilder.build(), rpcCallback);
} }
return rpcCallback.get(); VisibilityLabelsResponse response = rpcCallback.get();
if (controller.failedOnException()) {
throw controller.getFailedOn();
}
return response;
} }
}; };
Map<byte[], VisibilityLabelsResponse> result = ht.coprocessorService( Map<byte[], VisibilityLabelsResponse> result = ht.coprocessorService(

View File

@ -740,7 +740,7 @@ public class VisibilityController extends BaseMasterAndRegionObserver implements
User requestingUser = VisibilityUtils.getActiveUser(); User requestingUser = VisibilityUtils.getActiveUser();
throw new AccessDeniedException("User '" throw new AccessDeniedException("User '"
+ (requestingUser != null ? requestingUser.getShortName() : "null") + (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); labels = this.visibilityLabelService.getAuths(user, false);
} catch (IOException e) { } catch (IOException e) {