From b5be8694fe8b448f154a1ba99d1413cdb0b9ea63 Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" Date: Wed, 14 May 2025 14:21:26 +0200 Subject: [PATCH] HDDS-12966. DBDefinitionFactory should not throw InvalidArnException --- .../hadoop/ozone/debug/DBDefinitionFactory.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBDefinitionFactory.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBDefinitionFactory.java index 5b082ea49803..ad366b024214 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBDefinitionFactory.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/DBDefinitionFactory.java @@ -21,13 +21,12 @@ import static org.apache.hadoop.ozone.recon.ReconConstants.RECON_CONTAINER_KEY_DB; import static org.apache.hadoop.ozone.recon.ReconConstants.RECON_OM_SNAPSHOT_DB; -import com.amazonaws.services.kms.model.InvalidArnException; -import com.google.common.base.Preconditions; import java.nio.file.Path; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; import org.apache.hadoop.hdds.conf.ConfigurationSource; import org.apache.hadoop.hdds.scm.metadata.SCMDBDefinition; @@ -69,14 +68,12 @@ public static DBDefinition getDefinition(String dbName) { return definition != null ? definition : getReconDBDefinition(dbName); } - public static DBDefinition getDefinition(Path dbPath, + public static DBDefinition getDefinition(Path path, ConfigurationSource config) { - Preconditions.checkNotNull(dbPath, - "Path is required to identify the used db scheme"); + final Path dbPath = Objects.requireNonNull(path, "path == null"); final Path fileName = dbPath.getFileName(); if (fileName == null) { - throw new InvalidArnException( - "Path is required to identify the used db scheme"); + throw new IllegalArgumentException("DB path has no filename"); } String dbName = fileName.toString(); if (dbName.endsWith(OzoneConsts.CONTAINER_DB_SUFFIX)) {