📄 trace.java
字号:
/* Copyright (c) 1995-2000, The Hypersonic SQL Group. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the Hypersonic SQL Group nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE HYPERSONIC SQL GROUP, * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * on behalf of the Hypersonic SQL Group. * * * For work added by the HSQL Development Group: * * Copyright (c) 2001-2005, The HSQL Development Group * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the HSQL Development Group nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL HSQL DEVELOPMENT GROUP, HSQLDB.ORG, * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */package org.hsqldb;import java.io.PrintWriter;import org.hsqldb.lib.HsqlByteArrayOutputStream;import org.hsqldb.resources.BundleHandler;/** * handles creation and reporting of error messages and throwing HsqlException * * Rewritten and extended in successive versions of HSQLDB. * * @author Thomas Mueller (Hypersonic SQL Group) * @version 1.8.0 * @since Hypersonic SQL */// fredt@users 20020221 - patch 513005 by sqlbob@users (RMP) - error reporting// fredt@users 20020221 - patch 513005 by sqlbob@users (RMP) - setting trace// the system property hsqldb.tracesystemout == true is now used for printing// trace message to System.out// fredt@users 20020305 - patch 1.7.0 - various new messages added// tony_lai@users 20020820 - patch 595073 - Duplicated exception msg// fredt@users 20021230 - patch 488118 by xclay@users - allow multithreading// wsonic@users 20031005 - moved string literal messages to Trace with new methods// nitin chauhan 20031005 - moved concatenated string in asserts and checks to Trace with new methods// fredt@users 20040322 - removed unused code - class is a collection of static methods now// fredt@users 20050524 - use resource bundle for messages/** @todo fredt - 20021022 management of nested throws inside the program in * such a way that it is possible to return exactly the text of the error * thrown at a given level without higher level messages being added and to * preserve the original error code */public class Trace { public static boolean TRACE = false; public static boolean TRACESYSTEMOUT = false; public static final boolean STOP = false; public static final boolean DOASSERT = false; // static String errPropsName = "sql-error-messages"; static int bundleHandle = BundleHandler.getBundleHandle(errPropsName, null); // public static final int // DATABASE_ALREADY_IN_USE = 1, CONNECTION_IS_CLOSED = 2, CONNECTION_IS_BROKEN = 3, DATABASE_IS_SHUTDOWN = 4, COLUMN_COUNT_DOES_NOT_MATCH = 5, DIVISION_BY_ZERO = 6, INVALID_ESCAPE = 7, INTEGRITY_CONSTRAINT_VIOLATION = 8, VIOLATION_OF_UNIQUE_INDEX = 9, TRY_TO_INSERT_NULL = 10, UNEXPECTED_TOKEN = 11, UNEXPECTED_END_OF_COMMAND = 12, UNKNOWN_FUNCTION = 13, NEED_AGGREGATE = 14, SUM_OF_NON_NUMERIC = 15, WRONG_DATA_TYPE = 16, CARDINALITY_VIOLATION_NO_SUBCLASS = 17, SERIALIZATION_FAILURE = 18, TRANSFER_CORRUPTED = 19, FUNCTION_NOT_SUPPORTED = 20, TABLE_ALREADY_EXISTS = 21, TABLE_NOT_FOUND = 22, INDEX_ALREADY_EXISTS = 23, SECOND_PRIMARY_KEY = 24, DROP_PRIMARY_KEY = 25, INDEX_NOT_FOUND = 26, COLUMN_ALREADY_EXISTS = 27, COLUMN_NOT_FOUND = 28, FILE_IO_ERROR = 29, WRONG_DATABASE_FILE_VERSION = 30, DATABASE_IS_READONLY = 31, DATA_IS_READONLY = 32, ACCESS_IS_DENIED = 33, INPUTSTREAM_ERROR = 34, NO_DATA_IS_AVAILABLE = 35, USER_ALREADY_EXISTS = 36, USER_NOT_FOUND = 37, ASSERT_FAILED = 38, EXTERNAL_STOP = 39, GENERAL_ERROR = 40, WRONG_OUT_PARAMETER = 41, FUNCTION_NOT_FOUND = 42, TRIGGER_NOT_FOUND = 43, SAVEPOINT_NOT_FOUND = 44, LABEL_REQUIRED = 45, WRONG_DEFAULT_CLAUSE = 46, FOREIGN_KEY_NOT_ALLOWED = 47, UNKNOWN_DATA_SOURCE = 48, BAD_INDEX_CONSTRAINT_NAME = 49, DROP_FK_INDEX = 50, RESULTSET_FORWARD_ONLY = 51, VIEW_ALREADY_EXISTS = 52, VIEW_NOT_FOUND = 53, NOT_USED_54 = 54, NOT_A_TABLE = 55, SYSTEM_INDEX = 56, COLUMN_TYPE_MISMATCH = 57, BAD_ADD_COLUMN_DEFINITION = 58, DROP_SYSTEM_CONSTRAINT = 59, CONSTRAINT_ALREADY_EXISTS = 60, CONSTRAINT_NOT_FOUND = 61, INVALID_JDBC_ARGUMENT = 62, DATABASE_IS_MEMORY_ONLY = 63, OUTER_JOIN_CONDITION = 64, NUMERIC_VALUE_OUT_OF_RANGE = 65, MISSING_SOFTWARE_MODULE = 66, NOT_IN_AGGREGATE_OR_GROUP_BY = 67, INVALID_GROUP_BY = 68, INVALID_HAVING = 69, INVALID_ORDER_BY = 70, INVALID_ORDER_BY_IN_DISTINCT_SELECT = 71, OUT_OF_MEMORY = 72, OPERATION_NOT_SUPPORTED = 73, INVALID_IDENTIFIER = 74, TEXT_TABLE_SOURCE = 75, TEXT_FILE = 76, NOT_USED_77 = 77, ERROR_IN_SCRIPT_FILE = 78, NULL_IN_VALUE_LIST = 79, SOCKET_ERROR = 80, INVALID_CHARACTER_ENCODING = 81, NOT_USED_82 = 82, NOT_USED_83 = 83, NOT_USED_84 = 84, UNEXPECTED_EXCEPTION = 85, NOT_USED_86 = 86, NOT_USED_87 = 87, NOT_USED_88 = 88, NOT_USED_89 = 89, NOT_USED_90 = 90, NOT_USED_91 = 91, NOT_USED_92 = 92, NOT_USED_93 = 93, DATABASE_NOT_EXISTS = 94, INVALID_CONVERSION = 95, ERROR_IN_BINARY_SCRIPT_1 = 96, ERROR_IN_BINARY_SCRIPT_2 = 97, GENERAL_IO_ERROR = 98, EXPRESSION_NOT_SUPPORTED = 99, Constraint_violation = 100, Database_dropTable = 101, ERROR_IN_CONSTRAINT_COLUMN_LIST = 102, TABLE_HAS_NO_PRIMARY_KEY = 103, VIOLATION_OF_UNIQUE_CONSTRAINT = 104, NO_DEFAULT_VALUE_FOR_COLUMN = 105, NOT_A_CONDITION = 106, DatabaseManager_getDatabase = 107, NOT_USED_108 = 108, NOT_USED_109 = 109, NOT_USED_110 = 110, NOT_USED_111 = 111, NOT_USED_112 = 112, DatabaseScriptReader_readDDL = 113, DatabaseScriptReader_readExistingData = 114, Message_Pair = 115, LOAD_SAVE_PROPERTIES = 116, INVALID_TRANSACTION_STATE_NO_SUBCLASS = 117, JDBC_INVALID_BRI_SCOPE = 118, JDBC_NO_RESULT_SET_METADATA = 119, JDBC_NO_RESULT_SET = 120, MISSING_CLOSEBRACKET = 121, ITSNS_OVERWRITE = 122, COLUMN_IS_IN_INDEX = 123, STRING_DATA_TRUNCATION = 124, QUOTED_IDENTIFIER_REQUIRED = 125, STATEMENT_IS_CLOSED = 126, NOT_USED_127 = 127, NOT_USED_128 = 128, DATA_FILE_ERROR = 129, NOT_USED_130 = 130, HsqlDateTime_null_string = 131, NOT_USED_132 = 132, HsqlDateTime_null_date = 133, NOT_USED_134 = 134, HsqlProperties_load = 135, HsqlSocketFactorySecure_verify = 136, HsqlSocketFactorySecure_verify2 = 137, jdbcConnection_nativeSQL = 138, HsqlSocketFactorySecure_verify3 = 139, NOT_USED_140 = 140, NOT_USED_141 = 141, jdbcStatement_executeUpdate = 142, LockFile_checkHeartbeat = 143, LockFile_checkHeartbeat2 = 144, TEXT_STRING_HAS_NEWLINE = 145, Result_Result = 146, SERVER_NO_DATABASE = 147, Server_openServerSocket = 148, Server_openServerSocket2 = 149, TEXT_TABLE_HEADER = 150, NOT_USED_151 = 151, JDBC_PARAMETER_NOT_SET = 152, INVALID_LIMIT = 153, JDBC_STATEMENT_NOT_ROW_COUNT = 154, JDBC_STATEMENT_NOT_RESULTSET = 155, AMBIGUOUS_COLUMN_REFERENCE = 156, CHECK_CONSTRAINT_VIOLATION = 157, JDBC_RESULTSET_IS_CLOSED = 158, SINGLE_COLUMN_EXPECTED = 159, TOKEN_REQUIRED = 160,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -