You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by dl...@apache.org on 2022/08/23 17:25:47 UTC
[accumulo] branch main updated: Prevent null exception message in HighlyAvailableServiceInvocationHandler (#2892)
This is an automated email from the ASF dual-hosted git repository.
dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new a63f06dbc2 Prevent null exception message in HighlyAvailableServiceInvocationHandler (#2892)
a63f06dbc2 is described below
commit a63f06dbc2d575f4cccf08e9129902ddeacac0cf
Author: Dave Marion <dl...@apache.org>
AuthorDate: Tue Aug 23 13:25:42 2022 -0400
Prevent null exception message in HighlyAvailableServiceInvocationHandler (#2892)
---
.../java/org/apache/accumulo/server/HighlyAvailableService.java | 9 +++++++++
.../server/rpc/HighlyAvailableServiceInvocationHandler.java | 4 ++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/server/base/src/main/java/org/apache/accumulo/server/HighlyAvailableService.java b/server/base/src/main/java/org/apache/accumulo/server/HighlyAvailableService.java
index 3dea81b63f..4d529369a0 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/HighlyAvailableService.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/HighlyAvailableService.java
@@ -39,4 +39,13 @@ public interface HighlyAvailableService {
default boolean isUpgrading() {
return false;
}
+
+ /**
+ * Get the name of the service
+ *
+ * @return service name
+ */
+ default String getServiceName() {
+ return this.getClass().getSimpleName();
+ }
}
diff --git a/server/base/src/main/java/org/apache/accumulo/server/rpc/HighlyAvailableServiceInvocationHandler.java b/server/base/src/main/java/org/apache/accumulo/server/rpc/HighlyAvailableServiceInvocationHandler.java
index 426e7b60d6..a0e8a9453a 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/rpc/HighlyAvailableServiceInvocationHandler.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/rpc/HighlyAvailableServiceInvocationHandler.java
@@ -51,14 +51,14 @@ public class HighlyAvailableServiceInvocationHandler<I> implements InvocationHan
// If the service is upgrading, throw an exception
if (service.isUpgrading()) {
LOG.trace("Service can not be accessed while it is upgrading.");
- throw new ThriftNotActiveServiceException(service.toString(),
+ throw new ThriftNotActiveServiceException(service.getServiceName(),
"Service can not be accessed while it is upgrading");
}
// If the service is not active, throw an exception
if (!service.isActiveService()) {
LOG.trace("Denying access to RPC service as this instance is not the active instance.");
- throw new ThriftNotActiveServiceException(service.toString(),
+ throw new ThriftNotActiveServiceException(service.getServiceName(),
"Denying access to RPC service as this instance is not the active instance");
}
try {