Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
7b35cb31
提交
7b35cb31
authored
9月 24, 2009
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Don't throw Error
上级
7d7fbc8d
显示空白字符变更
内嵌
并排
正在显示
22 个修改的文件
包含
57 行增加
和
56 行删除
+57
-56
BenchCThread.java
h2/src/test/org/h2/test/bench/BenchCThread.java
+1
-1
TaskProcess.java
h2/src/test/org/h2/test/db/TaskProcess.java
+1
-1
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+2
-2
TestLobObject.java
h2/src/test/org/h2/test/db/TestLobObject.java
+2
-1
TestOpenClose.java
h2/src/test/org/h2/test/db/TestOpenClose.java
+3
-3
TestScript.java
h2/src/test/org/h2/test/db/TestScript.java
+1
-1
TestSpeed.java
h2/src/test/org/h2/test/db/TestSpeed.java
+3
-3
TestTriggersConstraints.java
h2/src/test/org/h2/test/db/TestTriggersConstraints.java
+11
-11
TestZloty.java
h2/src/test/org/h2/test/jdbc/TestZloty.java
+3
-2
TestBtreeIndex.java
h2/src/test/org/h2/test/synth/TestBtreeIndex.java
+1
-1
TestMultiThreaded.java
h2/src/test/org/h2/test/synth/TestMultiThreaded.java
+2
-2
TestTimer.java
h2/src/test/org/h2/test/synth/TestTimer.java
+1
-1
Column.java
h2/src/test/org/h2/test/synth/sql/Column.java
+4
-4
Command.java
h2/src/test/org/h2/test/synth/sql/Command.java
+1
-1
DbConnection.java
h2/src/test/org/h2/test/synth/sql/DbConnection.java
+1
-1
Expression.java
h2/src/test/org/h2/test/synth/sql/Expression.java
+1
-1
Result.java
h2/src/test/org/h2/test/synth/sql/Result.java
+2
-2
TestSynth.java
h2/src/test/org/h2/test/synth/sql/TestSynth.java
+2
-2
Value.java
h2/src/test/org/h2/test/synth/sql/Value.java
+5
-5
TestMultiNewsSimple.java
...rc/test/org/h2/test/synth/thread/TestMultiNewsSimple.java
+3
-4
Parser.java
h2/src/test/org/h2/test/trace/Parser.java
+5
-5
Player.java
h2/src/test/org/h2/test/trace/Player.java
+2
-2
没有找到文件。
h2/src/test/org/h2/test/bench/BenchCThread.java
浏览文件 @
7b35cb31
...
...
@@ -75,7 +75,7 @@ public class BenchCThread {
processStockLevel
();
break
;
default
:
throw
new
Error
(
"op="
+
op
);
throw
new
Assertion
Error
(
"op="
+
op
);
}
}
}
...
...
h2/src/test/org/h2/test/db/TaskProcess.java
浏览文件 @
7b35cb31
...
...
@@ -91,7 +91,7 @@ public class TaskProcess {
}
}
}
catch
(
Exception
e
)
{
throw
new
Error
(
"Error: "
+
e
,
e
);
throw
new
RuntimeException
(
e
);
}
}
}
.
start
();
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
7b35cb31
...
...
@@ -536,12 +536,12 @@ public class TestFunctions extends TestBase implements AggregateFunction {
rs
.
addColumn
(
"NAME"
,
Types
.
VARCHAR
,
255
,
0
);
if
(
count
==
null
)
{
if
(
ip
!=
0
||
bp
||
fp
!=
0.0
||
dp
!=
0.0
||
sp
!=
0
||
lp
!=
0
||
byParam
!=
0
)
{
throw
new
Error
(
"params not 0/false"
);
throw
new
Assertion
Error
(
"params not 0/false"
);
}
}
if
(
count
!=
null
)
{
if
(
ip
!=
1
||
!
bp
||
fp
!=
1.0
||
dp
!=
1.0
||
sp
!=
1
||
lp
!=
1
||
byParam
!=
1
)
{
throw
new
Error
(
"params not 1/true"
);
throw
new
Assertion
Error
(
"params not 1/true"
);
}
if
(
count
.
intValue
()
>=
1
)
{
rs
.
addRow
(
0
,
"Hello"
);
...
...
h2/src/test/org/h2/test/db/TestLobObject.java
浏览文件 @
7b35cb31
...
...
@@ -12,7 +12,8 @@ import java.io.Serializable;
* A utility class for TestLob.
*/
class
TestLobObject
implements
Serializable
{
private
static
final
long
serialVersionUID
=
904356179316518715L
;
private
static
final
long
serialVersionUID
=
1L
;
String
data
;
TestLobObject
(
String
data
)
{
...
...
h2/src/test/org/h2/test/db/TestOpenClose.java
浏览文件 @
7b35cb31
...
...
@@ -178,7 +178,7 @@ public class TestOpenClose extends TestBase implements DatabaseEventListener {
}
public
void
exceptionThrown
(
SQLException
e
,
String
sql
)
{
throw
new
Error
(
"unexpected: "
+
e
+
" sql: "
+
sql
);
throw
new
Assertion
Error
(
"unexpected: "
+
e
+
" sql: "
+
sql
);
}
public
void
setProgress
(
int
state
,
String
name
,
int
current
,
int
max
)
{
...
...
@@ -187,13 +187,13 @@ public class TestOpenClose extends TestBase implements DatabaseEventListener {
case
STATE_SCAN_FILE:
stateName
=
"Scan "
+
name
+
" "
+
current
+
"/"
+
max
;
if
(
current
>
0
)
{
throw
new
Error
(
"unexpected: "
+
stateName
);
throw
new
Assertion
Error
(
"unexpected: "
+
stateName
);
}
break
;
case
STATE_CREATE_INDEX:
stateName
=
"Create Index "
+
name
+
" "
+
current
+
"/"
+
max
;
if
(!
"SYS:SYS_ID"
.
equals
(
name
))
{
throw
new
Error
(
"unexpected: "
+
stateName
);
throw
new
Assertion
Error
(
"unexpected: "
+
stateName
);
}
break
;
case
STATE_RECOVER:
...
...
h2/src/test/org/h2/test/db/TestScript.java
浏览文件 @
7b35cb31
...
...
@@ -178,7 +178,7 @@ public class TestScript extends TestBase {
String
param
=
readLine
();
write
(
param
);
if
(!
param
.
equals
(
"{"
))
{
throw
new
Error
(
"expected '{', got "
+
param
+
" in "
+
sql
);
throw
new
Assertion
Error
(
"expected '{', got "
+
param
+
" in "
+
sql
);
}
try
{
PreparedStatement
prep
=
conn
.
prepareStatement
(
sql
);
...
...
h2/src/test/org/h2/test/db/TestSpeed.java
浏览文件 @
7b35cb31
...
...
@@ -139,17 +139,17 @@ public class TestSpeed extends TestBase {
// ResultSet rs = stat.executeQuery("SELECT * FROM TEST WHERE
// ID="+i);
// if(!rs.next()) {
// throw new Error("hey! i="+i);
// throw new
Assertion
Error("hey! i="+i);
// }
// if(rs.next()) {
// throw new Error("hey! i="+i);
// throw new
Assertion
Error("hey! i="+i);
// }
}
// for(int i=0; i<max; i++) {
// stat.execute("DELETE FROM TEST WHERE ID="+i);
// ResultSet rs = stat.executeQuery("SELECT * FROM TEST WHERE ID="+i);
// if(rs.next()) {
// throw new Error("hey!");
// throw new
Assertion
Error("hey!");
// }
// }
...
...
h2/src/test/org/h2/test/db/TestTriggersConstraints.java
浏览文件 @
7b35cb31
...
...
@@ -164,23 +164,23 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
public
void
fire
(
Connection
conn
,
Object
[]
oldRow
,
Object
[]
newRow
)
{
if
(
mustNotCallTrigger
)
{
throw
new
Error
(
"must not be called now"
);
throw
new
Assertion
Error
(
"must not be called now"
);
}
if
(
conn
==
null
)
{
throw
new
Error
(
"connection is null"
);
throw
new
Assertion
Error
(
"connection is null"
);
}
if
(
triggerName
.
startsWith
(
"INS_BEFORE"
))
{
newRow
[
1
]
=
newRow
[
1
]
+
"-updated"
;
}
else
if
(
triggerName
.
startsWith
(
"INS_AFTER"
))
{
if
(!
newRow
[
1
].
toString
().
endsWith
(
"-updated"
))
{
throw
new
Error
(
"supposed to be updated"
);
throw
new
Assertion
Error
(
"supposed to be updated"
);
}
checkCommit
(
conn
);
}
else
if
(
triggerName
.
startsWith
(
"UPD_BEFORE"
))
{
newRow
[
1
]
=
newRow
[
1
]
+
"-updated2"
;
}
else
if
(
triggerName
.
startsWith
(
"UPD_AFTER"
))
{
if
(!
newRow
[
1
].
toString
().
endsWith
(
"-updated2"
))
{
throw
new
Error
(
"supposed to be updated2"
);
throw
new
Assertion
Error
(
"supposed to be updated2"
);
}
checkCommit
(
conn
);
}
...
...
@@ -189,22 +189,22 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
private
void
checkCommit
(
Connection
conn
)
{
try
{
conn
.
commit
();
throw
new
Error
(
"Commit must not work here"
);
throw
new
Assertion
Error
(
"Commit must not work here"
);
}
catch
(
SQLException
e
)
{
try
{
assertKnownException
(
e
);
}
catch
(
Exception
e2
)
{
throw
new
Error
(
"Unexpected: "
+
e
.
toString
());
throw
new
Assertion
Error
(
"Unexpected: "
+
e
.
toString
());
}
}
try
{
conn
.
createStatement
().
execute
(
"CREATE TABLE X(ID INT)"
);
throw
new
Error
(
"CREATE TABLE WORKED, but implicitly commits"
);
throw
new
Assertion
Error
(
"CREATE TABLE WORKED, but implicitly commits"
);
}
catch
(
SQLException
e
)
{
try
{
assertKnownException
(
e
);
}
catch
(
Exception
e2
)
{
throw
new
Error
(
"Unexpected: "
+
e
.
toString
());
throw
new
Assertion
Error
(
"Unexpected: "
+
e
.
toString
());
}
}
}
...
...
@@ -212,13 +212,13 @@ public class TestTriggersConstraints extends TestBase implements Trigger {
public
void
init
(
Connection
conn
,
String
schemaName
,
String
triggerName
,
String
tableName
,
boolean
before
,
int
type
)
{
this
.
triggerName
=
triggerName
;
if
(!
"TEST"
.
equals
(
tableName
))
{
throw
new
Error
(
"supposed to be TEST"
);
throw
new
Assertion
Error
(
"supposed to be TEST"
);
}
if
((
triggerName
.
endsWith
(
"AFTER"
)
&&
before
)
||
(
triggerName
.
endsWith
(
"BEFORE"
)
&&
!
before
))
{
throw
new
Error
(
"triggerName: "
+
triggerName
+
" before:"
+
before
);
throw
new
Assertion
Error
(
"triggerName: "
+
triggerName
+
" before:"
+
before
);
}
if
((
triggerName
.
startsWith
(
"UPD"
)
&&
type
!=
UPDATE
)
||
(
triggerName
.
startsWith
(
"INS"
)
&&
type
!=
INSERT
)
||
(
triggerName
.
startsWith
(
"DEL"
)
&&
type
!=
DELETE
))
{
throw
new
Error
(
"triggerName: "
+
triggerName
+
" type:"
+
type
);
throw
new
Assertion
Error
(
"triggerName: "
+
triggerName
+
" type:"
+
type
);
}
}
...
...
h2/src/test/org/h2/test/jdbc/TestZloty.java
浏览文件 @
7b35cb31
...
...
@@ -40,7 +40,7 @@ public class TestZloty extends TestBase {
*/
private
static
class
ZlotyBigDecimal
extends
BigDecimal
{
private
static
final
long
serialVersionUID
=
-
8004563653683501484
L
;
private
static
final
long
serialVersionUID
=
1
L
;
public
ZlotyBigDecimal
(
String
s
)
{
super
(
s
);
...
...
@@ -103,7 +103,8 @@ public class TestZloty extends TestBase {
prep
.
setInt
(
1
,
3
);
try
{
BigDecimal
value
=
new
BigDecimal
(
"12.100000"
)
{
private
static
final
long
serialVersionUID
=
-
7909023971521750844L
;
private
static
final
long
serialVersionUID
=
1L
;
public
String
toString
()
{
return
"12,100000 EURO"
;
...
...
h2/src/test/org/h2/test/synth/TestBtreeIndex.java
浏览文件 @
7b35cb31
...
...
@@ -160,7 +160,7 @@ public class TestBtreeIndex extends TestBase {
//while(rs2.next()) {
// System.out.println(rs2.getString(1));
//}
//if (true) throw new Error("stop");
//if (true) throw new
Assertion
Error("stop");
//
testCount
=
0
;
while
(
rs
.
next
()
&&
rs2
.
next
())
{
...
...
h2/src/test/org/h2/test/synth/TestMultiThreaded.java
浏览文件 @
7b35cb31
...
...
@@ -67,7 +67,7 @@ public class TestMultiThreaded extends TestBase {
"DELETE FROM TEST WHERE NAME = '"
+
id
+
"' AND ROWNUM()<2"
);
traceThread
(
"delete done"
);
if
(
updateCount
!=
1
)
{
throw
new
Error
(
"Expected: 1 Deleted: "
+
updateCount
);
throw
new
Assertion
Error
(
"Expected: 1 Deleted: "
+
updateCount
);
}
count
--;
}
...
...
@@ -80,7 +80,7 @@ public class TestMultiThreaded extends TestBase {
rs
.
next
();
int
got
=
rs
.
getInt
(
1
);
if
(
got
!=
count
)
{
throw
new
Error
(
"Expected: "
+
count
+
" got: "
+
got
);
throw
new
Assertion
Error
(
"Expected: "
+
count
+
" got: "
+
got
);
}
break
;
case
3
:
...
...
h2/src/test/org/h2/test/synth/TestTimer.java
浏览文件 @
7b35cb31
...
...
@@ -110,7 +110,7 @@ public class TestTimer extends TestBase {
}
if
(
real
!=
count
)
{
println
(
"real count: "
+
real
);
throw
new
Error
(
"COUNT(*)="
+
count
+
" SELECT="
+
real
);
throw
new
Assertion
Error
(
"COUNT(*)="
+
count
+
" SELECT="
+
real
);
}
rs
=
stat
.
executeQuery
(
"SCRIPT"
);
while
(
rs
.
next
())
{
...
...
h2/src/test/org/h2/test/synth/sql/Column.java
浏览文件 @
7b35cb31
...
...
@@ -64,7 +64,7 @@ class Column {
case
DataType
.
TYPE_BOOLEAN
:
break
;
default
:
throw
new
Error
(
"type="
+
type
);
throw
new
Assertion
Error
(
"type="
+
type
);
}
}
...
...
@@ -103,10 +103,10 @@ class Column {
case
Types
.
LONGVARBINARY
:
return
false
;
default
:
throw
new
Error
(
"type="
+
type
);
throw
new
Assertion
Error
(
"type="
+
type
);
}
default
:
throw
new
Error
(
"type="
+
type
);
throw
new
Assertion
Error
(
"type="
+
type
);
}
}
...
...
@@ -155,7 +155,7 @@ class Column {
case
Types
.
BIT
:
return
"BOOLEAN"
;
default
:
throw
new
Error
(
"type="
+
type
);
throw
new
Assertion
Error
(
"type="
+
type
);
}
}
...
...
h2/src/test/org/h2/test/synth/sql/Command.java
浏览文件 @
7b35cb31
...
...
@@ -374,7 +374,7 @@ class Command {
result
=
new
Result
(
"rollback"
);
break
;
default
:
throw
new
Error
(
"internal"
);
throw
new
AssertionError
(
"type="
+
type
);
}
}
catch
(
SQLException
e
)
{
result
=
new
Result
(
""
,
e
);
...
...
h2/src/test/org/h2/test/synth/sql/DbConnection.java
浏览文件 @
7b35cb31
...
...
@@ -67,7 +67,7 @@ class DbConnection implements DbInterface {
}
// could not drop any table and still tables to drop
if
(
dropped
==
0
&&
tables
.
size
()
>
0
)
{
throw
new
Error
(
"Cannot drop "
+
tables
);
throw
new
Assertion
Error
(
"Cannot drop "
+
tables
);
}
}
}
...
...
h2/src/test/org/h2/test/synth/sql/Expression.java
浏览文件 @
7b35cb31
...
...
@@ -372,7 +372,7 @@ public class Expression {
}
public
String
toString
()
{
throw
new
Error
(
"hey!"
);
throw
new
AssertionError
(
);
}
}
h2/src/test/org/h2/test/synth/sql/Result.java
浏览文件 @
7b35cb31
...
...
@@ -103,7 +103,7 @@ class Result implements Comparable<Result> {
}
return
result
+
"}"
;
default
:
throw
new
Error
(
"internal"
);
throw
new
AssertionError
(
"type="
+
type
);
}
}
...
...
@@ -122,7 +122,7 @@ class Result implements Comparable<Result> {
case
RESULT_SET:
return
toString
().
compareTo
(
r
.
toString
());
default
:
throw
new
Error
(
"internal"
);
throw
new
AssertionError
(
"type="
+
type
);
}
}
...
...
h2/src/test/org/h2/test/synth/sql/TestSynth.java
浏览文件 @
7b35cb31
...
...
@@ -235,9 +235,9 @@ public class TestSynth extends TestBase {
Result
copy
=
results
.
get
(
i
);
if
(
original
.
compareTo
(
copy
)
!=
0
)
{
if
(
showError
)
{
throw
new
Error
(
"Results don't match: original (0): \r\n"
+
original
+
"\r\n"
+
"other:\r\n"
+
copy
);
throw
new
Assertion
Error
(
"Results don't match: original (0): \r\n"
+
original
+
"\r\n"
+
"other:\r\n"
+
copy
);
}
throw
new
Error
(
"Results don't match"
);
throw
new
Assertion
Error
(
"Results don't match"
);
}
}
}
...
...
h2/src/test/org/h2/test/synth/sql/Value.java
浏览文件 @
7b35cb31
...
...
@@ -69,7 +69,7 @@ public class Value {
case
Types
.
BIT
:
return
(
String
)
data
;
default
:
throw
new
Error
(
"type="
+
type
);
throw
new
Assertion
Error
(
"type="
+
type
);
}
}
...
...
@@ -189,7 +189,7 @@ public class Value {
data
=
rs
.
getBoolean
(
index
)
?
"TRUE"
:
"FALSE"
;
break
;
default
:
throw
new
Error
(
"type="
+
type
);
throw
new
Assertion
Error
(
"type="
+
type
);
}
if
(
rs
.
wasNull
())
{
data
=
null
;
...
...
@@ -248,7 +248,7 @@ public class Value {
data
=
config
.
random
().
getBoolean
(
50
)
?
"TRUE"
:
"FALSE"
;
break
;
default
:
throw
new
Error
(
"type="
+
type
);
throw
new
Assertion
Error
(
"type="
+
type
);
}
return
new
Value
(
config
,
type
,
data
);
}
...
...
@@ -289,7 +289,7 @@ public class Value {
// private int compareTo(Object o) {
// Value v = (Value) o;
// if (type != v.type) {
// throw new Error("compare " + type +
// throw new
Assertion
Error("compare " + type +
// " " + v.type + " " + data + " " + v.data);
// }
// if (data == null) {
...
...
@@ -312,7 +312,7 @@ public class Value {
// case Types.INTEGER:
// return ((Integer) data).compareTo((Integer) v.data);
// default:
// throw new Error("type=" + type);
// throw new
Assertion
Error("type=" + type);
// }
// }
...
...
h2/src/test/org/h2/test/synth/thread/TestMultiNewsSimple.java
浏览文件 @
7b35cb31
...
...
@@ -70,19 +70,18 @@ public class TestMultiNewsSimple extends TestMultiThread {
ResultSet
rs
=
prep
.
executeQuery
();
if
(!
rs
.
next
())
{
System
.
out
.
println
(
"No row found"
);
// throw new Error("No row found");
// throw new
Assertion
Error("No row found");
}
if
(
rs
.
next
())
{
System
.
out
.
println
(
"Multiple rows found"
);
// throw new Error("Multiple rows found");
// throw new
Assertion
Error("Multiple rows found");
}
}
}
}
void
finalTest
()
{
// TODO Auto-generated method stub
// nothing to do
}
}
h2/src/test/org/h2/test/trace/Parser.java
浏览文件 @
7b35cb31
...
...
@@ -171,7 +171,7 @@ class Parser {
private
void
read
(
String
s
)
{
if
(!
readIf
(
s
))
{
throw
new
Error
(
"Expected: "
+
s
+
" got: "
+
token
+
" in "
throw
new
RuntimeException
(
"Expected: "
+
s
+
" got: "
+
token
+
" in "
+
line
);
}
}
...
...
@@ -182,7 +182,7 @@ class Parser {
try
{
s
=
StringUtils
.
javaDecode
(
s
.
substring
(
1
,
s
.
length
()
-
1
));
}
catch
(
SQLException
e
)
{
throw
new
Error
(
e
);
throw
new
RuntimeException
(
e
);
}
return
new
Arg
(
String
.
class
,
s
);
}
else
if
(
tokenType
==
NUMBER
)
{
...
...
@@ -206,7 +206,7 @@ class Parser {
}
else
if
(
readIf
(
"false"
))
{
return
new
Arg
(
boolean
.
class
,
Boolean
.
FALSE
);
}
else
if
(
readIf
(
"null"
))
{
throw
new
Error
(
throw
new
RuntimeException
(
"Null: class not specified. Example: (java.lang.String)null"
);
}
else
if
(
readIf
(
"new"
))
{
if
(
readIf
(
"String"
))
{
...
...
@@ -227,7 +227,7 @@ class Parser {
read
(
")"
);
return
new
Arg
(
BigDecimal
.
class
,
value
);
}
else
{
throw
new
Error
(
"Unsupported constructor: "
+
readToken
());
throw
new
RuntimeException
(
"Unsupported constructor: "
+
readToken
());
}
}
String
name
=
readToken
();
...
...
@@ -248,7 +248,7 @@ class Parser {
String
number
=
readToken
();
return
new
Arg
(
short
.
class
,
new
Short
(
Short
.
parseShort
(
number
)));
}
else
{
throw
new
Error
(
"Value expected, got: "
+
readToken
()
+
" in "
throw
new
RuntimeException
(
"Value expected, got: "
+
readToken
()
+
" in "
+
line
);
}
}
...
...
h2/src/test/org/h2/test/trace/Player.java
浏览文件 @
7b35cb31
...
...
@@ -87,7 +87,7 @@ public class Player {
if
(
"-trace"
.
equals
(
args
[
i
]))
{
trace
=
true
;
}
else
{
throw
new
Error
(
"Unknown setting: "
+
args
[
i
]);
throw
new
RuntimeException
(
"Unknown setting: "
+
args
[
i
]);
}
}
}
catch
(
Exception
e
)
{
...
...
@@ -153,7 +153,7 @@ public class Player {
// ignore
}
}
throw
new
Error
(
"Class not found: "
+
className
);
throw
new
RuntimeException
(
"Class not found: "
+
className
);
}
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论