This is an automated email from the ASF dual-hosted git repository.
peacewong pushed a commit to branch dev-1.3.1
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git
The following commit(s) were added to refs/heads/dev-1.3.1 by this push:
new ddceffb25 [ISSUE-3426][linkis-storage ]errorcode code optimization
(#3506)
ddceffb25 is described below
commit ddceffb25d1670f860a2a1255037cca3386b66f5
Author: 成彬彬 <[email protected]>
AuthorDate: Tue Oct 11 14:47:37 2022 +0800
[ISSUE-3426][linkis-storage ]errorcode code optimization (#3506)
* errorcode code optimization
---
docs/errorcode/linkis-storage -errorcode.md | 26 ++++++
.../LinkisIoFileClientErrorCodeSummary.java | 77 ++++++++++++++++++
.../errorcode/LinkisIoFileErrorCodeSummary.java | 72 ++++++++++++++++
.../errorcode/LinkisStorageErrorCodeSummary.java | 95 ++++++++++++++++++++++
.../storage/exception/FSNotInitException.java | 4 +-
.../linkis/storage/exception/StorageErrorCode.java | 2 +-
.../linkis/storage/fs/impl/LocalFileSystem.java | 6 +-
.../org/apache/linkis/storage/FSFactory.scala | 6 +-
.../org/apache/linkis/storage/domain/Dolphin.scala | 6 +-
.../org/apache/linkis/storage/io/IOClient.scala | 5 +-
.../storage/io/IOMethodInterceptorCreator.scala | 5 +-
.../resultset/DefaultResultSetFactory.scala | 13 ++-
.../linkis/storage/resultset/ResultSetReader.scala | 9 +-
.../resultset/table/TableResultDeserializer.scala | 6 +-
.../storage/script/parser/CommonScriptParser.scala | 16 +++-
.../apache/linkis/storage/source/FileSource.scala | 17 +++-
.../apache/linkis/storage/utils/StorageUtils.scala | 5 +-
.../release-docs/licenses/License-druid.txt | 13 ---
.../io/executor/IoEngineConnExecutor.scala | 32 ++++++--
.../manager/engineplugin/io/utils/IOHelp.scala | 14 ++--
.../io/iteraceptor/IOMethodInterceptor.scala | 20 +++--
21 files changed, 390 insertions(+), 59 deletions(-)
diff --git a/docs/errorcode/linkis-storage -errorcode.md
b/docs/errorcode/linkis-storage -errorcode.md
new file mode 100644
index 000000000..787efb150
--- /dev/null
+++ b/docs/errorcode/linkis-storage -errorcode.md
@@ -0,0 +1,26 @@
+## linkis-storage errorcode
+
+| 模块名(服务名) | 错误码 | 描述 | Exception Class|
+| -------- | -------- | ----- |-----|
+|linkis-storage |52000|FSNotInitException|LinkisStorageErrorCodeSummary|
+|linkis-storage |52004|You must register IOClient before you can use proxy
mode.(必须先注册IOClient,才能使用代理模式)|LinkisStorageErrorCodeSummary|
+|linkis-storage |52004|You must register IOMethodInterceptorCreator before you
can use proxy
mode.(必须先注册IOMethodInterceptorCreator,才能使用代理模式)|LinkisStorageErrorCodeSummary|
+|linkis-storage |50000|Unsupported result
type(不支持的结果类型):{}|LinkisStorageErrorCodeSummary|
+|linkis-storage |51000|The file{}is
empty(文件{}为空)|LinkisStorageErrorCodeSummary|
+|linkis-storage |52002|Result sets that are not tables are not
supported(不支持不是表格的结果集)|LinkisStorageErrorCodeSummary|
+|linkis-storage |52001|Parsing metadata
failed(解析元数据失败)|LinkisStorageErrorCodeSummary|
+|linkis-storage |65000|Invalid custom
parameter(不合法的自定义参数)|LinkisStorageErrorCodeSummary|
+|linkis-storage |54001|Unsupported open file
type(不支持打开的文件类型)|LinkisStorageErrorCodeSummary|
+|linkis-storage |50000|Unsupported file system
type(不支持的文件系统类型):{}|LinkisStorageErrorCodeSummary|
+|linkis-storage |51000|failed to read
integer(读取整数失败)|LinkisStorageErrorCodeSummary|
+|linkis-storage |50001|HDFS configuration was not read, please configure
hadoop.config.dir or add env:HADOOP_CONF_DIR(HDFS 配置未读取,请配置 hadoop.config.dir
或添加 env:HADOOP_CONF_DIR)|LinkisStorageErrorCodeSummary|
+|linkis-storage |51001| |LinkisStorageErrorCodeSummary|
+|linkis-storage |53003|Unsupported parameter
calls(不支持的参数调用)|LinkisIoFileErrorCodeSummary|
+|linkis-storage |52002|FS Can not proxy to:{}(FS 不能代理到:{})
|LinkisIoFileErrorCodeSummary|
+|linkis-storage |53003|not exists method {} in fs {}(方法不存在)
|LinkisIoFileErrorCodeSummary|
+|linkis-storage |53002|The read method parameter cannot be
empty(read方法参数不能为空)|LinkisIoFileErrorCodeSummary|
+|linkis-storage |52002|proxy user not set, can not get the permission
information.(没有设置代理 proxy 用户,无法获取权限信息)|LinkisIoFileClientErrorCodeSummary|
+|linkis-storage |52002|Failed to init FS for user:(为用户初始化 FS
失败:)|LinkisIoFileClientErrorCodeSummary|
+|linkis-storage |52002|has been closed, IO operation was
illegal.(已经关闭,IO操作是非法的.)"|LinkisIoFileClientErrorCodeSummary|
+|linkis-storage |52002|storage has been
closed.(存储已关闭.)|LinkisIoFileClientErrorCodeSummary|
+|linkis-storage |53001|please init first(请先初始化)|StorageErrorCode|
diff --git
a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/errorcode/LinkisIoFileClientErrorCodeSummary.java
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/errorcode/LinkisIoFileClientErrorCodeSummary.java
new file mode 100644
index 000000000..6a2677986
--- /dev/null
+++
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/errorcode/LinkisIoFileClientErrorCodeSummary.java
@@ -0,0 +1,77 @@
+/*
+ * 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.linkis.storage.errorcode;
+
+public enum LinkisIoFileClientErrorCodeSummary {
+ NO_PROXY_USER(
+ 52002,
+ "proxy user not set, can not get the permission information.(没有设置代理
proxy 用户,无法获取权限信息)",
+ "proxy user not set, can not get the permission information.(没有设置代理
proxy 用户,无法获取权限信息)"),
+ FAILED_TO_INIT_USER(
+ 52002,
+ "Failed to init FS for user:(为用户初始化 FS 失败:)",
+ "Failed to init FS for user:(为用户初始化 FS 失败:)"),
+ ENGINE_CLOSED_IO_ILLEGAL(
+ 52002,
+ "has been closed, IO operation was illegal.(已经关闭,IO操作是非法的.)",
+ "has been closed, IO operation was illegal.(已经关闭,IO操作是非法的.)"),
+ STORAGE_HAS_BEEN_CLOSED(
+ 52002, "storage has been closed.(存储已关闭.)", "storage has been
closed.(存储已关闭.)");
+
+ /** 错误码 */
+ private int errorCode;
+ /** 错误描述 */
+ private String errorDesc;
+ /** 错误可能出现的原因 */
+ private String comment;
+
+ LinkisIoFileClientErrorCodeSummary(int errorCode, String errorDesc, String
comment) {
+ this.errorCode = errorCode;
+ this.errorDesc = errorDesc;
+ this.comment = comment;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorDesc() {
+ return errorDesc;
+ }
+
+ public void setErrorDesc(String errorDesc) {
+ this.errorDesc = errorDesc;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ @Override
+ public String toString() {
+ return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
+ }
+}
diff --git
a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/errorcode/LinkisIoFileErrorCodeSummary.java
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/errorcode/LinkisIoFileErrorCodeSummary.java
new file mode 100644
index 000000000..42710cb53
--- /dev/null
+++
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/errorcode/LinkisIoFileErrorCodeSummary.java
@@ -0,0 +1,72 @@
+/*
+ * 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.linkis.storage.errorcode;
+
+public enum LinkisIoFileErrorCodeSummary {
+ CANNOT_BE_EMPTY(
+ 53002,
+ "The read method parameter cannot be empty(read方法参数不能为空)",
+ "The read method parameter cannot be empty(read方法参数不能为空)"),
+ FS_CAN_NOT_PROXY_TO(
+ 52002, "FS Can not proxy to:{}(FS 不能代理到:{})", "FS Can not proxy to:{}(FS
不能代理到:{})"),
+ NOT_EXISTS_METHOD(
+ 53003, "not exists method {} in fs {}(方法不存在)", "not exists method {} in
fs {}(方法不存在)"),
+ PARAMETER_CALLS(
+ 53003, "Unsupported parameter calls(不支持的参数调用)", "Unsupported parameter
calls(不支持的参数调用)");
+ /** 错误码 */
+ private int errorCode;
+ /** 错误描述 */
+ private String errorDesc;
+ /** 错误可能出现的原因 */
+ private String comment;
+
+ LinkisIoFileErrorCodeSummary(int errorCode, String errorDesc, String
comment) {
+ this.errorCode = errorCode;
+ this.errorDesc = errorDesc;
+ this.comment = comment;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorDesc() {
+ return errorDesc;
+ }
+
+ public void setErrorDesc(String errorDesc) {
+ this.errorDesc = errorDesc;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ @Override
+ public String toString() {
+ return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
+ }
+}
diff --git
a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/errorcode/LinkisStorageErrorCodeSummary.java
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/errorcode/LinkisStorageErrorCodeSummary.java
new file mode 100644
index 000000000..656f07270
--- /dev/null
+++
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/errorcode/LinkisStorageErrorCodeSummary.java
@@ -0,0 +1,95 @@
+/*
+ * 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.linkis.storage.errorcode;
+
+public enum LinkisStorageErrorCodeSummary {
+ UNSUPPORTED_FILE(
+ 50000,
+ "Unsupported file system type(不支持的文件系统类型):{}",
+ "Unsupported file system type(不支持的文件系统类型):{}"),
+ UNSUPPORTED_RESULT(
+ 50000, "Unsupported result type(不支持的结果类型):{}", "Unsupported result
type(不支持的结果类型):{}"),
+ CONFIGURATION_NOT_READ(
+ 50001,
+ "HDFS configuration was not read, please configure hadoop.config.dir or
add env:HADOOP_CONF_DIR(HDFS 配置未读取,请配置 hadoop.config.dir 或添加
env:HADOOP_CONF_DIR)",
+ "HDFS configuration was not read, please configure hadoop.config.dir or
add env:HADOOP_CONF_DIR(HDFS 配置未读取,请配置 hadoop.config.dir 或添加
env:HADOOP_CONF_DIR)"),
+ FAILED_TO_READ_INTEGER(51000, "failed to read integer(读取整数失败)", "failed to
read integer(读取整数失败)"),
+ THE_FILE_IS_EMPTY(51000, "The file{}is empty(文件{}为空)", "The file{}is
empty(文件{}为空)"),
+ TO_BE_UNKNOW(51001, "", ""),
+ FSN_NOT_INIT_EXCEPTION(52000, "FSNotInitException", "FSNotInitException"),
+ PARSING_METADATA_FAILED(
+ 52001, "Parsing metadata failed(解析元数据失败)", "Parsing metadata
failed(解析元数据失败)"),
+ TABLE_ARE_NOT_SUPPORTED(
+ 52002,
+ "Result sets that are not tables are not supported(不支持不是表格的结果集)",
+ "Result sets that are not tables are not supported(不支持不是表格的结果集)"),
+ MUST_REGISTER_TOC(
+ 52004,
+ "You must register IOClient before you can use proxy
mode.(必须先注册IOClient,才能使用代理模式)",
+ "You must register IOClient before you can use proxy
mode.(必须先注册IOClient,才能使用代理模式)"),
+ MUST_REGISTER_TOM(
+ 52004,
+ "You must register IOMethodInterceptorCreator before you can use proxy
mode.(必须先注册IOMethodInterceptorCreator,才能使用代理模式)",
+ "You must register IOMethodInterceptorCreator before you can use proxy
mode.(必须先注册IOMethodInterceptorCreator,才能使用代理模式)"),
+ UNSUPPORTED_OPEN_FILE_TYPE(
+ 54001, "Unsupported open file type(不支持打开的文件类型)", "Unsupported open file
type(不支持打开的文件类型)"),
+ INCALID_CUSTOM_PARAMETER(
+ 65000, "Invalid custom parameter(不合法的自定义参数)", "Invalid custom
parameter(不合法的自定义参数)");
+
+ /** 错误码 */
+ private int errorCode;
+ /** 错误描述 */
+ private String errorDesc;
+ /** 错误可能出现的原因 */
+ private String comment;
+
+ LinkisStorageErrorCodeSummary(int errorCode, String errorDesc, String
comment) {
+ this.errorCode = errorCode;
+ this.errorDesc = errorDesc;
+ this.comment = comment;
+ }
+
+ public int getErrorCode() {
+ return errorCode;
+ }
+
+ public void setErrorCode(int errorCode) {
+ this.errorCode = errorCode;
+ }
+
+ public String getErrorDesc() {
+ return errorDesc;
+ }
+
+ public void setErrorDesc(String errorDesc) {
+ this.errorDesc = errorDesc;
+ }
+
+ public String getComment() {
+ return comment;
+ }
+
+ public void setComment(String comment) {
+ this.comment = comment;
+ }
+
+ @Override
+ public String toString() {
+ return "errorCode: " + this.errorCode + ", errorDesc:" + this.errorDesc;
+ }
+}
diff --git
a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/FSNotInitException.java
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/FSNotInitException.java
index 885e6748d..7c4d58764 100644
---
a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/FSNotInitException.java
+++
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/FSNotInitException.java
@@ -19,10 +19,12 @@ package org.apache.linkis.storage.exception;
import org.apache.linkis.common.exception.WarnException;
+import static
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.FSN_NOT_INIT_EXCEPTION;
+
public class FSNotInitException extends WarnException {
public FSNotInitException() {
- super(52000, "FSNotInitException");
+ super(FSN_NOT_INIT_EXCEPTION.getErrorCode(),
FSN_NOT_INIT_EXCEPTION.getErrorDesc());
}
public FSNotInitException(int errCode, String desc) {
diff --git
a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorCode.java
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorCode.java
index 8781ec0c4..761161007 100644
---
a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorCode.java
+++
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/exception/StorageErrorCode.java
@@ -20,7 +20,7 @@ package org.apache.linkis.storage.exception;
public enum StorageErrorCode {
/** */
- FS_NOT_INIT(53001, "please init first");
+ FS_NOT_INIT(53001, "please init first(请先初始化)");
StorageErrorCode(int errorCode, String message) {
this.code = errorCode;
diff --git
a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/LocalFileSystem.java
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/LocalFileSystem.java
index 82975d541..63d8cc642 100644
---
a/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/LocalFileSystem.java
+++
b/linkis-commons/linkis-storage/src/main/java/org/apache/linkis/storage/fs/impl/LocalFileSystem.java
@@ -57,6 +57,8 @@ import java.util.Stack;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.TO_BE_UNKNOW;
+
public class LocalFileSystem extends FileSystem {
private static final Logger LOG =
LoggerFactory.getLogger(LocalFileSystem.class);
@@ -233,7 +235,7 @@ public class LocalFileSystem extends FileSystem {
} catch (NoSuchFileException e) {
LOG.warn("File or folder does not exist or file name is
garbled(文件或者文件夹不存在或者文件名乱码)", e);
- throw new StorageWarnException(51001, e.getMessage());
+ throw new StorageWarnException(TO_BE_UNKNOW.getErrorCode(),
e.getMessage());
}
return true;
}
@@ -326,7 +328,7 @@ public class LocalFileSystem extends FileSystem {
attr = Files.readAttributes(Paths.get(fsPath.getPath()),
PosixFileAttributes.class);
} catch (NoSuchFileException e) {
LOG.warn("File or folder does not exist or file name is
garbled(文件或者文件夹不存在或者文件名乱码)", e);
- throw new StorageWarnException(51001, e.getMessage());
+ throw new StorageWarnException(TO_BE_UNKNOW.getErrorCode(),
e.getMessage());
}
fsPath.setIsdir(attr.isDirectory());
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/FSFactory.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/FSFactory.scala
index c61d33cfe..dd5d9d806 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/FSFactory.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/FSFactory.scala
@@ -19,6 +19,7 @@ package org.apache.linkis.storage
import org.apache.linkis.common.io.{Fs, FsPath}
import org.apache.linkis.common.utils.Logging
+import
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.UNSUPPORTED_FILE
import org.apache.linkis.storage.exception.StorageFatalException
import org.apache.linkis.storage.factory.BuildFactory
import org.apache.linkis.storage.utils.{StorageConfiguration, StorageUtils}
@@ -32,7 +33,10 @@ object FSFactory extends Logging {
def getBuildFactory(fsName: String): BuildFactory = {
if (!buildClasses.contains(fsName)) {
- throw new StorageFatalException(50000, s"Unsupported file system
type(不支持的文件系统类型):$fsName")
+ throw new StorageFatalException(
+ UNSUPPORTED_FILE.getErrorCode,
+ s"Unsupported file system type(不支持的文件系统类型):$fsName"
+ )
}
buildClasses(fsName)
}
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/domain/Dolphin.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/domain/Dolphin.scala
index be9656eb1..378c2c2ec 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/domain/Dolphin.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/domain/Dolphin.scala
@@ -18,6 +18,7 @@
package org.apache.linkis.storage.domain
import org.apache.linkis.common.utils.Logging
+import
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.FAILED_TO_READ_INTEGER
import org.apache.linkis.storage.exception.StorageWarnException
import org.apache.linkis.storage.utils.{StorageConfiguration, StorageUtils}
@@ -67,7 +68,10 @@ object Dolphin extends Logging {
def readInt(inputStream: InputStream): Int = {
val bytes = new Array[Byte](INT_LEN + 1)
if (StorageUtils.readBytes(inputStream, bytes, INT_LEN) != INT_LEN) {
- throw new StorageWarnException(51000, "failed to read integer(读取整数失败)")
+ throw new StorageWarnException(
+ FAILED_TO_READ_INTEGER.getErrorCode,
+ FAILED_TO_READ_INTEGER.getErrorDesc
+ )
}
getString(bytes, 0, INT_LEN).toInt
}
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/io/IOClient.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/io/IOClient.scala
index 0457b8a1f..b21bf7e49 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/io/IOClient.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/io/IOClient.scala
@@ -18,6 +18,7 @@
package org.apache.linkis.storage.io
import org.apache.linkis.storage.domain.MethodEntity
+import
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.MUST_REGISTER_TOC
import org.apache.linkis.storage.exception.StorageErrorException
import java.util.UUID
@@ -50,8 +51,8 @@ object IOClient {
def getIOClient(): IOClient = {
if (ioClient == null) {
throw new StorageErrorException(
- 52004,
- "You must register IOClient before you can use proxy
mode.(必须先注册IOClient,才能使用代理模式)"
+ MUST_REGISTER_TOC.getErrorCode,
+ MUST_REGISTER_TOC.getErrorDesc
)
}
ioClient
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/io/IOMethodInterceptorCreator.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/io/IOMethodInterceptorCreator.scala
index ec298b517..51e1589eb 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/io/IOMethodInterceptorCreator.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/io/IOMethodInterceptorCreator.scala
@@ -17,6 +17,7 @@
package org.apache.linkis.storage.io
+import
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.MUST_REGISTER_TOM
import org.apache.linkis.storage.exception.StorageErrorException
import org.springframework.cglib.proxy.MethodInterceptor
@@ -42,8 +43,8 @@ object IOMethodInterceptorCreator {
def getIOMethodInterceptor(fsName: String): MethodInterceptor = {
if (interceptorCreator == null) {
throw new StorageErrorException(
- 52004,
- "You must register IOMethodInterceptorCreator before you can use proxy
mode.(必须先注册IOMethodInterceptorCreator,才能使用代理模式)"
+ MUST_REGISTER_TOM.getErrorCode,
+ MUST_REGISTER_TOM.getErrorDesc
)
}
interceptorCreator.createIOMethodInterceptor(fsName)
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/DefaultResultSetFactory.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/DefaultResultSetFactory.scala
index f9fd3c9dc..78932115c 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/DefaultResultSetFactory.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/DefaultResultSetFactory.scala
@@ -22,6 +22,10 @@ import org.apache.linkis.common.io.resultset.ResultSet
import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.storage.FSFactory
import org.apache.linkis.storage.domain.Dolphin
+import org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.{
+ THE_FILE_IS_EMPTY,
+ UNSUPPORTED_RESULT
+}
import org.apache.linkis.storage.exception.{StorageErrorException,
StorageWarnException}
import org.apache.linkis.storage.utils.{StorageConfiguration, StorageUtils}
@@ -43,7 +47,10 @@ class DefaultResultSetFactory extends ResultSetFactory with
Logging {
override def getResultSetByType(resultSetType: String): ResultSet[_ <:
MetaData, _ <: Record] = {
if (!resultClasses.contains(resultSetType)) {
- throw new StorageErrorException(50000, s"Unsupported result
type(不支持的结果类型):$resultSetType")
+ throw new StorageErrorException(
+ UNSUPPORTED_RESULT.getErrorCode,
+ s"Unsupported result type(不支持的结果类型):$resultSetType"
+ )
}
resultClasses(resultSetType).newInstance()
}
@@ -78,7 +85,7 @@ class DefaultResultSetFactory extends ResultSetFactory with
Logging {
val resultSetType = Dolphin.getType(inputStream)
if (StringUtils.isEmpty(resultSetType)) {
throw new StorageWarnException(
- 51000,
+ THE_FILE_IS_EMPTY.getErrorCode,
s"The file (${fsPath.getPath}) is empty(文件(${fsPath.getPath}) 为空)"
)
}
@@ -99,7 +106,7 @@ class DefaultResultSetFactory extends ResultSetFactory with
Logging {
val resultSetType = Dolphin.getType(inputStream)
if (StringUtils.isEmpty(resultSetType)) {
throw new StorageWarnException(
- 51000,
+ THE_FILE_IS_EMPTY.getErrorCode,
s"The file (${fsPath.getPath}) is empty(文件(${fsPath.getPath}) 为空)"
)
}
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/ResultSetReader.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/ResultSetReader.scala
index 3b1c4ad2b..663e379b5 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/ResultSetReader.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/ResultSetReader.scala
@@ -20,6 +20,7 @@ package org.apache.linkis.storage.resultset
import org.apache.linkis.common.io.{FsPath, MetaData, Record}
import org.apache.linkis.common.io.resultset.{ResultSet, ResultSetReader}
import org.apache.linkis.storage.FSFactory
+import
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.TABLE_ARE_NOT_SUPPORTED
import org.apache.linkis.storage.exception.StorageErrorException
import org.apache.linkis.storage.resultset.table.{TableMetaData, TableRecord,
TableResultSet}
@@ -67,8 +68,8 @@ object ResultSetReader {
val resultSet = rsFactory.getResultSet(res)
if (ResultSetFactory.TABLE_TYPE != resultSet.resultSetType()) {
throw new StorageErrorException(
- 52002,
- "Result sets that are not tables are not supported(不支持不是表格的结果集)"
+ TABLE_ARE_NOT_SUPPORTED.getErrorCode,
+ TABLE_ARE_NOT_SUPPORTED.getErrorDesc
)
}
ResultSetReader.getResultSetReader(resultSet.asInstanceOf[TableResultSet], res)
@@ -77,8 +78,8 @@ object ResultSetReader {
val resultSet = rsFactory.getResultSetByPath(resPath)
if (ResultSetFactory.TABLE_TYPE != resultSet.resultSetType()) {
throw new StorageErrorException(
- 52002,
- "Result sets that are not tables are not supported(不支持不是表格的结果集)"
+ TABLE_ARE_NOT_SUPPORTED.getErrorCode,
+ TABLE_ARE_NOT_SUPPORTED.getErrorDesc
)
}
val fs = FSFactory.getFs(resPath)
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/table/TableResultDeserializer.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/table/TableResultDeserializer.scala
index 07612ef7e..40c4e031f 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/table/TableResultDeserializer.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/resultset/table/TableResultDeserializer.scala
@@ -19,6 +19,7 @@ package org.apache.linkis.storage.resultset.table
import org.apache.linkis.common.io.resultset.ResultDeserializer
import org.apache.linkis.storage.domain.{Column, DataType, Dolphin}
+import
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.PARSING_METADATA_FAILED
import org.apache.linkis.storage.exception.StorageErrorException
import scala.collection.mutable.ArrayBuffer
@@ -38,7 +39,10 @@ class TableResultDeserializer extends
ResultDeserializer[TableMetaData, TableRec
} else colString.split(Dolphin.COL_SPLIT)
var index = Dolphin.INT_LEN + colByteLen
if (colArray.length % 3 != 0) {
- throw new StorageErrorException(52001, "Parsing metadata
failed(解析元数据失败)")
+ throw new StorageErrorException(
+ PARSING_METADATA_FAILED.getErrorCode,
+ PARSING_METADATA_FAILED.getErrorDesc
+ )
}
val columns = new ArrayBuffer[Column]()
for (i <- 0 until (colArray.length, 3)) {
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/script/parser/CommonScriptParser.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/script/parser/CommonScriptParser.scala
index 711b44315..5d480eaeb 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/script/parser/CommonScriptParser.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/script/parser/CommonScriptParser.scala
@@ -17,6 +17,7 @@
package org.apache.linkis.storage.script.parser
+import
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.INCALID_CUSTOM_PARAMETER
import org.apache.linkis.storage.exception.StorageErrorException
import org.apache.linkis.storage.script.{Parser, Variable, VariableParser}
@@ -31,15 +32,24 @@ abstract class CommonScriptParser extends Parser {
case _ =>
val split = line.split("=")
if (split.length != 2) {
- throw new StorageErrorException(65000, "Invalid custom
parameter(不合法的自定义参数)")
+ throw new StorageErrorException(
+ INCALID_CUSTOM_PARAMETER.getErrorCode(),
+ INCALID_CUSTOM_PARAMETER.getErrorDesc
+ )
}
val value = split(1).trim
val subSplit = split(0).split(" ")
if (subSplit.filter(_ != "").size != 4) {
- throw new StorageErrorException(65000, "Invalid custom
parameter(不合法的自定义参数)")
+ throw new StorageErrorException(
+ INCALID_CUSTOM_PARAMETER.getErrorCode(),
+ INCALID_CUSTOM_PARAMETER.getErrorDesc
+ )
}
if (!subSplit.filter(_ != "")(0).equals(prefixConf)) {
- throw new StorageErrorException(65000, "Invalid custom
parameter(不合法的自定义参数)")
+ throw new StorageErrorException(
+ INCALID_CUSTOM_PARAMETER.getErrorCode(),
+ INCALID_CUSTOM_PARAMETER.getErrorDesc
+ )
}
val sortParent = subSplit.filter(_ != "")(1).trim
val sort = subSplit.filter(_ != "")(2).trim
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/source/FileSource.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/source/FileSource.scala
index 84fcc9a60..7a9fa4f04 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/source/FileSource.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/source/FileSource.scala
@@ -19,6 +19,7 @@ package org.apache.linkis.storage.source
import org.apache.linkis.common.io._
import org.apache.linkis.storage.conf.LinkisStorageConf
+import
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.UNSUPPORTED_OPEN_FILE_TYPE
import org.apache.linkis.storage.exception.StorageErrorException
import org.apache.linkis.storage.resultset.{ResultSetFactory, ResultSetReader}
import org.apache.linkis.storage.script.ScriptFsReader
@@ -89,8 +90,12 @@ object FileSource {
}
def create(fsPath: FsPath, fs: Fs): FileSource = {
- if (!canRead(fsPath.getPath))
- throw new StorageErrorException(54001, "Unsupported open file
type(不支持打开的文件类型)")
+ if (!canRead(fsPath.getPath)) {
+ throw new StorageErrorException(
+ UNSUPPORTED_OPEN_FILE_TYPE.getErrorCode,
+ UNSUPPORTED_OPEN_FILE_TYPE.getErrorDesc
+ )
+ }
if (isResultSet(fsPath)) {
new ResultsetFileSource(Array(createResultSetFileSplit(fsPath, fs)))
} else {
@@ -99,8 +104,12 @@ object FileSource {
}
def create(fsPath: FsPath, is: InputStream): FileSource = {
- if (!canRead(fsPath.getPath))
- throw new StorageErrorException(54001, "Unsupported open file
type(不支持打开的文件类型)")
+ if (!canRead(fsPath.getPath)) {
+ throw new StorageErrorException(
+ UNSUPPORTED_OPEN_FILE_TYPE.getErrorCode,
+ UNSUPPORTED_OPEN_FILE_TYPE.getErrorDesc
+ )
+ }
if (isResultSet(fsPath)) {
new ResultsetFileSource(Array(createResultSetFileSplit(fsPath, is)))
} else {
diff --git
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/StorageUtils.scala
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/StorageUtils.scala
index d025ae664..90eb319fa 100644
---
a/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/StorageUtils.scala
+++
b/linkis-commons/linkis-storage/src/main/scala/org/apache/linkis/storage/utils/StorageUtils.scala
@@ -21,6 +21,7 @@ import org.apache.linkis.common.io.{Fs, FsPath}
import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.hadoop.common.conf.HadoopConf
import org.apache.linkis.storage.{LineMetaData, LineRecord}
+import
org.apache.linkis.storage.errorcode.LinkisStorageErrorCodeSummary.CONFIGURATION_NOT_READ
import org.apache.linkis.storage.exception.StorageFatalException
import org.apache.linkis.storage.resultset.{ResultSetFactory, ResultSetReader,
ResultSetWriter}
@@ -180,8 +181,8 @@ object StorageUtils extends Logging {
// TODO IO-client mode need return false
if (!confPath.exists() || confPath.isFile) {
throw new StorageFatalException(
- 50001,
- "HDFS configuration was not read, please configure hadoop.config.dir
or add env:HADOOP_CONF_DIR"
+ CONFIGURATION_NOT_READ.getErrorCode,
+ CONFIGURATION_NOT_READ.getErrorDesc
)
} else true
}
diff --git a/linkis-dist/release-docs/licenses/License-druid.txt
b/linkis-dist/release-docs/licenses/License-druid.txt
deleted file mode 100644
index 52d99a66d..000000000
--- a/linkis-dist/release-docs/licenses/License-druid.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-Copyright 1999-2018 Alibaba Group Holding Ltd.
-
-Licensed 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.
diff --git
a/linkis-engineconn-plugins/io_file/src/main/scala/org/apache/linkis/manager/engineplugin/io/executor/IoEngineConnExecutor.scala
b/linkis-engineconn-plugins/io_file/src/main/scala/org/apache/linkis/manager/engineplugin/io/executor/IoEngineConnExecutor.scala
index 874fc1630..90e0a0e02 100644
---
a/linkis-engineconn-plugins/io_file/src/main/scala/org/apache/linkis/manager/engineplugin/io/executor/IoEngineConnExecutor.scala
+++
b/linkis-engineconn-plugins/io_file/src/main/scala/org/apache/linkis/manager/engineplugin/io/executor/IoEngineConnExecutor.scala
@@ -43,6 +43,11 @@ import org.apache.linkis.scheduler.executer.{
}
import org.apache.linkis.storage.FSFactory
import org.apache.linkis.storage.domain.{MethodEntity, MethodEntitySerializer}
+import org.apache.linkis.storage.errorcode.LinkisIoFileErrorCodeSummary.{
+ FS_CAN_NOT_PROXY_TO,
+ NOT_EXISTS_METHOD,
+ PARAMETER_CALLS
+}
import org.apache.linkis.storage.exception.{StorageErrorCode,
StorageErrorException}
import org.apache.linkis.storage.fs.FileSystem
import org.apache.linkis.storage.utils.StorageUtils
@@ -137,7 +142,10 @@ class IoEngineConnExecutor(val id: Int, val outputLimit:
Int = 10)
case "available" =>
val fs = getUserFS(method)
if (method.params == null || method.params.length != 2) {
- throw new StorageErrorException(53003, "Unsupported parameter calls")
+ throw new StorageErrorException(
+ PARAMETER_CALLS.getErrorCode,
+ PARAMETER_CALLS.getErrorDesc
+ )
}
val dest = MethodEntitySerializer.deserializerToJavaObject(
method.params(0).asInstanceOf[String],
@@ -159,7 +167,10 @@ class IoEngineConnExecutor(val id: Int, val outputLimit:
Int = 10)
case "renameTo" =>
val fs = getUserFS(method)
if (method.params == null || method.params.length != 2) {
- throw new StorageErrorException(53003, "Unsupported parameter calls")
+ throw new StorageErrorException(
+ PARAMETER_CALLS.getErrorCode,
+ PARAMETER_CALLS.getErrorDesc
+ )
}
fs.renameTo(
MethodEntitySerializer
@@ -172,7 +183,10 @@ class IoEngineConnExecutor(val id: Int, val outputLimit:
Int = 10)
SuccessExecuteResponse()
case "list" =>
if (method.params == null || method.params.length != 1) {
- throw new StorageErrorException(53003, "Unsupported parameter calls")
+ throw new StorageErrorException(
+ PARAMETER_CALLS.getErrorCode,
+ PARAMETER_CALLS.getErrorDesc
+ )
}
val fs = getUserFS(method)
val dest = MethodEntitySerializer.deserializerToJavaObject(
@@ -187,7 +201,10 @@ class IoEngineConnExecutor(val id: Int, val outputLimit:
Int = 10)
)
case "listPathWithError" =>
if (method.params == null || method.params.length != 1) {
- throw new StorageErrorException(53003, "Unsupported parameter calls")
+ throw new StorageErrorException(
+ PARAMETER_CALLS.getErrorCode,
+ PARAMETER_CALLS.getErrorDesc
+ )
}
val fs = getUserFS(method).asInstanceOf[FileSystem]
val dest = MethodEntitySerializer.deserializerToJavaObject(
@@ -305,7 +322,10 @@ class IoEngineConnExecutor(val id: Int, val outputLimit:
Int = 10)
val properties = methodEntity.params(0).asInstanceOf[Map[String, String]]
val proxyUser = methodEntity.proxyUser
if (!fsProxyService.canProxyUser(methodEntity.creatorUser, proxyUser,
methodEntity.fsType)) {
- throw new StorageErrorException(52002, s"FS Can not proxy to:$proxyUser")
+ throw new StorageErrorException(
+ FS_CAN_NOT_PROXY_TO.getErrorCode,
+ s"FS Can not proxy to:$proxyUser"
+ )
}
if (!userFSInfos.containsKey(proxyUser)) {
userFSInfos synchronized {
@@ -361,7 +381,7 @@ class IoEngineConnExecutor(val id: Int, val outputLimit:
Int = 10)
.find(_.getGenericParameterTypes.length == parameterSize)
if (realMethod.isEmpty) {
throw new StorageErrorException(
- 53003,
+ NOT_EXISTS_METHOD.getErrorCode,
s"not exists method $methodName in fs ${fs.getClass.getSimpleName}."
)
}
diff --git
a/linkis-engineconn-plugins/io_file/src/main/scala/org/apache/linkis/manager/engineplugin/io/utils/IOHelp.scala
b/linkis-engineconn-plugins/io_file/src/main/scala/org/apache/linkis/manager/engineplugin/io/utils/IOHelp.scala
index b4dcc64f5..b5e181cc3 100644
---
a/linkis-engineconn-plugins/io_file/src/main/scala/org/apache/linkis/manager/engineplugin/io/utils/IOHelp.scala
+++
b/linkis-engineconn-plugins/io_file/src/main/scala/org/apache/linkis/manager/engineplugin/io/utils/IOHelp.scala
@@ -20,6 +20,10 @@ package org.apache.linkis.manager.engineplugin.io.utils
import org.apache.linkis.common.io.{Fs, FsPath}
import org.apache.linkis.common.utils.Utils
import org.apache.linkis.storage.domain.{MethodEntity, MethodEntitySerializer}
+import org.apache.linkis.storage.errorcode.LinkisIoFileErrorCodeSummary.{
+ CANNOT_BE_EMPTY,
+ PARAMETER_CALLS
+}
import org.apache.linkis.storage.exception.StorageErrorException
import org.apache.linkis.storage.resultset.{ResultSetFactory, ResultSetReader,
ResultSetWriter}
import org.apache.linkis.storage.resultset.io.{IOMetaData, IORecord}
@@ -39,10 +43,7 @@ object IOHelp {
*/
def read(fs: Fs, method: MethodEntity): String = {
if (method.params == null || method.params.isEmpty) {
- throw new StorageErrorException(
- 53002,
- "The read method parameter cannot be empty(read方法参数不能为空)"
- )
+ throw new StorageErrorException(CANNOT_BE_EMPTY.getErrorCode,
CANNOT_BE_EMPTY.getErrorDesc)
}
val dest = MethodEntitySerializer.deserializerToJavaObject(
method.params(0).asInstanceOf[String],
@@ -73,7 +74,8 @@ object IOHelp {
writer.addMetaData(ioMetaData)
writer.addRecord(ioRecord)
writer.toString()
- } else throw new StorageErrorException(53003, "Unsupported parameter
call(不支持的参数调用)")
+ } else
+ throw new StorageErrorException(PARAMETER_CALLS.getErrorCode,
PARAMETER_CALLS.getErrorDesc)
}(IOUtils.closeQuietly(inputStream))
}
@@ -84,7 +86,7 @@ object IOHelp {
*/
def write(fs: Fs, method: MethodEntity): Unit = {
if (method.params == null || method.params.isEmpty) {
- throw new StorageErrorException(53003, "Unsupported parameter
call(不支持的参数调用)")
+ throw new StorageErrorException(PARAMETER_CALLS.getErrorCode,
PARAMETER_CALLS.getErrorDesc)
}
val dest = MethodEntitySerializer.deserializerToJavaObject(
method.params(0).asInstanceOf[String],
diff --git
a/linkis-extensions/linkis-io-file-client/src/main/scala/org/apache/linkis/storage/io/iteraceptor/IOMethodInterceptor.scala
b/linkis-extensions/linkis-io-file-client/src/main/scala/org/apache/linkis/storage/io/iteraceptor/IOMethodInterceptor.scala
index 96146bb3c..92feb8a56 100644
---
a/linkis-extensions/linkis-io-file-client/src/main/scala/org/apache/linkis/storage/io/iteraceptor/IOMethodInterceptor.scala
+++
b/linkis-extensions/linkis-io-file-client/src/main/scala/org/apache/linkis/storage/io/iteraceptor/IOMethodInterceptor.scala
@@ -22,6 +22,7 @@ import org.apache.linkis.common.utils.{Logging, Utils}
import org.apache.linkis.manager.label.constant.LabelKeyConstant
import org.apache.linkis.manager.label.entity.entrance.BindEngineLabel
import org.apache.linkis.storage.domain.{FsPathListWithError, MethodEntity,
MethodEntitySerializer}
+import org.apache.linkis.storage.errorcode.LinkisIoFileClientErrorCodeSummary._
import org.apache.linkis.storage.exception.{FSNotInitException,
StorageErrorException}
import org.apache.linkis.storage.io.client.IOClient
import org.apache.linkis.storage.io.utils.IOClientUtils
@@ -103,10 +104,7 @@ class IOMethodInterceptor(fsType: String) extends
MethodInterceptor with Logging
def initFS(methodName: String = "init"): Unit = {
if (!properties.contains(StorageConfiguration.PROXY_USER.key)) {
- throw new StorageErrorException(
- 52002,
- "no user set, we cannot get the permission information."
- )
+ throw new StorageErrorException(NO_PROXY_USER.getErrorCode,
NO_PROXY_USER.getErrorDesc)
}
bindEngineLabel.setIsJobGroupHead("true")
bindEngineLabel.setIsJobGroupEnd("false")
@@ -131,13 +129,18 @@ class IOMethodInterceptor(fsType: String) extends
MethodInterceptor with Logging
inited = true
bindEngineLabel.setIsJobGroupEnd("false")
bindEngineLabel.setIsJobGroupHead("false")
- } else throw new StorageErrorException(52002, s"Failed to init FS for
user:$getProxyUser ")
+ } else {
+ throw new StorageErrorException(
+ FAILED_TO_INIT_USER.getErrorCode,
+ s"Failed to init FS for user:$getProxyUser "
+ )
+ }
}
def beforeOperation(): Unit = {
if (closed) {
throw new StorageErrorException(
- 52002,
+ ENGINE_CLOSED_IO_ILLEGAL.getErrorCode,
s"$fsType storage($id) engine($bindEngineLabel) has been closed, IO
operation was illegal."
)
}
@@ -159,7 +162,10 @@ class IOMethodInterceptor(fsType: String) extends
MethodInterceptor with Logging
methodProxy: MethodProxy
): AnyRef = {
if (closed && method.getName != "close") {
- throw new StorageErrorException(52002, s"$fsType storage has been
closed.")
+ throw new StorageErrorException(
+ STORAGE_HAS_BEEN_CLOSED.getErrorCode,
+ s"$fsType storage has been closed."
+ )
}
if (System.currentTimeMillis() - lastAccessTime >=
iOEngineExecutorMaxFreeTime) synchronized {
method.getName match {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]