2 * Copyright 2016 [ZTE] and others.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package org.openo.commontosca.catalog.db.exception;
20 public class ErrorCodeException extends Exception {
22 private static final long serialVersionUID = 3220072444842529499L;
23 private int categoryCode = 0;
24 private int errorCode = 1;
25 private String[] arguments = null;
27 private static String defaultText = null;
30 public static void setDefaultText(String text) {
35 public static String getDefaultText() {
40 public ErrorCodeException(int code, String debugMessage) {
41 this(code, debugMessage, null);
45 * error code exception.
46 * @param code error code
47 * @param debugMessage debug message
48 * @param arguments arguments
50 public ErrorCodeException(int code, String debugMessage, String[] arguments) {
52 this.errorCode = code;
53 this.arguments = arguments;
57 public ErrorCodeException(Throwable source, int code) {
58 this(source, code, (String[]) null);
62 * error code exception.
63 * @param source Throwable
64 * @param code error code
65 * @param arguments arguments
67 public ErrorCodeException(Throwable source, int code, String[] arguments) {
69 this.errorCode = code;
70 this.arguments = arguments;
74 public ErrorCodeException(Throwable source, int code, String debugMessage) {
75 this(source, code, debugMessage, null);
79 * error code exception.
80 * @param source Throwable
81 * @param code error code
82 * @param debugMessage debug message
83 * @param arguments arguments
85 public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments) {
86 super(debugMessage, source);
87 this.errorCode = code;
88 this.arguments = arguments;
92 public ErrorCodeException(int category, int code, String debugMessage) {
93 this(category, code, debugMessage, null);
97 public ErrorCodeException(int category, int code, String debugMessage, String[] arguments) {
99 this.categoryCode = category;
100 this.errorCode = code;
101 this.arguments = arguments;
105 public ErrorCodeException(Throwable source, int category, int code) {
106 this(source, category, code, (String[]) null);
110 public ErrorCodeException(Throwable source, int category, int code, String[] arguments) {
112 this.categoryCode = category;
113 this.errorCode = code;
114 this.arguments = arguments;
118 public ErrorCodeException(Throwable source, int category, int code, String debugMessage) {
119 this(source, category, code, debugMessage, null);
123 public ErrorCodeException(Throwable source, int category, int code, String debugMessage,
124 String[] arguments) {
125 super(debugMessage, source);
126 this.categoryCode = category;
127 this.errorCode = code;
128 this.arguments = arguments;
132 public int getCategory() {
136 public int getErrorCode() {
141 public String[] getArguments() {