This is an automated email from the ASF dual-hosted git repository.
lidongdai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new 36a7533e85 [Improve][Jdbc] Remove useless utils. (#8793)
36a7533e85 is described below
commit 36a7533e85c34f4e555ca8918ce2e8df64b9cc9a
Author: joyCurry30 <[email protected]>
AuthorDate: Tue Feb 25 09:47:24 2025 +0800
[Improve][Jdbc] Remove useless utils. (#8793)
---
.../seatunnel/jdbc/utils/ExceptionUtils.java | 53 ----------------------
.../seatunnel/jdbc/utils/ThrowingRunnable.java | 17 -------
2 files changed, 70 deletions(-)
diff --git
a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ExceptionUtils.java
b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ExceptionUtils.java
deleted file mode 100644
index f1d66d82f4..0000000000
---
a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ExceptionUtils.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.seatunnel.connectors.seatunnel.jdbc.utils;
-
-import java.io.IOException;
-
-public class ExceptionUtils {
- public static void rethrow(Throwable t) {
- if (t instanceof Error) {
- throw (Error) t;
- } else if (t instanceof RuntimeException) {
- throw (RuntimeException) t;
- } else {
- throw new RuntimeException(t);
- }
- }
-
- /**
- * Re-throws the given {@code Throwable} in scenarios where the signatures
allows only
- * IOExceptions (and RuntimeException and Error).
- *
- * <p>Throws this exception directly, if it is an IOException, a
RuntimeException, or an Error.
- * Otherwise it wraps it in an IOException and throws it.
- *
- * @param t The Throwable to be thrown.
- */
- public static void rethrowIOException(Throwable t) throws IOException {
- if (t instanceof IOException) {
- throw (IOException) t;
- } else if (t instanceof RuntimeException) {
- throw (RuntimeException) t;
- } else if (t instanceof Error) {
- throw (Error) t;
- } else {
- throw new IOException(t.getMessage(), t);
- }
- }
-}
diff --git
a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ThrowingRunnable.java
b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ThrowingRunnable.java
index 0a4f33ded0..95bfaad1bd 100644
---
a/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ThrowingRunnable.java
+++
b/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/utils/ThrowingRunnable.java
@@ -30,21 +30,4 @@ public interface ThrowingRunnable<E extends Throwable> {
* @throws E Exceptions may be thrown.
*/
void run() throws E;
-
- /**
- * Converts a {@link ThrowingRunnable} into a {@link Runnable} which
throws all checked
- * exceptions as unchecked.
- *
- * @param throwingRunnable to convert into a {@link Runnable}
- * @return {@link Runnable} which throws all checked exceptions as
unchecked.
- */
- static Runnable unchecked(ThrowingRunnable<?> throwingRunnable) {
- return () -> {
- try {
- throwingRunnable.run();
- } catch (Throwable t) {
- ExceptionUtils.rethrow(t);
- }
- };
- }
}