You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by ty...@apache.org on 2022/10/10 10:55:02 UTC
[incubator-seatunnel] branch dev updated: remove duplicate ExceptionUtil class (#3037)
This is an automated email from the ASF dual-hosted git repository.
tyrantlucifer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git
The following commit(s) were added to refs/heads/dev by this push:
new c9dc7c50c remove duplicate ExceptionUtil class (#3037)
c9dc7c50c is described below
commit c9dc7c50c25ba9c6d6c69df144f6450834f6b434
Author: Eric <ga...@gmail.com>
AuthorDate: Mon Oct 10 18:54:57 2022 +0800
remove duplicate ExceptionUtil class (#3037)
---
.../org/apache/seatunnel/common/ExceptionUtil.java | 37 ----------------------
.../apache/seatunnel/common/utils/FileUtils.java | 7 ++--
.../seatunnel/kudu/kuduclient/KuduInputFormat.java | 4 +--
3 files changed, 5 insertions(+), 43 deletions(-)
diff --git a/seatunnel-common/src/main/java/org/apache/seatunnel/common/ExceptionUtil.java b/seatunnel-common/src/main/java/org/apache/seatunnel/common/ExceptionUtil.java
deleted file mode 100644
index 7ad7e7fc8..000000000
--- a/seatunnel-common/src/main/java/org/apache/seatunnel/common/ExceptionUtil.java
+++ /dev/null
@@ -1,37 +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.common;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-public class ExceptionUtil {
- public static String getMessage(Throwable e) {
- try (StringWriter sw = new StringWriter();
- PrintWriter pw = new PrintWriter(sw)){
- // Output the error stack information to the printWriter
- e.printStackTrace(pw);
- pw.flush();
- sw.flush();
- return sw.toString();
- } catch (Exception e1) {
- e1.printStackTrace();
- throw new RuntimeException("Failed to print exception logs", e1);
- }
- }
-}
diff --git a/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/FileUtils.java b/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/FileUtils.java
index ae1dd1cf1..795f70e89 100644
--- a/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/FileUtils.java
+++ b/seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/FileUtils.java
@@ -17,8 +17,6 @@
package org.apache.seatunnel.common.utils;
-import org.apache.seatunnel.common.ExceptionUtil;
-
import lombok.extern.slf4j.Slf4j;
import java.io.File;
@@ -37,7 +35,7 @@ public class FileUtils {
byte[] bytes = Files.readAllBytes(path);
return new String(bytes);
} catch (IOException e) {
- log.error(ExceptionUtil.getMessage(e));
+ log.error(ExceptionUtils.getMessage(e));
throw new RuntimeException(e);
}
}
@@ -49,7 +47,7 @@ public class FileUtils {
ps = new PrintStream(new FileOutputStream(file));
ps.println(str);
} catch (FileNotFoundException e) {
- log.error(ExceptionUtil.getMessage(e));
+ log.error(ExceptionUtils.getMessage(e));
throw new RuntimeException(e);
} finally {
if (ps != null) {
@@ -68,6 +66,7 @@ public class FileUtils {
/**
* create a new file, delete the old one if it is exists.
+ *
* @param filePath filePath
*/
public static void createNewFile(String filePath) {
diff --git a/seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java b/seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java
index cb8a59907..a70a19f88 100644
--- a/seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java
+++ b/seatunnel-connectors-v2/connector-kudu/src/main/java/org/apache/seatunnel/connectors/seatunnel/kudu/kuduclient/KuduInputFormat.java
@@ -23,8 +23,8 @@ import org.apache.seatunnel.api.table.type.DecimalType;
import org.apache.seatunnel.api.table.type.SeaTunnelDataType;
import org.apache.seatunnel.api.table.type.SeaTunnelRow;
import org.apache.seatunnel.api.table.type.SeaTunnelRowType;
-import org.apache.seatunnel.common.ExceptionUtil;
import org.apache.seatunnel.common.constants.PluginType;
+import org.apache.seatunnel.common.utils.ExceptionUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.kudu.ColumnSchema;
@@ -136,7 +136,7 @@ public class KuduInputFormat implements Serializable {
}
} catch (Exception e) {
log.warn("get row type info exception.", e);
- throw new PrepareFailException("kudu", PluginType.SOURCE, ExceptionUtil.getMessage(e));
+ throw new PrepareFailException("kudu", PluginType.SOURCE, ExceptionUtils.getMessage(e));
}
return new SeaTunnelRowType(fieldNames.toArray(new String[fieldNames.size()]), seaTunnelDataTypes.toArray(new SeaTunnelDataType<?>[seaTunnelDataTypes.size()]));
}