This is an automated email from the ASF dual-hosted git repository. qiaojialin pushed a commit to branch remove_unused_exception in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 77010bb346a4f1fac2dcc34a4917dcc3ad3bdba9 Author: qiaojialin <[email protected]> AuthorDate: Fri Jul 19 16:03:44 2019 +0800 remove unused exception --- .../iotdb/db/exception/ErrorDebugException.java | 37 ------- .../UnSupportedOverflowOpTypeException.java | 42 -------- .../iotdb/db/exception/WALOverSizedException.java | 38 -------- .../db/exception/builder/ExceptionBuilder.java | 108 --------------------- .../exception/codebased/AuthPluginException.java | 33 ------- .../codebased/ConnectionFailedException.java | 32 ------ .../codebased/ConnectionHostException.java | 33 ------- .../exception/codebased/InsecureAPIException.java | 33 ------- .../codebased/InvalidParameterException.java | 32 ------ .../db/exception/codebased/IoTDBException.java | 49 ---------- .../exception/codebased/NoParameterException.java | 32 ------ .../codebased/NoPreparedStatementException.java | 32 ------ .../exception/codebased/OutOfMemoryException.java | 32 ------ .../db/exception/codebased/UnknownException.java | 32 ------ .../qp/GeneratePhysicalPlanException.java | 34 ------- .../java/org/apache/iotdb/db/service/IoTDB.java | 7 -- .../iotdb/db/exception/ExceptionBuilderTest.java | 103 -------------------- 17 files changed, 709 deletions(-) diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/ErrorDebugException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/ErrorDebugException.java deleted file mode 100644 index 9dff25f..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/ErrorDebugException.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.iotdb.db.exception; - -/** - * ErrorDebugException. - * - * @author kangrong - */ -public class ErrorDebugException extends RuntimeException { - - private static final long serialVersionUID = -1123099620556170447L; - - public ErrorDebugException(String msg) { - super(msg); - } - - public ErrorDebugException(Exception e) { - super(e); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/UnSupportedOverflowOpTypeException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/UnSupportedOverflowOpTypeException.java deleted file mode 100644 index 3253a9a..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/UnSupportedOverflowOpTypeException.java +++ /dev/null @@ -1,42 +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.iotdb.db.exception; - -/** - * OverflowOpType could only be INSERT, UPDATE, DELETE. The other situations would throw this - * exception. - * - * @author CGF - */ -public class UnSupportedOverflowOpTypeException extends DeltaEngineRunningException { - - private static final long serialVersionUID = -3834482432038784174L; - - public UnSupportedOverflowOpTypeException(String message, Throwable cause) { - super(message, cause); - } - - public UnSupportedOverflowOpTypeException(String message) { - super(message); - } - - public UnSupportedOverflowOpTypeException(Throwable cause) { - super(cause); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/WALOverSizedException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/WALOverSizedException.java deleted file mode 100644 index 44482d4..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/WALOverSizedException.java +++ /dev/null @@ -1,38 +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.iotdb.db.exception; - -import java.io.IOException; - -public class WALOverSizedException extends IOException { - - private static final long serialVersionUID = -3145068900134508628L; - - public WALOverSizedException() { - super(); - } - - public WALOverSizedException(String message) { - super(message); - } - - public WALOverSizedException(Throwable cause) { - super(cause); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/builder/ExceptionBuilder.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/builder/ExceptionBuilder.java deleted file mode 100644 index 2055bce..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/builder/ExceptionBuilder.java +++ /dev/null @@ -1,108 +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.iotdb.db.exception.builder; - -import java.io.BufferedInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.Properties; -import org.apache.iotdb.db.conf.IoTDBConfig; -import org.apache.iotdb.db.conf.IoTDBConstant; -import org.apache.iotdb.db.conf.IoTDBDescriptor; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ExceptionBuilder { - - public static final int UNKNOWN_ERROR = 20000; - public static final int NO_PARAMETERS_EXISTS = 20001; - public static final int INVALID_PARAMETER_NO = 20002; - public static final int CONN_HOST_ERROR = 20003; - public static final int AUTH_PLUGIN_ERR = 20061; - public static final int INSECURE_API_ERR = 20062; - public static final int OUT_OF_MEMORY = 20064; - public static final int NO_PREPARE_STMT = 20130; - public static final int CON_FAIL_ERR = 20220; - public static final String CONFIG_NAME = "error_info_"; - public static final String FILE_SUFFIX = ".properties"; - public static final String DEFAULT_FILEPATH = "error_info_en.properties"; - private static final Logger logger = LoggerFactory.getLogger(IoTDBDescriptor.class); - private static final ExceptionBuilder INSTANCE = new ExceptionBuilder(); - private Properties properties = new Properties(); - - public static final ExceptionBuilder getInstance() { - return ExceptionBuilder.INSTANCE; - } - - /** - * load error information file. - * - * @param filePath the path of error information file - */ - public void loadInfo(String filePath) { - try(InputStream in = new BufferedInputStream(new FileInputStream(filePath))){ - properties.load(new InputStreamReader(in, StandardCharsets.UTF_8)); - } catch (IOException e) { - logger.error( - "Read file error. File does not exist or file is broken. " - + "File seriesPath: {}.Because: {}.", - filePath, e); - } - } - - /** - * load information. - */ - public void loadInfo() { - String language = IoTDBDescriptor.getInstance().getConfig().getLanguageVersion().toLowerCase(); - - String url = System.getProperty(IoTDBConstant.IOTDB_CONF, null); - if (url == null) { - url = System.getProperty(IoTDBConstant.IOTDB_HOME, null); - if (url != null) { - url = url + File.separatorChar + "conf" + File.separatorChar + ExceptionBuilder.CONFIG_NAME - + language - + FILE_SUFFIX; - } else { - logger.warn( - "Cannot find IOTDB_HOME or IOTDB_CONF environment variable when loading config file {}" - + ", use default configuration", - IoTDBConfig.CONFIG_NAME); - return; - } - } else { - url += (File.separatorChar + ExceptionBuilder.CONFIG_NAME + language + FILE_SUFFIX); - } - - File file = new File(url); - if (!file.exists()) { - url = url.replace(CONFIG_NAME + language + FILE_SUFFIX, DEFAULT_FILEPATH); - } - - loadInfo(url); - } - - public String searchInfo(int errCode) { - return properties.getProperty(String.valueOf(errCode)); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/AuthPluginException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/AuthPluginException.java deleted file mode 100644 index 86c6356..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/AuthPluginException.java +++ /dev/null @@ -1,33 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public class AuthPluginException extends IoTDBException { - - public AuthPluginException() { - super(ExceptionBuilder.AUTH_PLUGIN_ERR); - } - - public AuthPluginException(String userName, String additionalInfo) { - super(ExceptionBuilder.AUTH_PLUGIN_ERR, additionalInfo); - defaultInfo = String.format(defaultInfo, userName); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/ConnectionFailedException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/ConnectionFailedException.java deleted file mode 100644 index 9a6a1a8..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/ConnectionFailedException.java +++ /dev/null @@ -1,32 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public class ConnectionFailedException extends IoTDBException { - - public ConnectionFailedException() { - super(ExceptionBuilder.CON_FAIL_ERR); - } - - public ConnectionFailedException(String additionalInfo) { - super(ExceptionBuilder.CON_FAIL_ERR, additionalInfo); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/ConnectionHostException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/ConnectionHostException.java deleted file mode 100644 index 0421cab..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/ConnectionHostException.java +++ /dev/null @@ -1,33 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public class ConnectionHostException extends IoTDBException { - - public ConnectionHostException() { - super(ExceptionBuilder.CONN_HOST_ERROR); - } - - public ConnectionHostException(String ip, String port, String additionalInfo) { - super(ExceptionBuilder.CONN_HOST_ERROR, additionalInfo); - defaultInfo = String.format(defaultInfo, ip, port); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/InsecureAPIException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/InsecureAPIException.java deleted file mode 100644 index 03934fe..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/InsecureAPIException.java +++ /dev/null @@ -1,33 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public class InsecureAPIException extends IoTDBException { - - public InsecureAPIException() { - super(ExceptionBuilder.INSECURE_API_ERR); - } - - public InsecureAPIException(String functionName, String additionalInfo) { - super(ExceptionBuilder.INSECURE_API_ERR, additionalInfo); - defaultInfo = String.format(defaultInfo, functionName); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/InvalidParameterException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/InvalidParameterException.java deleted file mode 100644 index 0c5cd2a..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/InvalidParameterException.java +++ /dev/null @@ -1,32 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public class InvalidParameterException extends IoTDBException { - - public InvalidParameterException() { - super(ExceptionBuilder.INVALID_PARAMETER_NO); - } - - public InvalidParameterException(String additionalInfo) { - super(ExceptionBuilder.INVALID_PARAMETER_NO, additionalInfo); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/IoTDBException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/IoTDBException.java deleted file mode 100644 index 246b19b..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/IoTDBException.java +++ /dev/null @@ -1,49 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public abstract class IoTDBException extends Exception { - - private static final long serialVersionUID = -8998294067060075273L; - protected final int errorCode; - protected String defaultInfo; - protected String additionalInfo; - - public IoTDBException(int errorCode) { - this.defaultInfo = ExceptionBuilder.getInstance().searchInfo(errorCode); - this.errorCode = errorCode; - - } - - public IoTDBException(int errCode, String additionalInfo) { - this.errorCode = errCode; - this.additionalInfo = additionalInfo; - } - - @Override - public String getMessage() { - if (additionalInfo == null) { - return defaultInfo; - } else { - return defaultInfo + ". " + additionalInfo; - } - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/NoParameterException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/NoParameterException.java deleted file mode 100644 index fce1e42..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/NoParameterException.java +++ /dev/null @@ -1,32 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public class NoParameterException extends IoTDBException { - - public NoParameterException() { - super(ExceptionBuilder.NO_PARAMETERS_EXISTS); - } - - public NoParameterException(String additionalInfo) { - super(ExceptionBuilder.NO_PARAMETERS_EXISTS, additionalInfo); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/NoPreparedStatementException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/NoPreparedStatementException.java deleted file mode 100644 index b55193d..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/NoPreparedStatementException.java +++ /dev/null @@ -1,32 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public class NoPreparedStatementException extends IoTDBException { - - public NoPreparedStatementException() { - super(ExceptionBuilder.NO_PREPARE_STMT); - } - - public NoPreparedStatementException(String additionalInfo) { - super(ExceptionBuilder.NO_PREPARE_STMT, additionalInfo); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/OutOfMemoryException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/OutOfMemoryException.java deleted file mode 100644 index 6f03526..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/OutOfMemoryException.java +++ /dev/null @@ -1,32 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public class OutOfMemoryException extends IoTDBException { - - public OutOfMemoryException() { - super(ExceptionBuilder.OUT_OF_MEMORY); - } - - public OutOfMemoryException(String additionalInfo) { - super(ExceptionBuilder.OUT_OF_MEMORY, additionalInfo); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/UnknownException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/UnknownException.java deleted file mode 100644 index 2d2ba04..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/codebased/UnknownException.java +++ /dev/null @@ -1,32 +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.iotdb.db.exception.codebased; - -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; - -public class UnknownException extends IoTDBException { - - public UnknownException() { - super(ExceptionBuilder.UNKNOWN_ERROR); - } - - public UnknownException(String additionalInfo) { - super(ExceptionBuilder.UNKNOWN_ERROR, additionalInfo); - } -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/exception/qp/GeneratePhysicalPlanException.java b/iotdb/src/main/java/org/apache/iotdb/db/exception/qp/GeneratePhysicalPlanException.java deleted file mode 100644 index ccabdd2..0000000 --- a/iotdb/src/main/java/org/apache/iotdb/db/exception/qp/GeneratePhysicalPlanException.java +++ /dev/null @@ -1,34 +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.iotdb.db.exception.qp; - -import org.apache.iotdb.db.qp.logical.crud.UpdateOperator; - -/** - * This exception is threw when meeting error in {@linkplain UpdateOperator UpdateOperator}. - */ -public class GeneratePhysicalPlanException extends QueryProcessorException { - - private static final long serialVersionUID = -797390809639488007L; - - public GeneratePhysicalPlanException(String msg) { - super(msg); - } - -} diff --git a/iotdb/src/main/java/org/apache/iotdb/db/service/IoTDB.java b/iotdb/src/main/java/org/apache/iotdb/db/service/IoTDB.java index d8e7ead..6d871e3 100644 --- a/iotdb/src/main/java/org/apache/iotdb/db/service/IoTDB.java +++ b/iotdb/src/main/java/org/apache/iotdb/db/service/IoTDB.java @@ -25,7 +25,6 @@ import org.apache.iotdb.db.conf.adapter.IoTDBConfigDynamicAdapter; import org.apache.iotdb.db.cost.statistic.Measurement; import org.apache.iotdb.db.engine.StorageEngine; import org.apache.iotdb.db.exception.StartupException; -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; import org.apache.iotdb.db.metadata.MManager; import org.apache.iotdb.db.monitor.StatMonitor; import org.apache.iotdb.db.rescon.TVListAllocator; @@ -101,8 +100,6 @@ public class IoTDB implements IoTDBMBean { JMXService.registerMBean(getInstance(), mbeanName); - initErrorInformation(); - logger.info("IoTDB is set up."); } @@ -134,10 +131,6 @@ public class IoTDB implements IoTDBMBean { Thread.setDefaultUncaughtExceptionHandler(new IoTDBDefaultThreadExceptionHandler()); } - private void initErrorInformation() { - ExceptionBuilder.getInstance().loadInfo(); - } - private static class IoTDBHolder { private static final IoTDB INSTANCE = new IoTDB(); diff --git a/iotdb/src/test/java/org/apache/iotdb/db/exception/ExceptionBuilderTest.java b/iotdb/src/test/java/org/apache/iotdb/db/exception/ExceptionBuilderTest.java deleted file mode 100644 index d5b9d7b..0000000 --- a/iotdb/src/test/java/org/apache/iotdb/db/exception/ExceptionBuilderTest.java +++ /dev/null @@ -1,103 +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.iotdb.db.exception; - -import static org.junit.Assert.assertEquals; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.nio.charset.StandardCharsets; -import java.util.Properties; -import org.apache.iotdb.db.exception.builder.ExceptionBuilder; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -public class ExceptionBuilderTest { - - @Before - public void before() { - Properties prop = new Properties(); - FileOutputStream out1 = null; - FileOutputStream out2 = null; - try { - out1 = new FileOutputStream("err_info_en.properties", true); - prop.setProperty("20000", "Unknown error"); - prop.setProperty("20001", "No parameters exist in the statement"); - prop.setProperty("20002", "Invalid parameter number"); - prop.setProperty("20003", "Can't connect to server on {}({})"); - prop.setProperty("20061", "Authentication plugin {} reported error: {}"); - prop.setProperty("20062", "Insecure API function call: {}"); - prop.setProperty("20064", "Client ran out of memory"); - prop.setProperty("20130", "Statement not prepared"); - prop.setProperty("20220", "Fail to connect"); - - prop.store(new OutputStreamWriter(out1, StandardCharsets.UTF_8), "english version"); - - out2 = new FileOutputStream("err_info_cn.properties", true); - prop.setProperty("20000", "未知错误"); - prop.setProperty("20001", "语句中无变量"); - prop.setProperty("20002", "无效的变量"); - prop.setProperty("20003", "无法连接到服务器"); - prop.setProperty("20061", "验证失败"); - prop.setProperty("20062", "不安全的函数调用"); - prop.setProperty("20064", "客户端内存溢出"); - prop.setProperty("20130", "语句未就绪"); - prop.setProperty("20220", "连接失败"); - - prop.store(new OutputStreamWriter(out2, StandardCharsets.UTF_8), "chinese version"); - } catch (Exception e) { - e.printStackTrace(); - } finally { - try { - out1.close(); - out2.close(); - } catch (IOException e) { - e.printStackTrace(); - } - } - } - - @After - public void after() { - File file1 = new File("err_info_en.properties"); - File file2 = new File("err_info_cn.properties"); - if (file1.exists()) { - file1.delete(); - } - if (file2.exists()) { - file2.delete(); - } - } - - @Test - public void testLoadProp() { - ExceptionBuilder excpHandler = new ExceptionBuilder(); - excpHandler.loadInfo("err_info_en.properties"); - assertEquals("Invalid parameter number", excpHandler.searchInfo(20002)); - assertEquals("Can't connect to server on {}({})", excpHandler.searchInfo(20003)); - - excpHandler.loadInfo("err_info_cn.properties"); - assertEquals("无法连接到服务器", excpHandler.searchInfo(20003)); - assertEquals("验证失败", excpHandler.searchInfo(20061)); - } - -}
