Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
8813bbf4
提交
8813bbf4
authored
6 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Replace references to JdbcSQLException with SQLException or JdbcException
上级
6716fb8b
master
version-1.4.198
无相关合并请求
显示空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
34 行增加
和
39 行删除
+34
-39
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+2
-3
DbException.java
h2/src/main/org/h2/message/DbException.java
+2
-2
TraceSystem.java
h2/src/main/org/h2/message/TraceSystem.java
+3
-3
TcpServerThread.java
h2/src/main/org/h2/server/TcpServerThread.java
+3
-3
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+2
-3
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+2
-3
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+2
-3
TestGeneralCommonTableQueries.java
...rc/test/org/h2/test/db/TestGeneralCommonTableQueries.java
+2
-2
TestMergeUsing.java
h2/src/test/org/h2/test/db/TestMergeUsing.java
+1
-1
TestMultiThread.java
h2/src/test/org/h2/test/db/TestMultiThread.java
+2
-4
TestSetCollation.java
h2/src/test/org/h2/test/db/TestSetCollation.java
+1
-3
TestSynonymForTable.java
h2/src/test/org/h2/test/db/TestSynonymForTable.java
+12
-9
没有找到文件。
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
8813bbf4
...
...
@@ -16,7 +16,7 @@ import org.h2.api.JavaObjectSerializer;
import
org.h2.command.CommandInterface
;
import
org.h2.command.CommandRemote
;
import
org.h2.command.dml.SetTypes
;
import
org.h2.jdbc.Jdbc
SQL
Exception
;
import
org.h2.jdbc.JdbcException
;
import
org.h2.message.DbException
;
import
org.h2.message.Trace
;
import
org.h2.message.TraceSystem
;
...
...
@@ -338,8 +338,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
DbException
e
=
DbException
.
convert
(
re
);
if
(
e
.
getErrorCode
()
==
ErrorCode
.
DATABASE_ALREADY_OPEN_1
)
{
if
(
autoServerMode
)
{
String
serverKey
=
((
JdbcSQLException
)
e
.
getSQLException
()).
getSQL
();
String
serverKey
=
((
JdbcException
)
e
.
getSQLException
()).
getSQL
();
if
(
serverKey
!=
null
)
{
backup
.
setServerKey
(
serverKey
);
// OPEN_NEW must be removed now, otherwise
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/message/DbException.java
浏览文件 @
8813bbf4
...
...
@@ -135,8 +135,8 @@ public class DbException extends RuntimeException {
*/
public
DbException
addSQL
(
String
sql
)
{
SQLException
e
=
getSQLException
();
if
(
e
instanceof
Jdbc
SQL
Exception
)
{
Jdbc
SQLException
j
=
(
JdbcSQL
Exception
)
e
;
if
(
e
instanceof
JdbcException
)
{
Jdbc
Exception
j
=
(
Jdbc
Exception
)
e
;
if
(
j
.
getSQL
()
==
null
)
{
j
.
setSQL
(
filterSQL
(
sql
));
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/message/TraceSystem.java
浏览文件 @
8813bbf4
...
...
@@ -13,7 +13,7 @@ import java.text.SimpleDateFormat;
import
java.util.concurrent.atomic.AtomicReferenceArray
;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.jdbc.Jdbc
SQL
Exception
;
import
org.h2.jdbc.JdbcException
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.util.IOUtils
;
...
...
@@ -260,8 +260,8 @@ public class TraceSystem implements TraceWriter {
}
printWriter
.
println
(
s
);
if
(
t
!=
null
)
{
if
(
levelFile
==
ERROR
&&
t
instanceof
Jdbc
SQL
Exception
)
{
Jdbc
SQLException
se
=
(
JdbcSQL
Exception
)
t
;
if
(
levelFile
==
ERROR
&&
t
instanceof
JdbcException
)
{
Jdbc
Exception
se
=
(
Jdbc
Exception
)
t
;
int
code
=
se
.
getErrorCode
();
if
(
ErrorCode
.
isCommon
(
code
))
{
printWriter
.
println
(
t
.
toString
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/TcpServerThread.java
浏览文件 @
8813bbf4
...
...
@@ -28,7 +28,7 @@ import org.h2.engine.SysProperties;
import
org.h2.expression.Parameter
;
import
org.h2.expression.ParameterInterface
;
import
org.h2.expression.ParameterRemote
;
import
org.h2.jdbc.Jdbc
SQL
Exception
;
import
org.h2.jdbc.JdbcException
;
import
org.h2.message.DbException
;
import
org.h2.result.ResultColumn
;
import
org.h2.result.ResultInterface
;
...
...
@@ -235,8 +235,8 @@ public class TcpServerThread implements Runnable {
String
trace
=
writer
.
toString
();
String
message
;
String
sql
;
if
(
e
instanceof
Jdbc
SQL
Exception
)
{
Jdbc
SQLException
j
=
(
JdbcSQL
Exception
)
e
;
if
(
e
instanceof
JdbcException
)
{
Jdbc
Exception
j
=
(
Jdbc
Exception
)
e
;
message
=
j
.
getOriginalMessage
();
sql
=
j
.
getSQL
();
}
else
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
8813bbf4
...
...
@@ -42,7 +42,7 @@ import org.h2.bnf.context.DbSchema;
import
org.h2.bnf.context.DbTableOrView
;
import
org.h2.engine.Constants
;
import
org.h2.engine.SysProperties
;
import
org.h2.jdbc.Jdbc
SQL
Exception
;
import
org.h2.jdbc.JdbcException
;
import
org.h2.message.DbException
;
import
org.h2.security.SHA256
;
import
org.h2.tools.Backup
;
...
...
@@ -935,8 +935,7 @@ public class WebApp {
* @return the formatted error message
*/
private
String
getLoginError
(
Exception
e
,
boolean
isH2
)
{
if
(
e
instanceof
JdbcSQLException
&&
((
JdbcSQLException
)
e
).
getErrorCode
()
==
ErrorCode
.
CLASS_NOT_FOUND_1
)
{
if
(
e
instanceof
JdbcException
&&
((
JdbcException
)
e
).
getErrorCode
()
==
ErrorCode
.
CLASS_NOT_FOUND_1
)
{
return
"${text.login.driverNotFound}<br />"
+
getStackTrace
(
0
,
e
,
isH2
);
}
return
getStackTrace
(
0
,
e
,
isH2
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
8813bbf4
...
...
@@ -15,7 +15,6 @@ import java.sql.ResultSetMetaData;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.api.ErrorCode
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestDb
;
...
...
@@ -278,7 +277,7 @@ public class TestCompatibility extends TestDb {
try
{
stat
.
execute
(
"CREATE TABLE TEST(COL "
+
type
+
")"
);
fail
(
"Expect type "
+
type
+
" to not exist in PostgreSQL mode"
);
}
catch
(
org
.
h2
.
jdbc
.
Jdbc
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
/* Expected! */
}
}
...
...
@@ -675,7 +674,7 @@ public class TestCompatibility extends TestDb {
try
{
getConnection
(
"compatibility;MODE=Unknown"
).
close
();
deleteDb
(
"compatibility"
);
}
catch
(
Jdbc
SQLException
ex
)
{
}
catch
(
SQLException
ex
)
{
assertEquals
(
ErrorCode
.
UNKNOWN_MODE_1
,
ex
.
getErrorCode
());
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
8813bbf4
...
...
@@ -46,7 +46,6 @@ import org.h2.api.Aggregate;
import
org.h2.api.AggregateFunction
;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.message.DbException
;
import
org.h2.store.fs.FileUtils
;
import
org.h2.test.TestBase
;
...
...
@@ -2023,12 +2022,12 @@ public class TestFunctions extends TestDb implements AggregateFunction {
conn
.
close
();
}
private
void
testAnnotationProcessorsOutput
()
throws
SQLException
{
private
void
testAnnotationProcessorsOutput
()
{
try
{
System
.
setProperty
(
TestAnnotationProcessor
.
MESSAGES_KEY
,
"WARNING,foo1|ERROR,foo2"
);
callCompiledFunction
(
"test_annotation_processor_warn_and_error"
);
fail
();
}
catch
(
Jdbc
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
assertEquals
(
ErrorCode
.
SYNTAX_ERROR_1
,
e
.
getErrorCode
());
assertContains
(
e
.
getMessage
(),
"foo1"
);
assertContains
(
e
.
getMessage
(),
"foo2"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestGeneralCommonTableQueries.java
浏览文件 @
8813bbf4
...
...
@@ -8,8 +8,8 @@ package org.h2.test.db;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.test.TestAll
;
import
org.h2.test.TestBase
;
...
...
@@ -235,7 +235,7 @@ public class TestGeneralCommonTableQueries extends AbstractBaseForCommonTableExp
rs
=
prep
.
executeQuery
();
fail
(
"Temp view T1 was accessible after previous WITH statement finished "
+
"- but should not have been."
);
}
catch
(
Jdbc
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
// ensure the T1 table has been removed even without auto commit
assertContains
(
e
.
getMessage
(),
"Table \"T1\" not found;"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestMergeUsing.java
浏览文件 @
8813bbf4
...
...
@@ -347,7 +347,7 @@ public class TestMergeUsing extends TestDb implements Trigger {
try
{
testMergeUsing
(
setupSQL
,
statementUnderTest
,
gatherResultsSQL
,
expectedResultsSQL
,
expectedRowUpdateCount
);
}
catch
(
RuntimeException
|
org
.
h2
.
jdbc
.
Jdbc
SQLException
e
)
{
}
catch
(
RuntimeException
|
SQLException
e
)
{
if
(!
e
.
getMessage
().
contains
(
exceptionMessage
))
{
e
.
printStackTrace
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestMultiThread.java
浏览文件 @
8813bbf4
...
...
@@ -22,7 +22,6 @@ import java.util.concurrent.Executors;
import
java.util.concurrent.Future
;
import
java.util.concurrent.TimeUnit
;
import
org.h2.api.ErrorCode
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.test.TestAll
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestDb
;
...
...
@@ -372,9 +371,8 @@ public class TestMultiThread extends TestDb implements Runnable {
// ignore timeout exceptions, happens periodically when the
// machine is really busy and it's not the thing we are
// trying to test
if
(!(
ex
.
getCause
()
instanceof
JdbcSQLException
)
||
((
JdbcSQLException
)
ex
.
getCause
())
.
getErrorCode
()
!=
ErrorCode
.
LOCK_TIMEOUT_1
)
{
if
(!(
ex
.
getCause
()
instanceof
SQLException
)
||
((
SQLException
)
ex
.
getCause
()).
getErrorCode
()
!=
ErrorCode
.
LOCK_TIMEOUT_1
)
{
throw
ex
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSetCollation.java
浏览文件 @
8813bbf4
...
...
@@ -5,7 +5,6 @@
*/
package
org
.
h2
.
test
.
db
;
import
java.sql.Connection
;
import
java.sql.PreparedStatement
;
import
java.sql.ResultSet
;
...
...
@@ -14,7 +13,6 @@ import java.sql.Statement;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestDb
;
...
...
@@ -124,7 +122,7 @@ public class TestSetCollation extends TestDb {
try
{
getConnection
(
DB_NAME
);
fail
();
}
catch
(
Jdbc
SQLException
e
)
{
}
catch
(
SQLException
e
)
{
// expected
}
finally
{
config
.
collation
=
null
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/db/TestSynonymForTable.java
浏览文件 @
8813bbf4
...
...
@@ -10,8 +10,8 @@ import java.sql.PreparedStatement;
import
java.sql.ResultSet
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
org.h2.api.ErrorCode
;
import
org.h2.engine.Constants
;
import
org.h2.jdbc.JdbcSQLException
;
import
org.h2.test.TestBase
;
import
org.h2.test.TestDb
;
...
...
@@ -71,7 +71,7 @@ public class TestSynonymForTable extends TestDb {
stat
.
execute
(
"CREATE OR REPLACE SYNONYM testsynonym FOR s1.backingtable"
);
stat
.
execute
(
"DROP SCHEMA s1 CASCADE"
);
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"SELECT id FROM testsynonym"
);
assertThrows
(
ErrorCode
.
TABLE_OR_VIEW_NOT_FOUND_1
,
stat
).
execute
(
"SELECT id FROM testsynonym"
);
conn
.
close
();
}
...
...
@@ -82,7 +82,7 @@ public class TestSynonymForTable extends TestDb {
stat
.
execute
(
"DROP TABLE backingtable"
);
// Backing table does not exist anymore.
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"SELECT id FROM testsynonym"
);
assertThrows
(
ErrorCode
.
TABLE_OR_VIEW_NOT_FOUND_1
,
stat
).
execute
(
"SELECT id FROM testsynonym"
);
// Synonym should be dropped as well
ResultSet
synonyms
=
conn
.
createStatement
().
executeQuery
(
...
...
@@ -92,7 +92,7 @@ public class TestSynonymForTable extends TestDb {
// Reopening should work with dropped synonym
Connection
conn2
=
getConnection
(
"synonym"
);
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"SELECT id FROM testsynonym"
);
assertThrows
(
ErrorCode
.
OBJECT_CLOSED
,
stat
).
execute
(
"SELECT id FROM testsynonym"
);
conn2
.
close
();
}
...
...
@@ -104,13 +104,13 @@ public class TestSynonymForTable extends TestDb {
stat
.
execute
(
"DROP SYNONYM testsynonym"
);
// Synonym does not exist anymore.
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"SELECT id FROM testsynonym"
);
assertThrows
(
ErrorCode
.
TABLE_OR_VIEW_NOT_FOUND_1
,
stat
).
execute
(
"SELECT id FROM testsynonym"
);
// Dropping with "if exists" should succeed even if the synonym does not exist anymore.
stat
.
execute
(
"DROP SYNONYM IF EXISTS testsynonym"
);
// Without "if exists" the command should fail if the synonym does not exist.
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"DROP SYNONYM testsynonym"
);
assertThrows
(
ErrorCode
.
TABLE_OR_VIEW_NOT_FOUND_1
,
stat
).
execute
(
"DROP SYNONYM testsynonym"
);
conn
.
close
();
}
...
...
@@ -132,7 +132,8 @@ public class TestSynonymForTable extends TestDb {
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE IF NOT EXISTS backingtable(id INT PRIMARY KEY)"
);
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"CREATE OR REPLACE SYNONYM backingtable FOR backingtable"
);
assertThrows
(
ErrorCode
.
TABLE_OR_VIEW_ALREADY_EXISTS_1
,
stat
)
.
execute
(
"CREATE OR REPLACE SYNONYM backingtable FOR backingtable"
);
conn
.
close
();
}
...
...
@@ -194,7 +195,8 @@ public class TestSynonymForTable extends TestDb {
Connection
conn
=
getConnection
(
"synonym"
);
Statement
stat
=
conn
.
createStatement
();
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"CREATE SYNONYM someSynonym FOR nonexistingTable"
);
assertThrows
(
ErrorCode
.
TABLE_OR_VIEW_NOT_FOUND_1
,
stat
)
.
execute
(
"CREATE SYNONYM someSynonym FOR nonexistingTable"
);
conn
.
close
();
}
...
...
@@ -203,7 +205,8 @@ public class TestSynonymForTable extends TestDb {
Statement
stat
=
conn
.
createStatement
();
stat
.
execute
(
"CREATE TABLE IF NOT EXISTS backingtable(id INT PRIMARY KEY)"
);
assertThrows
(
JdbcSQLException
.
class
,
stat
).
execute
(
"CREATE SYNONYM backingtable FOR backingtable"
);
assertThrows
(
ErrorCode
.
TABLE_OR_VIEW_ALREADY_EXISTS_1
,
stat
)
.
execute
(
"CREATE SYNONYM backingtable FOR backingtable"
);
conn
.
close
();
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论