From 85c27bdbfa85be8b8ff35818eca3821dea84867d Mon Sep 17 00:00:00 2001 From: jianghuazhu <740087514@qq.com> Date: Wed, 18 Dec 2024 23:42:39 +0800 Subject: [PATCH] HDDS-11960. Improve some Objects.requireNonNull() messages --- .../org/apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java | 4 ++-- .../src/main/java/org/apache/ozone/test/MetricsAsserts.java | 2 +- .../hadoop/ozone/security/acl/OzoneNativeAuthorizer.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java index ec95ab66bf1..d341575f7c5 100644 --- a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java +++ b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/InterSCMGrpcService.java @@ -51,7 +51,7 @@ public class InterSCMGrpcService extends private final Table transactionInfoTable; InterSCMGrpcService(final StorageContainerManager scm) throws IOException { - Objects.requireNonNull(scm, "scm"); + Objects.requireNonNull(scm, "scm == null"); this.scm = scm; this.transactionInfoTable = HAUtils.getTransactionInfoTable( scm.getScmMetadataStore().getStore(), SCMDBDefinition.get()); @@ -65,7 +65,7 @@ public void download(CopyDBCheckpointRequestProto request, scm.getScmHAManager().asSCMHADBTransactionBuffer().flush(); TransactionInfo transactionInfo = transactionInfoTable.get(TRANSACTION_INFO_KEY); - Objects.requireNonNull(transactionInfo, "transactionInfo"); + Objects.requireNonNull(transactionInfo, "transactionInfo == null"); SCMGrpcOutputStream outputStream = new SCMGrpcOutputStream(responseObserver, scm.getClusterId(), BUFFER_SIZE); diff --git a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/MetricsAsserts.java b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/MetricsAsserts.java index f4651a408f7..c7cd7af7875 100644 --- a/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/MetricsAsserts.java +++ b/hadoop-hdds/test-utils/src/main/java/org/apache/ozone/test/MetricsAsserts.java @@ -115,7 +115,7 @@ private static class InfoWithSameName implements ArgumentMatcher { private final String expected; InfoWithSameName(MetricsInfo info) { - expected = Objects.requireNonNull(info.name(), "info name"); + expected = Objects.requireNonNull(info.name(), "info#name == null"); } @Override diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/security/acl/OzoneNativeAuthorizer.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/security/acl/OzoneNativeAuthorizer.java index 28194115e48..67268e8f87e 100644 --- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/security/acl/OzoneNativeAuthorizer.java +++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/security/acl/OzoneNativeAuthorizer.java @@ -215,11 +215,11 @@ void setOzoneReadOnlyAdmins(OzoneAdmins readOnlyAdmins) { } public void setAdminCheck(Predicate check) { - adminCheck = Objects.requireNonNull(check, "admin check"); + adminCheck = Objects.requireNonNull(check, "admin check == null"); } public void setReadOnlyAdminCheck(Predicate check) { - readOnlyAdminCheck = Objects.requireNonNull(check, "read-only admin check"); + readOnlyAdminCheck = Objects.requireNonNull(check, "read-only admin check == null"); } public void setAllowListAllVolumes(boolean allowListAllVolumes) {