From 415aaeb592bf4645705bece01bc570cb3a398fd9 Mon Sep 17 00:00:00 2001 From: youbowu Date: Sat, 18 Feb 2017 11:25:18 +0800 Subject: Add new exception class Issue-ID:HOLMES-9 Change-Id: Ib7037b582a1a15b3c6d93daa200b42751268728e Signed-off-by: youbowu --- .../holmes/common/exception/CallException.java | 26 --------------------- .../common/exception/CorrelationException.java | 27 ++++++++++++++++++++++ .../common/exception/DataFormatException.java | 26 --------------------- .../holmes/common/i18n/correlation-i18n-en-US.json | 3 ++- .../holmes/common/i18n/correlation-i18n-zh-CN.json | 4 +++- .../org/openo/holmes/common/utils/I18nProxy.java | 1 + 6 files changed, 33 insertions(+), 54 deletions(-) delete mode 100644 holmes-actions/src/main/java/org/openo/holmes/common/exception/CallException.java create mode 100644 holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java delete mode 100644 holmes-actions/src/main/java/org/openo/holmes/common/exception/DataFormatException.java (limited to 'holmes-actions') diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/exception/CallException.java b/holmes-actions/src/main/java/org/openo/holmes/common/exception/CallException.java deleted file mode 100644 index fe32b26..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/exception/CallException.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2017 ZTE Corporation. - * - * 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. - */ -package org.openo.holmes.common.exception; - -public class CallException extends Exception { - public CallException(String msg, Exception e) { - super(msg, e); - } - - public CallException(String msg) { - super(msg); - } -} \ No newline at end of file diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java b/holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java new file mode 100644 index 0000000..4454cbb --- /dev/null +++ b/holmes-actions/src/main/java/org/openo/holmes/common/exception/CorrelationException.java @@ -0,0 +1,27 @@ +/** + * Copyright 2017 ZTE Corporation. + * + * 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. + */ +package org.openo.holmes.common.exception; + +public class CorrelationException extends Exception { + + public CorrelationException(String msg, Exception e) { + super(msg, e); + } + + public CorrelationException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/exception/DataFormatException.java b/holmes-actions/src/main/java/org/openo/holmes/common/exception/DataFormatException.java deleted file mode 100644 index 7fcc3b2..0000000 --- a/holmes-actions/src/main/java/org/openo/holmes/common/exception/DataFormatException.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright 2017 ZTE Corporation. - * - * 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. - */ -package org.openo.holmes.common.exception; - -public class DataFormatException extends Exception { - public DataFormatException(String msg, Exception e ) { - super( msg, e ); - } - - public DataFormatException(String msg ) { - super( msg ); - } -} diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json index 9aa6357..9581b40 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json +++ b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-en-US.json @@ -25,5 +25,6 @@ "RULE_MANAGEMENT_REPEAT_RULE_NAME": "Rule name repetition", "RULE_MANAGEMENT_RULE_NAME_IS_EMPTY": "Rule name is empty", "RULE_MANAGEMENT_DATA_FORMAT_ERROR": "Data format error", - "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR": "Parameter enabled can only be 0 (not enabled) and 1 (enabled)" + "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR": "Parameter enabled can only be 0 (not enabled) and 1 (enabled)", + "RULE_MANAGEMENT_DB_ERROR": "db error" } diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json index 9ca28fe..1a59c2f 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json +++ b/holmes-actions/src/main/java/org/openo/holmes/common/i18n/correlation-i18n-zh-CN.json @@ -21,5 +21,7 @@ "RULE_MANAGEMENT_REPEAT_RULE_NAME" : "规则名字重复", "RULE_MANAGEMENT_RULE_NAME_IS_EMPTY" : "规则名字为空", "RULE_MANAGEMENT_DATA_FORMAT_ERROR": "数据格式异常", - "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR" : "参数enabled只能为0(未启用)和1(启用)" + "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR" : "参数enabled只能为0(未启用)和1(启用)", + "RULE_MANAGEMENT_DB_ERROR" : "数据库异常" + } diff --git a/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java b/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java index 2eda5da..2c74f03 100644 --- a/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java +++ b/holmes-actions/src/main/java/org/openo/holmes/common/utils/I18nProxy.java @@ -51,6 +51,7 @@ public class I18nProxy { public static final String RULE_MANAGEMENT_REPEAT_RULE_NAME = "RULE_MANAGEMENT_REPEAT_RULE_NAME"; public static final String RULE_MANAGEMENT_DATA_FORMAT_ERROR = "RULE_MANAGEMENT_DATA_FORMAT_ERROR"; public static final String RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR = "RULE_MANAGEMENT_PARAMETER_ENABLED_ERROR"; + public static final String RULE_MANAGEMENT_DB_ERROR = "RULE_MANAGEMENT_DB_ERROR"; private Optional optional = null; -- cgit 1.2.3-korg