From 23315867e721cd18e63a5ed6dac545b452175571 Mon Sep 17 00:00:00 2001 From: Nandakumar Vadivelu Date: Thu, 7 Nov 2024 13:45:24 +0530 Subject: [PATCH 1/4] HDDS-64. OzoneClientException should extend IOException --- .../ozone/client/OzoneClientException.java | 8 ++---- .../hadoop/ozone/client/TestOzoneClient.java | 2 +- .../ozone/client/rpc/OzoneRpcClientTests.java | 5 ++-- .../admin/om/GetServiceRolesSubcommand.java | 3 +- .../admin/om/UpdateRangerSubcommand.java | 4 +-- .../hadoop/ozone/debug/ChunkKeyHandler.java | 3 +- .../ozone/debug/CompactionLogDagPrinter.java | 3 +- .../ozone/debug/FindMissingPadding.java | 3 +- .../hadoop/ozone/debug/ReadReplicas.java | 3 +- .../apache/hadoop/ozone/shell/Handler.java | 7 ++--- .../hadoop/ozone/shell/OzoneAddress.java | 28 +++++++++---------- .../hadoop/ozone/shell/bucket/BucketUri.java | 5 ++-- .../ozone/shell/bucket/SetEncryptionKey.java | 3 +- .../bucket/SetReplicationConfigHandler.java | 3 +- .../shell/bucket/UpdateBucketHandler.java | 3 +- .../ozone/shell/common/VolumeBucketUri.java | 5 ++-- .../ozone/shell/keys/CatKeyHandler.java | 3 +- .../ozone/shell/keys/ChecksumKeyHandler.java | 3 +- .../ozone/shell/keys/CopyKeyHandler.java | 3 +- .../ozone/shell/keys/DeleteKeyHandler.java | 3 +- .../ozone/shell/keys/GetKeyHandler.java | 2 +- .../hadoop/ozone/shell/keys/KeyUri.java | 5 ++-- .../ozone/shell/keys/ListKeyHandler.java | 3 +- .../ozone/shell/keys/PutKeyHandler.java | 3 +- .../ozone/shell/keys/RenameKeyHandler.java | 3 +- .../ozone/shell/keys/RewriteKeyHandler.java | 3 +- .../hadoop/ozone/shell/prefix/PrefixUri.java | 5 ++-- .../hadoop/ozone/shell/s3/S3Handler.java | 5 ++-- .../shell/snapshot/RenameSnapshotHandler.java | 3 +- .../ozone/shell/tenant/TenantHandler.java | 5 ++-- .../ozone/shell/token/CancelTokenHandler.java | 3 +- .../ozone/shell/token/GetTokenHandler.java | 5 ++-- .../ozone/shell/token/RenewTokenHandler.java | 3 +- .../ozone/shell/volume/ListVolumeHandler.java | 3 +- .../hadoop/ozone/shell/volume/VolumeUri.java | 5 ++-- .../hadoop/ozone/shell/TestOzoneAddress.java | 13 +++++---- .../shell/TestOzoneAddressClientCreation.java | 28 +++++++++---------- .../shell/keys/TestChecksumKeyHandler.java | 3 +- 38 files changed, 88 insertions(+), 112 deletions(-) diff --git a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientException.java b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientException.java index 2e9080a66f8..e2d87921b5c 100644 --- a/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientException.java +++ b/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneClientException.java @@ -17,10 +17,12 @@ */ package org.apache.hadoop.ozone.client; +import java.io.IOException; + /** * This exception is thrown by the Ozone Clients. */ -public class OzoneClientException extends Exception { +public class OzoneClientException extends IOException { public OzoneClientException() { } @@ -36,8 +38,4 @@ public OzoneClientException(Throwable throwable) { super(throwable); } - public OzoneClientException(String s, Throwable throwable, boolean b, - boolean b1) { - super(s, throwable, b, b1); - } } diff --git a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClient.java b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClient.java index 09a6c0a5c0e..e03fa461cc6 100644 --- a/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClient.java +++ b/hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/TestOzoneClient.java @@ -117,7 +117,7 @@ public void testDeleteVolume() @Test public void testCreateVolumeWithMetadata() - throws IOException, OzoneClientException { + throws IOException { String volumeName = UUID.randomUUID().toString(); VolumeArgs volumeArgs = VolumeArgs.newBuilder() .addMetadata("key1", "val1") diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClientTests.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClientTests.java index 6edef789b17..5d006e47e76 100644 --- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClientTests.java +++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/OzoneRpcClientTests.java @@ -90,7 +90,6 @@ import org.apache.hadoop.ozone.client.ObjectStore; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneClientFactory; import org.apache.hadoop.ozone.client.OzoneKey; import org.apache.hadoop.ozone.client.OzoneKeyDetails; @@ -624,7 +623,7 @@ public void testDeleteVolume() @Test public void testCreateVolumeWithMetadata() - throws IOException, OzoneClientException { + throws IOException { String volumeName = UUID.randomUUID().toString(); VolumeArgs volumeArgs = VolumeArgs.newBuilder() .addMetadata("key1", "val1") @@ -639,7 +638,7 @@ public void testCreateVolumeWithMetadata() @Test public void testCreateBucketWithMetadata() - throws IOException, OzoneClientException { + throws IOException { String volumeName = UUID.randomUUID().toString(); String bucketName = UUID.randomUUID().toString(); store.createVolume(volumeName); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java index bdeba91e411..50eb772f18f 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java @@ -22,7 +22,6 @@ import org.apache.hadoop.hdds.cli.HddsVersionProvider; import org.apache.hadoop.hdds.protocol.proto.HddsProtos; import org.apache.hadoop.hdds.server.JsonUtils; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRoleInfo; import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol; import org.apache.hadoop.ozone.om.helpers.ServiceInfo; @@ -94,7 +93,7 @@ public Void call() throws Exception { } else { printOmServerRoles(ozoneManagerClient.getServiceList()); } - } catch (OzoneClientException ex) { + } catch (IOException ex) { System.out.printf("Error: %s", ex.getMessage()); } finally { if (ozoneManagerClient != null) { diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/UpdateRangerSubcommand.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/UpdateRangerSubcommand.java index 4234ee29d12..7f51ac8f76e 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/UpdateRangerSubcommand.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/UpdateRangerSubcommand.java @@ -20,10 +20,10 @@ import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.hdds.cli.HddsVersionProvider; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol; import picocli.CommandLine; +import java.io.IOException; import java.util.concurrent.Callable; /** @@ -87,7 +87,7 @@ public Void call() throws Exception { + "Check OM log for details"); } - } catch (OzoneClientException ex) { + } catch (IOException ex) { System.err.printf("Error: %s", ex.getMessage()); } return null; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ChunkKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ChunkKeyHandler.java index b5b2364007f..fe114947f2a 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ChunkKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ChunkKeyHandler.java @@ -41,7 +41,6 @@ import org.apache.hadoop.hdds.server.JsonUtils; import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.container.common.impl.ContainerLayoutVersion; import org.apache.hadoop.ozone.om.helpers.OmKeyArgs; import org.apache.hadoop.ozone.om.helpers.OmKeyInfo; @@ -74,7 +73,7 @@ private String getChunkLocationPath(String containerLocation) { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { try (ContainerOperationClient containerOperationClient = new ContainerOperationClient(parent.getOzoneConf()); XceiverClientManager xceiverClientManager = containerOperationClient.getXceiverClientManager()) { OzoneManagerProtocol ozoneManagerClient = client.getObjectStore().getClientProxy().getOzoneManagerClient(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/CompactionLogDagPrinter.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/CompactionLogDagPrinter.java index 18c13d67cf2..91d033729ad 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/CompactionLogDagPrinter.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/CompactionLogDagPrinter.java @@ -20,7 +20,6 @@ import org.apache.hadoop.hdds.cli.SubcommandWithParent; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Handler; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.kohsuke.MetaInfServices; @@ -63,7 +62,7 @@ public Class getParentType() { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { String message = client.getObjectStore() .printCompactionLogDag(fileNamePrefix, graphType); System.out.println(message); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/FindMissingPadding.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/FindMissingPadding.java index 0c7ba187ce1..2f1e6a8a943 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/FindMissingPadding.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/FindMissingPadding.java @@ -38,7 +38,6 @@ import org.apache.hadoop.ozone.client.ObjectStore; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneKey; import org.apache.hadoop.ozone.client.OzoneKeyDetails; import org.apache.hadoop.ozone.client.OzoneKeyLocation; @@ -96,7 +95,7 @@ public class FindMissingPadding extends Handler implements SubcommandWithParent private final Set affectedKeys = new HashSet<>(); @Override - protected OzoneAddress getAddress() throws OzoneClientException { + protected OzoneAddress getAddress() throws IOException { return new OzoneAddress(uri); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ReadReplicas.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ReadReplicas.java index 48ed7c74ae7..fd93d75cd5d 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ReadReplicas.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/ReadReplicas.java @@ -24,7 +24,6 @@ import org.apache.hadoop.hdds.server.JsonUtils; import org.apache.hadoop.hdds.utils.IOUtils; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneKeyDetails; import org.apache.hadoop.ozone.client.io.OzoneInputStream; import org.apache.hadoop.ozone.client.protocol.ClientProtocol; @@ -90,7 +89,7 @@ public Class getParentType() { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { address.ensureKeyAddress(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/Handler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/Handler.java index ae5edf5b1f7..d48d997e2fd 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/Handler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/Handler.java @@ -31,7 +31,6 @@ import org.apache.hadoop.ozone.OzoneSecurityUtil; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine; @@ -64,12 +63,12 @@ public OzoneConfiguration createOzoneConfiguration() { return parent.createOzoneConfiguration(); } - protected OzoneAddress getAddress() throws OzoneClientException { + protected OzoneAddress getAddress() throws IOException { return new OzoneAddress(); } protected abstract void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException; + throws IOException; /** * Checks whether the current command should be executed or not. @@ -102,7 +101,7 @@ public Void call() throws Exception { } protected OzoneClient createClient(OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { return address.createClient(conf); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java index f2fa1a8c4f3..b13091a39e1 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java @@ -64,12 +64,12 @@ public class OzoneAddress { private boolean isPrefix = false; - public OzoneAddress() throws OzoneClientException { + public OzoneAddress() throws IOException { this("o3:///"); } public OzoneAddress(String address) - throws OzoneClientException { + throws IOException { if (address == null || address.equals("")) { address = OZONE_RPC_SCHEME + ":///"; } @@ -123,7 +123,7 @@ protected OzoneClient createRpcClientFromServiceId( } public OzoneClient createClient(MutableConfigurationSource conf) - throws IOException, OzoneClientException { + throws IOException { OzoneClient client; String scheme = ozoneURI.getScheme(); if (ozoneURI.getScheme() == null || scheme.isEmpty()) { @@ -185,13 +185,12 @@ public OzoneClient createClient(MutableConfigurationSource conf) * @param omServiceID * @return OzoneClient * @throws IOException - * @throws OzoneClientException */ public OzoneClient createClientForS3Commands( OzoneConfiguration conf, String omServiceID ) - throws IOException, OzoneClientException { + throws IOException { Collection serviceIds = conf. getTrimmedStringCollection(OZONE_OM_SERVICE_IDS_KEY); if (omServiceID != null) { @@ -227,8 +226,7 @@ public OzoneClient createClientForS3Commands( * @param uri - UriString * @return URI */ - protected URI parseURI(String uri) - throws OzoneClientException { + protected URI parseURI(String uri) throws IOException { if ((uri == null) || uri.isEmpty()) { throw new OzoneClientException( "Ozone URI is needed to execute this command."); @@ -338,7 +336,7 @@ public boolean isPrefix() { return isPrefix; } - public void ensureBucketAddress() throws OzoneClientException { + public void ensureBucketAddress() throws IOException { if (keyName.length() > 0) { throw new OzoneClientException( "Invalid bucket name. Delimiters (/) not allowed in bucket name"); @@ -353,7 +351,7 @@ public void ensureBucketAddress() throws OzoneClientException { // Ensure prefix address with a prefix flag // Allow CLI to differentiate key and prefix address - public void ensurePrefixAddress() throws OzoneClientException { + public void ensurePrefixAddress() throws IOException { if (keyName.length() == 0) { throw new OzoneClientException( "prefix name is missing."); @@ -367,7 +365,7 @@ public void ensurePrefixAddress() throws OzoneClientException { isPrefix = true; } - public void ensureKeyAddress() throws OzoneClientException { + public void ensureKeyAddress() throws IOException { if (keyName.length() == 0) { throw new OzoneClientException( "Key name is missing."); @@ -387,10 +385,10 @@ public void ensureKeyAddress() throws OzoneClientException { * If the keyName can't be considered * a valid snapshot, an exception is thrown. * - * @throws OzoneClientException + * @throws IOException */ public void ensureSnapshotAddress() - throws OzoneClientException { + throws IOException { if (keyName.length() > 0) { if (OmUtils.isBucketSnapshotIndicator(keyName)) { snapshotNameWithIndicator = keyName; @@ -409,7 +407,7 @@ public void ensureSnapshotAddress() } } - public void ensureVolumeAddress() throws OzoneClientException { + public void ensureVolumeAddress() throws IOException { if (keyName.length() != 0) { throw new OzoneClientException( "Invalid volume name. Delimiters (/) not allowed in volume name"); @@ -422,7 +420,7 @@ public void ensureVolumeAddress() throws OzoneClientException { } } - public void ensureRootAddress() throws OzoneClientException { + public void ensureRootAddress() throws IOException { if (keyName.length() != 0 || bucketName.length() != 0 || volumeName.length() != 0) { throw new OzoneClientException( @@ -466,7 +464,7 @@ public void print(PrintStream out) { } } - public void ensureVolumeOrBucketAddress() throws OzoneClientException { + public void ensureVolumeOrBucketAddress() throws IOException { if (keyName.length() > 0) { if (OmUtils.isBucketSnapshotIndicator(keyName)) { // If snapshot, ensure snapshot URI diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketUri.java index 9a1c62d0af0..a7f49e0e6db 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketUri.java @@ -17,11 +17,12 @@ */ package org.apache.hadoop.ozone.shell.bucket; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Shell; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine; +import java.io.IOException; + /** * URI parameter for bucket-specific commands. */ @@ -40,7 +41,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws OzoneClientException { + public OzoneAddress convert(String str) throws IOException { OzoneAddress address = new OzoneAddress(str); address.ensureBucketAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/SetEncryptionKey.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/SetEncryptionKey.java index 86a50e9df3c..3df65165fa8 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/SetEncryptionKey.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/SetEncryptionKey.java @@ -19,7 +19,6 @@ import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine; @@ -70,7 +69,7 @@ public class SetEncryptionKey extends BucketHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/SetReplicationConfigHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/SetReplicationConfigHandler.java index 45d66fd1c3d..258a73aa93b 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/SetReplicationConfigHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/SetReplicationConfigHandler.java @@ -21,7 +21,6 @@ import org.apache.hadoop.ozone.OzoneIllegalArgumentException; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.ShellReplicationOptions; import picocli.CommandLine; @@ -40,7 +39,7 @@ public class SetReplicationConfigHandler extends BucketHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { ReplicationConfig replicationConfig = replication.fromParams(getConf()) .orElseThrow(() -> new OzoneIllegalArgumentException( "Replication type and config must be specified.")); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/UpdateBucketHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/UpdateBucketHandler.java index 7ba62a5ce1c..e36fbce63e8 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/UpdateBucketHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/UpdateBucketHandler.java @@ -19,7 +19,6 @@ import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine.Command; @@ -40,7 +39,7 @@ public class UpdateBucketHandler extends BucketHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/common/VolumeBucketUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/common/VolumeBucketUri.java index fb86fd9eaa5..118c409934c 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/common/VolumeBucketUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/common/VolumeBucketUri.java @@ -17,11 +17,12 @@ */ package org.apache.hadoop.ozone.shell.common; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.Shell; import picocli.CommandLine; +import java.io.IOException; + /** * URI parameter for volume or bucket specific commands. */ @@ -41,7 +42,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws OzoneClientException { + public OzoneAddress convert(String str) throws IOException { OzoneAddress address = new OzoneAddress(str); address.ensureVolumeOrBucketAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/CatKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/CatKeyHandler.java index 328c56f82e3..41a3e142a8d 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/CatKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/CatKeyHandler.java @@ -21,7 +21,6 @@ import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine.Command; @@ -38,7 +37,7 @@ public class CatKeyHandler extends KeyHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ChecksumKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ChecksumKeyHandler.java index b8acf783d6f..6bb25dc2ad8 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ChecksumKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ChecksumKeyHandler.java @@ -22,7 +22,6 @@ import org.apache.hadoop.hdds.scm.OzoneClientConfig; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneKeyDetails; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.client.protocol.ClientProtocol; @@ -49,7 +48,7 @@ public class ChecksumKeyHandler extends KeyHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { ChecksumInfo checksumInfo = new ChecksumInfo(address, client, mode); printObjectAsJson(checksumInfo); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/CopyKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/CopyKeyHandler.java index 81d2dbcae6a..a304dada153 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/CopyKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/CopyKeyHandler.java @@ -29,7 +29,6 @@ import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneKeyDetails; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.shell.OzoneAddress; @@ -64,7 +63,7 @@ public class CopyKeyHandler extends BucketHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/DeleteKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/DeleteKeyHandler.java index 4c795f1e82b..a67343976e7 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/DeleteKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/DeleteKeyHandler.java @@ -22,7 +22,6 @@ import org.apache.hadoop.ozone.OmUtils; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneKeyDetails; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.om.exceptions.OMException; @@ -55,7 +54,7 @@ public class DeleteKeyHandler extends KeyHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/GetKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/GetKeyHandler.java index 501a64238f0..c01f93da9c7 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/GetKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/GetKeyHandler.java @@ -61,7 +61,7 @@ public class GetKeyHandler extends KeyHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyUri.java index b2caf0d4779..fd5dbe04e59 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyUri.java @@ -17,11 +17,12 @@ */ package org.apache.hadoop.ozone.shell.keys; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Shell; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine; +import java.io.IOException; + /** * URI parameter for key-specific commands. */ @@ -40,7 +41,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws OzoneClientException { + public OzoneAddress convert(String str) throws IOException { OzoneAddress address = new OzoneAddress(str); address.ensureKeyAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java index 00652b58a95..c96e5e2b59e 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/ListKeyHandler.java @@ -24,7 +24,6 @@ import com.google.common.base.Strings; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneKey; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.shell.ListOptions; @@ -47,7 +46,7 @@ public class ListKeyHandler extends VolumeBucketHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { if (!Strings.isNullOrEmpty(address.getBucketName())) { listKeysInsideBucket(client, address); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/PutKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/PutKeyHandler.java index 35095dd7ff2..30543f79074 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/PutKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/PutKeyHandler.java @@ -37,7 +37,6 @@ import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.client.io.OzoneDataStreamOutput; import org.apache.hadoop.ozone.client.io.OzoneOutputStream; @@ -75,7 +74,7 @@ public class PutKeyHandler extends KeyHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/RenameKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/RenameKeyHandler.java index f71ac094faf..e48f0804967 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/RenameKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/RenameKeyHandler.java @@ -19,7 +19,6 @@ import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.bucket.BucketHandler; @@ -46,7 +45,7 @@ public class RenameKeyHandler extends BucketHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/RewriteKeyHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/RewriteKeyHandler.java index 35e8da5f381..3dead7a979f 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/RewriteKeyHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/RewriteKeyHandler.java @@ -21,7 +21,6 @@ import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneKeyDetails; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.shell.MandatoryReplicationOptions; @@ -45,7 +44,7 @@ public class RewriteKeyHandler extends KeyHandler { private MandatoryReplicationOptions replication; @Override - protected void execute(OzoneClient client, OzoneAddress address) throws IOException, OzoneClientException { + protected void execute(OzoneClient client, OzoneAddress address) throws IOException { String volumeName = address.getVolumeName(); String bucketName = address.getBucketName(); String keyName = address.getKeyName(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java index 59a8eeddcea..11ae29bb55f 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java @@ -17,11 +17,12 @@ */ package org.apache.hadoop.ozone.shell.prefix; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Shell; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine; +import java.io.IOException; + /** * URI parameter for prefix-specific commands. */ @@ -40,7 +41,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws OzoneClientException { + public OzoneAddress convert(String str) throws IOException { OzoneAddress address = new OzoneAddress(str); address.ensurePrefixAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/s3/S3Handler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/s3/S3Handler.java index 91cde308cb2..0bde055887a 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/s3/S3Handler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/s3/S3Handler.java @@ -21,7 +21,6 @@ import java.io.IOException; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.Handler; @@ -43,13 +42,13 @@ public String getOmServiceID() { } @Override - protected OzoneAddress getAddress() throws OzoneClientException { + protected OzoneAddress getAddress() throws IOException { return new OzoneAddress(); } @Override protected OzoneClient createClient(OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { return address.createClientForS3Commands(getConf(), omServiceID); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/RenameSnapshotHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/RenameSnapshotHandler.java index 63b61b1ec66..f7569cac92e 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/RenameSnapshotHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/snapshot/RenameSnapshotHandler.java @@ -20,7 +20,6 @@ import java.io.IOException; import org.apache.hadoop.ozone.OmUtils; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Handler; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.bucket.BucketUri; @@ -50,7 +49,7 @@ protected OzoneAddress getAddress() { } @Override - protected void execute(OzoneClient client, OzoneAddress address) throws IOException, OzoneClientException { + protected void execute(OzoneClient client, OzoneAddress address) throws IOException { String volumeName = snapshotPath.getValue().getVolumeName(); String bucketName = snapshotPath.getValue().getBucketName(); OmUtils.validateSnapshotName(snapshotNewName); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantHandler.java index a76ab7420af..ec8fa67120b 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantHandler.java @@ -18,7 +18,6 @@ package org.apache.hadoop.ozone.shell.tenant; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Handler; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine; @@ -41,13 +40,13 @@ public String getOmServiceID() { } @Override - protected OzoneAddress getAddress() throws OzoneClientException { + protected OzoneAddress getAddress() throws IOException { return new OzoneAddress(); } @Override protected OzoneClient createClient(OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { return address.createClientForS3Commands(getConf(), omServiceID); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/CancelTokenHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/CancelTokenHandler.java index 73c9264a807..f76f88b6655 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/CancelTokenHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/CancelTokenHandler.java @@ -19,7 +19,6 @@ package org.apache.hadoop.ozone.shell.token; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine.Command; @@ -34,7 +33,7 @@ public class CancelTokenHandler extends TokenHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { client.getObjectStore().cancelDelegationToken(getToken()); out().printf("Token canceled successfully.%n"); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/GetTokenHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/GetTokenHandler.java index dadba506ae4..079bf13624c 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/GetTokenHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/GetTokenHandler.java @@ -20,7 +20,6 @@ import org.apache.hadoop.io.Text; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.security.OzoneTokenIdentifier; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.Handler; @@ -54,7 +53,7 @@ public class GetTokenHandler extends Handler { private TokenOption tokenFile; @Override - protected OzoneAddress getAddress() throws OzoneClientException { + protected OzoneAddress getAddress() throws IOException { return new OzoneAddress(uri); } @@ -65,7 +64,7 @@ protected boolean isApplicable() { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { Token token = client.getObjectStore() .getDelegationToken(new Text(renewer.getValue())); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/RenewTokenHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/RenewTokenHandler.java index 581093050ae..8b578b0f172 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/RenewTokenHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/RenewTokenHandler.java @@ -19,7 +19,6 @@ package org.apache.hadoop.ozone.shell.token; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine.Command; @@ -35,7 +34,7 @@ public class RenewTokenHandler extends TokenHandler { @Override protected void execute(OzoneClient client, OzoneAddress address) - throws IOException, OzoneClientException { + throws IOException { long expiryTime = client.getObjectStore().renewDelegationToken(getToken()); out().printf("Token renewed successfully, expiry time: %s.%n", Instant.ofEpochMilli(expiryTime)); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/ListVolumeHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/ListVolumeHandler.java index fec7b0cc4c7..a5baa0d9728 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/ListVolumeHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/ListVolumeHandler.java @@ -22,7 +22,6 @@ import java.util.Iterator; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.shell.ListOptions; import org.apache.hadoop.ozone.shell.OzoneAddress; @@ -57,7 +56,7 @@ public class ListVolumeHandler extends Handler { private String userName; @Override - protected OzoneAddress getAddress() throws OzoneClientException { + protected OzoneAddress getAddress() throws IOException { OzoneAddress address = new OzoneAddress(uri); address.ensureRootAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeUri.java index 32581254150..b0a829abf7b 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeUri.java @@ -17,11 +17,12 @@ */ package org.apache.hadoop.ozone.shell.volume; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.Shell; import picocli.CommandLine; +import java.io.IOException; + /** * URI parameter for volume-specific commands. */ @@ -40,7 +41,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws OzoneClientException { + public OzoneAddress convert(String str) throws IOException { OzoneAddress address = new OzoneAddress(str); address.ensureVolumeAddress(); return address; diff --git a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java index da95fd879c4..c90aa784e26 100644 --- a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java +++ b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java @@ -18,6 +18,7 @@ package org.apache.hadoop.ozone.shell; +import java.io.IOException; import java.util.Arrays; import java.util.Collection; @@ -52,7 +53,7 @@ public static Collection data() { @ParameterizedTest @MethodSource("data") - public void checkRootUrlType(String prefix) throws OzoneClientException { + public void checkRootUrlType(String prefix) throws IOException { address = new OzoneAddress(""); address.ensureRootAddress(); @@ -62,7 +63,7 @@ public void checkRootUrlType(String prefix) throws OzoneClientException { @ParameterizedTest @MethodSource("data") - public void checkVolumeUrlType(String prefix) throws OzoneClientException { + public void checkVolumeUrlType(String prefix) throws IOException { address = new OzoneAddress(prefix + "vol1"); address.ensureVolumeAddress(); assertEquals("vol1", address.getVolumeName()); @@ -70,7 +71,7 @@ public void checkVolumeUrlType(String prefix) throws OzoneClientException { @ParameterizedTest @MethodSource("data") - public void checkBucketUrlType(String prefix) throws OzoneClientException { + public void checkBucketUrlType(String prefix) throws IOException { address = new OzoneAddress(prefix + "vol1/bucket"); address.ensureBucketAddress(); assertEquals("vol1", address.getVolumeName()); @@ -84,7 +85,7 @@ public void checkBucketUrlType(String prefix) throws OzoneClientException { @ParameterizedTest @MethodSource("data") - public void checkKeyUrlType(String prefix) throws OzoneClientException { + public void checkKeyUrlType(String prefix) throws IOException { address = new OzoneAddress(prefix + "vol1/bucket/key"); address.ensureKeyAddress(); assertEquals("vol1", address.getVolumeName()); @@ -107,7 +108,7 @@ public void checkKeyUrlType(String prefix) throws OzoneClientException { @ParameterizedTest @MethodSource("data") - public void checkPrefixUrlType(String prefix) throws OzoneClientException { + public void checkPrefixUrlType(String prefix) throws IOException { address = new OzoneAddress(prefix + "vol1/bucket/prefix"); address.ensurePrefixAddress(); assertEquals("vol1", address.getVolumeName()); @@ -118,7 +119,7 @@ public void checkPrefixUrlType(String prefix) throws OzoneClientException { @ParameterizedTest @MethodSource("data") - public void checkSnapshotUrlType(String prefix) throws OzoneClientException { + public void checkSnapshotUrlType(String prefix) throws IOException { address = new OzoneAddress(prefix + "vol1/bucket/.snapshot/snap1"); address.ensureSnapshotAddress(); assertEquals("vol1", address.getVolumeName()); diff --git a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java index 620142c244b..fcf0b434f74 100644 --- a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java +++ b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java @@ -42,7 +42,7 @@ public class TestOzoneAddressClientCreation { @Test - public void implicitNonHA() throws OzoneClientException, IOException { + public void implicitNonHA() throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("/vol1/bucket1/key1"); address.createClient(new InMemoryConfiguration()); @@ -51,7 +51,7 @@ public void implicitNonHA() throws OzoneClientException, IOException { @Test public void implicitHAOneServiceId() - throws OzoneClientException, IOException { + throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("/vol1/bucket1/key1"); address.createClient( @@ -62,7 +62,7 @@ public void implicitHAOneServiceId() @Test public void implicitHaMultipleServiceId() - throws OzoneClientException, IOException { + throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("/vol1/bucket1/key1"); assertThrows(OzoneClientException.class, () -> @@ -72,7 +72,7 @@ public void implicitHaMultipleServiceId() @Test public void implicitHaMultipleServiceIdWithDefaultServiceId() - throws OzoneClientException, IOException { + throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("/vol1/bucket1/key1"); InMemoryConfiguration conf = new InMemoryConfiguration(OZONE_OM_SERVICE_IDS_KEY, @@ -86,7 +86,7 @@ public void implicitHaMultipleServiceIdWithDefaultServiceId() @Test public void implicitHaMultipleServiceIdWithDefaultServiceIdForS3() - throws OzoneClientException, IOException { + throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("/vol1/bucket1/key1"); OzoneConfiguration conf = new OzoneConfiguration(); @@ -100,7 +100,7 @@ public void implicitHaMultipleServiceIdWithDefaultServiceIdForS3() @Test public void explicitHaMultipleServiceId() - throws OzoneClientException, IOException { + throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("o3://service1/vol1/bucket1/key1"); address.createClient( @@ -111,7 +111,7 @@ public void explicitHaMultipleServiceId() } @Test - public void explicitNonHAHostPort() throws OzoneClientException, IOException { + public void explicitNonHAHostPort() throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("o3://om:9862/vol1/bucket1/key1"); address.createClient(new InMemoryConfiguration()); @@ -122,7 +122,7 @@ public void explicitNonHAHostPort() throws OzoneClientException, IOException { @Test public void explicitHAHostPortWithServiceId() - throws OzoneClientException, IOException { + throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("o3://om:9862/vol1/bucket1/key1"); address.createClient( @@ -134,7 +134,7 @@ public void explicitHAHostPortWithServiceId() @Test public void explicitAHostPortWithServiceIds() - throws OzoneClientException, IOException { + throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("o3://om:9862/vol1/bucket1/key1"); address.createClient( @@ -146,7 +146,7 @@ public void explicitAHostPortWithServiceIds() } @Test - public void explicitNonHAHost() throws OzoneClientException, IOException { + public void explicitNonHAHost() throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("o3://om/vol1/bucket1/key1"); address.createClient( @@ -156,7 +156,7 @@ public void explicitNonHAHost() throws OzoneClientException, IOException { } @Test - public void explicitHAHostPort() throws OzoneClientException, IOException { + public void explicitHAHostPort() throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("o3://om:1234/vol1/bucket1/key1"); address.createClient(new InMemoryConfiguration()); @@ -166,7 +166,7 @@ public void explicitHAHostPort() throws OzoneClientException, IOException { } @Test - public void explicitWrongScheme() throws OzoneClientException, IOException { + public void explicitWrongScheme() throws IOException { TestableOzoneAddress address = new TestableOzoneAddress("ssh://host/vol1/bucket1/key1"); assertThrows(OzoneClientException.class, () -> @@ -184,11 +184,11 @@ private static class TestableOzoneAddress extends OzoneAddress { private boolean simpleCreation; private String serviceId; - TestableOzoneAddress(String address) throws OzoneClientException { + TestableOzoneAddress(String address) throws IOException { super(address); } - TestableOzoneAddress() throws OzoneClientException { + TestableOzoneAddress() throws IOException { } @Override diff --git a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/keys/TestChecksumKeyHandler.java b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/keys/TestChecksumKeyHandler.java index d4fa929614f..3b22573eb13 100644 --- a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/keys/TestChecksumKeyHandler.java +++ b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/keys/TestChecksumKeyHandler.java @@ -24,7 +24,6 @@ import org.apache.hadoop.ozone.client.ObjectStore; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; -import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneKeyDetails; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.client.protocol.ClientProtocol; @@ -85,7 +84,7 @@ public void tearDown() { @Test public void testChecksumKeyHandler() - throws OzoneClientException, IOException { + throws IOException { OzoneAddress address = new OzoneAddress("o3://ozone1/volume/bucket/key"); long keySize = 1024L; From 0c64cc87c7dc8ce19fcd80494c717a8f14cf902b Mon Sep 17 00:00:00 2001 From: Nandakumar Vadivelu Date: Mon, 11 Nov 2024 11:24:20 +0530 Subject: [PATCH 2/4] Addressed review comments. --- .../admin/om/GetServiceRolesSubcommand.java | 2 -- .../admin/om/UpdateRangerSubcommand.java | 4 ---- .../ozone/debug/FindMissingPadding.java | 3 ++- .../apache/hadoop/ozone/shell/Handler.java | 3 ++- .../hadoop/ozone/shell/OzoneAddress.java | 22 +++++++++---------- .../hadoop/ozone/shell/bucket/BucketUri.java | 5 ++--- .../ozone/shell/common/VolumeBucketUri.java | 5 ++--- .../hadoop/ozone/shell/keys/KeyUri.java | 5 ++--- .../hadoop/ozone/shell/prefix/PrefixUri.java | 5 ++--- .../hadoop/ozone/shell/s3/S3Handler.java | 3 ++- .../ozone/shell/tenant/TenantHandler.java | 3 ++- .../ozone/shell/token/GetTokenHandler.java | 3 ++- .../ozone/shell/volume/ListVolumeHandler.java | 3 ++- .../hadoop/ozone/shell/volume/VolumeUri.java | 5 ++--- .../hadoop/ozone/shell/TestOzoneAddress.java | 13 +++++------ .../shell/TestOzoneAddressClientCreation.java | 4 ++-- 16 files changed, 41 insertions(+), 47 deletions(-) diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java index 50eb772f18f..2b23ad9f536 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/GetServiceRolesSubcommand.java @@ -93,8 +93,6 @@ public Void call() throws Exception { } else { printOmServerRoles(ozoneManagerClient.getServiceList()); } - } catch (IOException ex) { - System.out.printf("Error: %s", ex.getMessage()); } finally { if (ozoneManagerClient != null) { ozoneManagerClient.close(); diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/UpdateRangerSubcommand.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/UpdateRangerSubcommand.java index 7f51ac8f76e..d2d2f1bf044 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/UpdateRangerSubcommand.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/om/UpdateRangerSubcommand.java @@ -23,7 +23,6 @@ import org.apache.hadoop.ozone.om.protocol.OzoneManagerProtocol; import picocli.CommandLine; -import java.io.IOException; import java.util.concurrent.Callable; /** @@ -86,9 +85,6 @@ public Void call() throws Exception { System.err.println("Operation completed with errors. " + "Check OM log for details"); } - - } catch (IOException ex) { - System.err.printf("Error: %s", ex.getMessage()); } return null; } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/FindMissingPadding.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/FindMissingPadding.java index 2f1e6a8a943..0c7ba187ce1 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/FindMissingPadding.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/FindMissingPadding.java @@ -38,6 +38,7 @@ import org.apache.hadoop.ozone.client.ObjectStore; import org.apache.hadoop.ozone.client.OzoneBucket; import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneKey; import org.apache.hadoop.ozone.client.OzoneKeyDetails; import org.apache.hadoop.ozone.client.OzoneKeyLocation; @@ -95,7 +96,7 @@ public class FindMissingPadding extends Handler implements SubcommandWithParent private final Set affectedKeys = new HashSet<>(); @Override - protected OzoneAddress getAddress() throws IOException { + protected OzoneAddress getAddress() throws OzoneClientException { return new OzoneAddress(uri); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/Handler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/Handler.java index d48d997e2fd..92484936f21 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/Handler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/Handler.java @@ -31,6 +31,7 @@ import org.apache.hadoop.ozone.OzoneSecurityUtil; import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import picocli.CommandLine; @@ -63,7 +64,7 @@ public OzoneConfiguration createOzoneConfiguration() { return parent.createOzoneConfiguration(); } - protected OzoneAddress getAddress() throws IOException { + protected OzoneAddress getAddress() throws OzoneClientException { return new OzoneAddress(); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java index b13091a39e1..ae5b5ad566e 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/OzoneAddress.java @@ -64,12 +64,12 @@ public class OzoneAddress { private boolean isPrefix = false; - public OzoneAddress() throws IOException { + public OzoneAddress() throws OzoneClientException { this("o3:///"); } public OzoneAddress(String address) - throws IOException { + throws OzoneClientException { if (address == null || address.equals("")) { address = OZONE_RPC_SCHEME + ":///"; } @@ -226,7 +226,7 @@ public OzoneClient createClientForS3Commands( * @param uri - UriString * @return URI */ - protected URI parseURI(String uri) throws IOException { + protected URI parseURI(String uri) throws OzoneClientException { if ((uri == null) || uri.isEmpty()) { throw new OzoneClientException( "Ozone URI is needed to execute this command."); @@ -336,7 +336,7 @@ public boolean isPrefix() { return isPrefix; } - public void ensureBucketAddress() throws IOException { + public void ensureBucketAddress() throws OzoneClientException { if (keyName.length() > 0) { throw new OzoneClientException( "Invalid bucket name. Delimiters (/) not allowed in bucket name"); @@ -351,7 +351,7 @@ public void ensureBucketAddress() throws IOException { // Ensure prefix address with a prefix flag // Allow CLI to differentiate key and prefix address - public void ensurePrefixAddress() throws IOException { + public void ensurePrefixAddress() throws OzoneClientException { if (keyName.length() == 0) { throw new OzoneClientException( "prefix name is missing."); @@ -365,7 +365,7 @@ public void ensurePrefixAddress() throws IOException { isPrefix = true; } - public void ensureKeyAddress() throws IOException { + public void ensureKeyAddress() throws OzoneClientException { if (keyName.length() == 0) { throw new OzoneClientException( "Key name is missing."); @@ -385,10 +385,10 @@ public void ensureKeyAddress() throws IOException { * If the keyName can't be considered * a valid snapshot, an exception is thrown. * - * @throws IOException + * @throws OzoneClientException */ public void ensureSnapshotAddress() - throws IOException { + throws OzoneClientException { if (keyName.length() > 0) { if (OmUtils.isBucketSnapshotIndicator(keyName)) { snapshotNameWithIndicator = keyName; @@ -407,7 +407,7 @@ public void ensureSnapshotAddress() } } - public void ensureVolumeAddress() throws IOException { + public void ensureVolumeAddress() throws OzoneClientException { if (keyName.length() != 0) { throw new OzoneClientException( "Invalid volume name. Delimiters (/) not allowed in volume name"); @@ -420,7 +420,7 @@ public void ensureVolumeAddress() throws IOException { } } - public void ensureRootAddress() throws IOException { + public void ensureRootAddress() throws OzoneClientException { if (keyName.length() != 0 || bucketName.length() != 0 || volumeName.length() != 0) { throw new OzoneClientException( @@ -464,7 +464,7 @@ public void print(PrintStream out) { } } - public void ensureVolumeOrBucketAddress() throws IOException { + public void ensureVolumeOrBucketAddress() throws OzoneClientException { if (keyName.length() > 0) { if (OmUtils.isBucketSnapshotIndicator(keyName)) { // If snapshot, ensure snapshot URI diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketUri.java index a7f49e0e6db..9a1c62d0af0 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/bucket/BucketUri.java @@ -17,12 +17,11 @@ */ package org.apache.hadoop.ozone.shell.bucket; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Shell; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine; -import java.io.IOException; - /** * URI parameter for bucket-specific commands. */ @@ -41,7 +40,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws IOException { + public OzoneAddress convert(String str) throws OzoneClientException { OzoneAddress address = new OzoneAddress(str); address.ensureBucketAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/common/VolumeBucketUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/common/VolumeBucketUri.java index 118c409934c..fb86fd9eaa5 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/common/VolumeBucketUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/common/VolumeBucketUri.java @@ -17,12 +17,11 @@ */ package org.apache.hadoop.ozone.shell.common; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.Shell; import picocli.CommandLine; -import java.io.IOException; - /** * URI parameter for volume or bucket specific commands. */ @@ -42,7 +41,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws IOException { + public OzoneAddress convert(String str) throws OzoneClientException { OzoneAddress address = new OzoneAddress(str); address.ensureVolumeOrBucketAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyUri.java index fd5dbe04e59..b2caf0d4779 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/KeyUri.java @@ -17,12 +17,11 @@ */ package org.apache.hadoop.ozone.shell.keys; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Shell; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine; -import java.io.IOException; - /** * URI parameter for key-specific commands. */ @@ -41,7 +40,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws IOException { + public OzoneAddress convert(String str) throws OzoneClientException { OzoneAddress address = new OzoneAddress(str); address.ensureKeyAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java index 11ae29bb55f..59a8eeddcea 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/prefix/PrefixUri.java @@ -17,12 +17,11 @@ */ package org.apache.hadoop.ozone.shell.prefix; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Shell; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine; -import java.io.IOException; - /** * URI parameter for prefix-specific commands. */ @@ -41,7 +40,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws IOException { + public OzoneAddress convert(String str) throws OzoneClientException { OzoneAddress address = new OzoneAddress(str); address.ensurePrefixAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/s3/S3Handler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/s3/S3Handler.java index 0bde055887a..62b36230fcd 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/s3/S3Handler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/s3/S3Handler.java @@ -21,6 +21,7 @@ import java.io.IOException; import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.Handler; @@ -42,7 +43,7 @@ public String getOmServiceID() { } @Override - protected OzoneAddress getAddress() throws IOException { + protected OzoneAddress getAddress() throws OzoneClientException { return new OzoneAddress(); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantHandler.java index ec8fa67120b..8800d22e61e 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/tenant/TenantHandler.java @@ -18,6 +18,7 @@ package org.apache.hadoop.ozone.shell.tenant; import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.Handler; import org.apache.hadoop.ozone.shell.OzoneAddress; import picocli.CommandLine; @@ -40,7 +41,7 @@ public String getOmServiceID() { } @Override - protected OzoneAddress getAddress() throws IOException { + protected OzoneAddress getAddress() throws OzoneClientException { return new OzoneAddress(); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/GetTokenHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/GetTokenHandler.java index 079bf13624c..133e983dd1c 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/GetTokenHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/token/GetTokenHandler.java @@ -20,6 +20,7 @@ import org.apache.hadoop.io.Text; import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.security.OzoneTokenIdentifier; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.Handler; @@ -53,7 +54,7 @@ public class GetTokenHandler extends Handler { private TokenOption tokenFile; @Override - protected OzoneAddress getAddress() throws IOException { + protected OzoneAddress getAddress() throws OzoneClientException { return new OzoneAddress(uri); } diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/ListVolumeHandler.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/ListVolumeHandler.java index a5baa0d9728..fec7b0cc4c7 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/ListVolumeHandler.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/ListVolumeHandler.java @@ -22,6 +22,7 @@ import java.util.Iterator; import org.apache.hadoop.ozone.client.OzoneClient; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.client.OzoneVolume; import org.apache.hadoop.ozone.shell.ListOptions; import org.apache.hadoop.ozone.shell.OzoneAddress; @@ -56,7 +57,7 @@ public class ListVolumeHandler extends Handler { private String userName; @Override - protected OzoneAddress getAddress() throws IOException { + protected OzoneAddress getAddress() throws OzoneClientException { OzoneAddress address = new OzoneAddress(uri); address.ensureRootAddress(); return address; diff --git a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeUri.java b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeUri.java index b0a829abf7b..32581254150 100644 --- a/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeUri.java +++ b/hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/volume/VolumeUri.java @@ -17,12 +17,11 @@ */ package org.apache.hadoop.ozone.shell.volume; +import org.apache.hadoop.ozone.client.OzoneClientException; import org.apache.hadoop.ozone.shell.OzoneAddress; import org.apache.hadoop.ozone.shell.Shell; import picocli.CommandLine; -import java.io.IOException; - /** * URI parameter for volume-specific commands. */ @@ -41,7 +40,7 @@ public OzoneAddress getValue() { } @Override - public OzoneAddress convert(String str) throws IOException { + public OzoneAddress convert(String str) throws OzoneClientException { OzoneAddress address = new OzoneAddress(str); address.ensureVolumeAddress(); return address; diff --git a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java index c90aa784e26..da95fd879c4 100644 --- a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java +++ b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddress.java @@ -18,7 +18,6 @@ package org.apache.hadoop.ozone.shell; -import java.io.IOException; import java.util.Arrays; import java.util.Collection; @@ -53,7 +52,7 @@ public static Collection data() { @ParameterizedTest @MethodSource("data") - public void checkRootUrlType(String prefix) throws IOException { + public void checkRootUrlType(String prefix) throws OzoneClientException { address = new OzoneAddress(""); address.ensureRootAddress(); @@ -63,7 +62,7 @@ public void checkRootUrlType(String prefix) throws IOException { @ParameterizedTest @MethodSource("data") - public void checkVolumeUrlType(String prefix) throws IOException { + public void checkVolumeUrlType(String prefix) throws OzoneClientException { address = new OzoneAddress(prefix + "vol1"); address.ensureVolumeAddress(); assertEquals("vol1", address.getVolumeName()); @@ -71,7 +70,7 @@ public void checkVolumeUrlType(String prefix) throws IOException { @ParameterizedTest @MethodSource("data") - public void checkBucketUrlType(String prefix) throws IOException { + public void checkBucketUrlType(String prefix) throws OzoneClientException { address = new OzoneAddress(prefix + "vol1/bucket"); address.ensureBucketAddress(); assertEquals("vol1", address.getVolumeName()); @@ -85,7 +84,7 @@ public void checkBucketUrlType(String prefix) throws IOException { @ParameterizedTest @MethodSource("data") - public void checkKeyUrlType(String prefix) throws IOException { + public void checkKeyUrlType(String prefix) throws OzoneClientException { address = new OzoneAddress(prefix + "vol1/bucket/key"); address.ensureKeyAddress(); assertEquals("vol1", address.getVolumeName()); @@ -108,7 +107,7 @@ public void checkKeyUrlType(String prefix) throws IOException { @ParameterizedTest @MethodSource("data") - public void checkPrefixUrlType(String prefix) throws IOException { + public void checkPrefixUrlType(String prefix) throws OzoneClientException { address = new OzoneAddress(prefix + "vol1/bucket/prefix"); address.ensurePrefixAddress(); assertEquals("vol1", address.getVolumeName()); @@ -119,7 +118,7 @@ public void checkPrefixUrlType(String prefix) throws IOException { @ParameterizedTest @MethodSource("data") - public void checkSnapshotUrlType(String prefix) throws IOException { + public void checkSnapshotUrlType(String prefix) throws OzoneClientException { address = new OzoneAddress(prefix + "vol1/bucket/.snapshot/snap1"); address.ensureSnapshotAddress(); assertEquals("vol1", address.getVolumeName()); diff --git a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java index fcf0b434f74..7ebb449bff2 100644 --- a/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java +++ b/hadoop-ozone/tools/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneAddressClientCreation.java @@ -184,11 +184,11 @@ private static class TestableOzoneAddress extends OzoneAddress { private boolean simpleCreation; private String serviceId; - TestableOzoneAddress(String address) throws IOException { + TestableOzoneAddress(String address) throws OzoneClientException { super(address); } - TestableOzoneAddress() throws IOException { + TestableOzoneAddress() throws OzoneClientException { } @Override From bf9f14bec12d3f8e41951eb6ef58156e52f429bb Mon Sep 17 00:00:00 2001 From: Nandakumar Vadivelu Date: Tue, 12 Nov 2024 21:20:04 +0530 Subject: [PATCH 3/4] Fixed smoketest failure --- .../dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-ozone/dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot b/hadoop-ozone/dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot index 0c688865193..e9fd66a49a6 100644 --- a/hadoop-ozone/dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot +++ b/hadoop-ozone/dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot @@ -22,5 +22,5 @@ Test Timeout 5 minutes *** Test Cases *** Check om admin command - ${result} = Execute and checkrc ozone admin om roles -id=omServiceIdDefault 0 + ${result} = Execute and checkrc ozone admin om roles -id=omServiceIdDefault Should Contain ${result} This command works only on OzoneManager HA cluster. From 1bb1eacff6acafd36c2918ddc43278ad6f2c863a Mon Sep 17 00:00:00 2001 From: "Doroszlai, Attila" <6454655+adoroszlai@users.noreply.github.com> Date: Tue, 12 Nov 2024 18:29:11 +0100 Subject: [PATCH 4/4] Fix robot test --- .../dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hadoop-ozone/dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot b/hadoop-ozone/dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot index e9fd66a49a6..3977e053608 100644 --- a/hadoop-ozone/dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot +++ b/hadoop-ozone/dist/src/main/smoketest/om-ratis/testOMAdminCmd.robot @@ -22,5 +22,5 @@ Test Timeout 5 minutes *** Test Cases *** Check om admin command - ${result} = Execute and checkrc ozone admin om roles -id=omServiceIdDefault + ${result} = Execute and ignore error ozone admin om roles -id=omServiceIdDefault Should Contain ${result} This command works only on OzoneManager HA cluster.