From 0b3018d9e4cd64402f8d111aa9b4857224b8134e Mon Sep 17 00:00:00 2001 From: Yiru Tang Date: Thu, 4 Aug 2022 11:15:05 -0700 Subject: [PATCH] feat!: remove a dummy WriterClosedException (#1726) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Remove a dummy WriterClosedException * . * . * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- google-cloud-bigquerystorage/clirr-ignored-differences.xml | 4 ++++ .../com/google/cloud/bigquery/storage/v1/Exceptions.java | 5 ----- .../com/google/cloud/bigquery/storage/v1/StreamWriter.java | 6 +++++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/google-cloud-bigquerystorage/clirr-ignored-differences.xml b/google-cloud-bigquerystorage/clirr-ignored-differences.xml index 38fa510bf2..a5f3798b92 100644 --- a/google-cloud-bigquerystorage/clirr-ignored-differences.xml +++ b/google-cloud-bigquerystorage/clirr-ignored-differences.xml @@ -11,4 +11,8 @@ com/google/cloud/bigquery/storage/v1/Exceptions$StreamFinalizedException Exceptions$StreamFinalizedException(io.grpc.Status, io.grpc.Metadata, java.lang.String) + + 8001 + com/google/cloud/bigquery/storage/v1/Exceptions$WriterClosedException + diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/Exceptions.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/Exceptions.java index ee1958f827..d943adfbd4 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/Exceptions.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/Exceptions.java @@ -29,11 +29,6 @@ /** Exceptions for Storage Client Libraries. */ public final class Exceptions { - public static class WriterClosedException extends Exception { - public WriterClosedException(String streamName) { - super("Writer closed on: " + streamName); - } - } /** Main Storage Exception. Might contain map of streams to errors for that stream. */ public static class StorageException extends StatusRuntimeException { diff --git a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java index 57127066bb..a51b5af3bd 100644 --- a/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java +++ b/google-cloud-bigquerystorage/src/main/java/com/google/cloud/bigquery/storage/v1/StreamWriter.java @@ -562,7 +562,11 @@ private AppendRowsRequest prepareRequestBasedOnPosition( } private void cleanupInflightRequests() { - Throwable finalStatus = new Exceptions.WriterClosedException(streamName); + Throwable finalStatus = + new Exceptions.StreamWriterClosedException( + Status.fromCode(Status.Code.FAILED_PRECONDITION) + .withDescription("Connection is already closed, cleanup inflight request"), + streamName); Deque localQueue = new LinkedList(); this.lock.lock(); try {