This is an automated email from the ASF dual-hosted git repository.
ddanielr 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 29230373cb Update TableDeleteException to use TableId type (#6323)
29230373cb is described below
commit 29230373cbd1d0454aac00c803b882eaeba02dbf
Author: Daniel Roberts <[email protected]>
AuthorDate: Thu Apr 23 13:19:05 2026 -0400
Update TableDeleteException to use TableId type (#6323)
* Update TableDeleteException to use TableId
The TableDeleteException was only used in places where a tableId was
being passed into the Exception.
Updates the Exception constructor to accept a TableId object.
Marks the String constructor as deprecated.
---
.../accumulo/core/client/TableDeletedException.java | 16 ++++++++++++----
.../apache/accumulo/core/clientImpl/ClientContext.java | 2 +-
.../core/clientImpl/TabletServerBatchReaderIterator.java | 2 +-
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git
a/core/src/main/java/org/apache/accumulo/core/client/TableDeletedException.java
b/core/src/main/java/org/apache/accumulo/core/client/TableDeletedException.java
index dadb1c1b39..6204d6ef0b 100644
---
a/core/src/main/java/org/apache/accumulo/core/client/TableDeletedException.java
+++
b/core/src/main/java/org/apache/accumulo/core/client/TableDeletedException.java
@@ -18,6 +18,8 @@
*/
package org.apache.accumulo.core.client;
+import org.apache.accumulo.core.data.TableId;
+
/**
* This exception is thrown if a table is deleted after an operation starts.
*
@@ -27,22 +29,28 @@ package org.apache.accumulo.core.client;
public class TableDeletedException extends RuntimeException {
private static final long serialVersionUID = 1L;
- private final String tableId;
+ private final TableId tableId;
+ @Deprecated(since = "4.0.0")
public TableDeletedException(String tableId) {
+ super("Table ID " + tableId + " was deleted");
+ this.tableId = TableId.of(tableId);
+ }
+
+ public TableDeletedException(TableId tableId) {
super("Table ID " + tableId + " was deleted");
this.tableId = tableId;
}
/**
- * @since 2.0.0
+ * @since 4.0.0
*/
- public TableDeletedException(String tableId, Exception cause) {
+ public TableDeletedException(TableId tableId, Exception cause) {
super("Table ID " + tableId + " was deleted", cause);
this.tableId = tableId;
}
- public String getTableId() {
+ public TableId getTableId() {
return tableId;
}
}
diff --git
a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
index c9a1fb4d61..90ff9a166e 100644
--- a/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
+++ b/core/src/main/java/org/apache/accumulo/core/clientImpl/ClientContext.java
@@ -748,7 +748,7 @@ public class ClientContext implements AccumuloClient {
// use cases overlap with requireTableExists, but this throws a runtime
exception
public TableId requireNotDeleted(TableId tableId) {
if (!tableNodeExists(tableId)) {
- throw new TableDeletedException(tableId.canonical());
+ throw new TableDeletedException(tableId);
}
return tableId;
}
diff --git
a/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
b/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
index 267ca5b2db..64252af3ca 100644
---
a/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
+++
b/core/src/main/java/org/apache/accumulo/core/clientImpl/TabletServerBatchReaderIterator.java
@@ -463,7 +463,7 @@ public final class TabletServerBatchReaderIterator
implements Iterator<Entry<Key
if (context.tableNodeExists(tableId)) {
fatalException = e;
} else {
- fatalException = new TableDeletedException(tableId.canonical());
+ fatalException = new TableDeletedException(tableId);
}
} catch (SampleNotPresentException e) {
fatalException = e;