Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
4945dcc0
提交
4945dcc0
authored
6月 12, 2014
作者:
noelgrandin@gmail.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
simplify "indexOf(x) >= 0" to "contains(x)"
上级
43919469
隐藏空白字符变更
内嵌
并排
正在显示
36 个修改的文件
包含
90 行增加
和
90 行删除
+90
-90
Session.java
h2/src/main/org/h2/engine/Session.java
+2
-2
Function.java
h2/src/main/org/h2/expression/Function.java
+2
-2
JdbcSQLException.java
h2/src/main/org/h2/jdbc/JdbcSQLException.java
+1
-1
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+4
-4
WebThread.java
h2/src/main/org/h2/server/web/WebThread.java
+1
-1
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+1
-1
MetaTable.java
h2/src/main/org/h2/table/MetaTable.java
+1
-1
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+1
-1
Server.java
h2/src/main/org/h2/tools/Server.java
+4
-4
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+1
-1
TestAll.java
h2/src/test/org/h2/test/TestAll.java
+1
-1
TestCompatibility.java
h2/src/test/org/h2/test/db/TestCompatibility.java
+2
-2
TestFunctions.java
h2/src/test/org/h2/test/db/TestFunctions.java
+2
-2
TestIndex.java
h2/src/test/org/h2/test/db/TestIndex.java
+1
-1
TestLinkedTable.java
h2/src/test/org/h2/test/db/TestLinkedTable.java
+1
-1
TestListener.java
h2/src/test/org/h2/test/db/TestListener.java
+2
-2
TestOptimizations.java
h2/src/test/org/h2/test/db/TestOptimizations.java
+2
-2
TestRights.java
h2/src/test/org/h2/test/db/TestRights.java
+2
-2
TestScript.java
h2/src/test/org/h2/test/db/TestScript.java
+2
-2
TestPreparedStatement.java
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
+2
-2
TestConnectionPool.java
h2/src/test/org/h2/test/jdbcx/TestConnectionPool.java
+1
-1
TestWeb.java
h2/src/test/org/h2/test/server/TestWeb.java
+4
-4
TestMVTableEngine.java
h2/src/test/org/h2/test/store/TestMVTableEngine.java
+2
-2
TestCrashAPI.java
h2/src/test/org/h2/test/synth/TestCrashAPI.java
+1
-1
TestNestedJoins.java
h2/src/test/org/h2/test/synth/TestNestedJoins.java
+3
-3
TestOuterJoins.java
h2/src/test/org/h2/test/synth/TestOuterJoins.java
+2
-2
Parser.java
h2/src/test/org/h2/test/trace/Parser.java
+2
-2
TestClearReferences.java
h2/src/test/org/h2/test/unit/TestClearReferences.java
+4
-4
TestJmx.java
h2/src/test/org/h2/test/unit/TestJmx.java
+7
-7
TestPgServer.java
h2/src/test/org/h2/test/unit/TestPgServer.java
+2
-2
TestRecovery.java
h2/src/test/org/h2/test/unit/TestRecovery.java
+2
-2
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+20
-20
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+1
-1
LinkChecker.java
h2/src/tools/org/h2/build/doc/LinkChecker.java
+1
-1
UploadBuild.java
h2/src/tools/org/h2/build/doc/UploadBuild.java
+2
-2
Indexer.java
h2/src/tools/org/h2/build/indexer/Indexer.java
+1
-1
没有找到文件。
h2/src/main/org/h2/engine/Session.java
浏览文件 @
4945dcc0
...
...
@@ -684,7 +684,7 @@ public class Session extends SessionWithState {
*/
public
void
addLock
(
Table
table
)
{
if
(
SysProperties
.
CHECK
)
{
if
(
locks
.
indexOf
(
table
)
>=
0
)
{
if
(
locks
.
contains
(
table
)
)
{
DbException
.
throwInternalError
();
}
}
...
...
@@ -1127,7 +1127,7 @@ public class Session extends SessionWithState {
String
identifier
;
do
{
identifier
=
SYSTEM_IDENTIFIER_PREFIX
+
systemIdentifier
++;
}
while
(
sql
.
indexOf
(
identifier
)
>=
0
);
}
while
(
sql
.
contains
(
identifier
)
);
return
identifier
;
}
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
4945dcc0
...
...
@@ -1960,14 +1960,14 @@ public class Function extends Expression implements FunctionCall {
}
StringBuilder
s
=
new
StringBuilder
();
s
.
append
(
d
);
if
(
s
.
toString
().
indexOf
(
"E"
)
>=
0
)
{
if
(
s
.
toString
().
indexOf
(
'E'
)
>=
0
)
{
return
d
;
}
int
len
=
s
.
length
();
if
(
len
<
16
)
{
return
d
;
}
if
(
s
.
toString
().
indexOf
(
"."
)
>
len
-
3
)
{
if
(
s
.
toString
().
indexOf
(
'.'
)
>
len
-
3
)
{
return
d
;
}
s
.
delete
(
len
-
2
,
len
);
...
...
h2/src/main/org/h2/jdbc/JdbcSQLException.java
浏览文件 @
4945dcc0
...
...
@@ -146,7 +146,7 @@ public class JdbcSQLException extends SQLException {
* INTERNAL
*/
public
void
setSQL
(
String
sql
)
{
if
(
sql
!=
null
&&
sql
.
indexOf
(
HIDE_SQL
)
>=
0
)
{
if
(
sql
!=
null
&&
sql
.
contains
(
HIDE_SQL
)
)
{
sql
=
"-"
;
}
this
.
sql
=
sql
;
...
...
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
4945dcc0
...
...
@@ -1267,10 +1267,10 @@ public class WebApp {
sql
=
sql
.
trim
();
StringBuilder
buff
=
new
StringBuilder
();
String
sqlUpper
=
StringUtils
.
toUpperEnglish
(
sql
);
if
(
sqlUpper
.
indexOf
(
"CREATE"
)
>=
0
||
sqlUpper
.
indexOf
(
"DROP"
)
>=
0
||
sqlUpper
.
indexOf
(
"ALTER"
)
>=
0
||
sqlUpper
.
indexOf
(
"RUNSCRIPT"
)
>=
0
)
{
if
(
sqlUpper
.
contains
(
"CREATE"
)
||
sqlUpper
.
contains
(
"DROP"
)
||
sqlUpper
.
contains
(
"ALTER"
)
||
sqlUpper
.
contains
(
"RUNSCRIPT"
)
)
{
String
sessionId
=
attributes
.
getProperty
(
"jsessionid"
);
buff
.
append
(
"<script type=\"text/javascript\">"
+
"parent['h2menu'].location='tables.do?jsessionid="
...
...
h2/src/main/org/h2/server/web/WebThread.java
浏览文件 @
4945dcc0
...
...
@@ -280,7 +280,7 @@ class WebThread extends WebApp implements Runnable {
len
=
Integer
.
parseInt
(
getHeaderLineValue
(
line
));
trace
(
"len="
+
len
);
}
else
if
(
lower
.
startsWith
(
"user-agent"
))
{
boolean
isWebKit
=
lower
.
indexOf
(
"webkit/"
)
>=
0
;
boolean
isWebKit
=
lower
.
contains
(
"webkit/"
)
;
if
(
isWebKit
&&
session
!=
null
)
{
// workaround for what seems to be a WebKit bug:
// http://code.google.com/p/chromium/issues/detail?id=6402
...
...
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
4945dcc0
...
...
@@ -329,7 +329,7 @@ public class PageStore implements CacheWriter {
file
=
database
.
openFile
(
fileName
,
accessMode
,
true
);
}
catch
(
DbException
e
)
{
if
(
e
.
getErrorCode
()
==
ErrorCode
.
IO_EXCEPTION_2
)
{
if
(
e
.
getMessage
().
indexOf
(
"locked"
)
>=
0
)
{
if
(
e
.
getMessage
().
contains
(
"locked"
)
)
{
// in Windows, you can't open a locked file
// (in other operating systems, you can)
// the exact error message is:
...
...
h2/src/main/org/h2/table/MetaTable.java
浏览文件 @
4945dcc0
...
...
@@ -691,7 +691,7 @@ public class MetaTable extends Table {
}
String
sql
=
table
.
getCreateSQL
();
if
(!
admin
)
{
if
(
sql
!=
null
&&
sql
.
indexOf
(
JdbcSQLException
.
HIDE_SQL
)
>=
0
)
{
if
(
sql
!=
null
&&
sql
.
contains
(
JdbcSQLException
.
HIDE_SQL
)
)
{
// hide the password of linked tables
sql
=
"-"
;
}
...
...
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
4945dcc0
...
...
@@ -941,7 +941,7 @@ public class TableFilter implements ColumnResolver {
* @return true if this is a joined natural join column
*/
public
boolean
isNaturalJoinColumn
(
Column
c
)
{
return
naturalJoinColumns
!=
null
&&
naturalJoinColumns
.
indexOf
(
c
)
>=
0
;
return
naturalJoinColumns
!=
null
&&
naturalJoinColumns
.
contains
(
c
)
;
}
@Override
...
...
h2/src/main/org/h2/tools/Server.java
浏览文件 @
4945dcc0
...
...
@@ -623,13 +623,13 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
if
(
browser
.
startsWith
(
"call:"
))
{
browser
=
browser
.
substring
(
"call:"
.
length
());
Utils
.
callStaticMethod
(
browser
,
url
);
}
else
if
(
browser
.
indexOf
(
"%url"
)
>=
0
)
{
}
else
if
(
browser
.
contains
(
"%url"
)
)
{
String
[]
args
=
StringUtils
.
arraySplit
(
browser
,
','
,
false
);
for
(
int
i
=
0
;
i
<
args
.
length
;
i
++)
{
args
[
i
]
=
StringUtils
.
replaceAll
(
args
[
i
],
"%url"
,
url
);
}
rt
.
exec
(
args
);
}
else
if
(
osName
.
indexOf
(
"windows"
)
>=
0
)
{
}
else
if
(
osName
.
contains
(
"windows"
)
)
{
rt
.
exec
(
new
String
[]
{
"cmd.exe"
,
"/C"
,
browser
,
url
});
}
else
{
rt
.
exec
(
new
String
[]
{
browser
,
url
});
...
...
@@ -655,9 +655,9 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
}
catch
(
Exception
e
)
{
// ignore
}
if
(
osName
.
indexOf
(
"windows"
)
>=
0
)
{
if
(
osName
.
contains
(
"windows"
)
)
{
rt
.
exec
(
new
String
[]
{
"rundll32"
,
"url.dll,FileProtocolHandler"
,
url
});
}
else
if
(
osName
.
indexOf
(
"mac"
)
>=
0
||
osName
.
indexOf
(
"darwin"
)
>=
0
)
{
}
else
if
(
osName
.
contains
(
"mac"
)
||
osName
.
contains
(
"darwin"
)
)
{
// Mac OS: to open a page with Safari, use "open -a Safari"
Runtime
.
getRuntime
().
exec
(
new
String
[]
{
"open"
,
url
});
}
else
{
...
...
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
4945dcc0
...
...
@@ -619,7 +619,7 @@ public class StringUtils {
* @return <![CDATA[data]]>
*/
public
static
String
xmlCData
(
String
data
)
{
if
(
data
.
indexOf
(
"]]>"
)
>=
0
)
{
if
(
data
.
contains
(
"]]>"
)
)
{
return
xmlText
(
data
);
}
boolean
newline
=
data
.
endsWith
(
"\n"
);
...
...
h2/src/test/org/h2/test/TestAll.java
浏览文件 @
4945dcc0
...
...
@@ -589,7 +589,7 @@ kill -9 `jps -l | grep "org.h2.test." | cut -d " " -f 1`
*/
private
static
boolean
isCoverage
()
{
for
(
StackTraceElement
e
:
Thread
.
currentThread
().
getStackTrace
())
{
if
(
e
.
toString
().
indexOf
(
".emma."
)
>=
0
)
{
if
(
e
.
toString
().
contains
(
".emma."
)
)
{
return
true
;
}
}
...
...
h2/src/test/org/h2/test/db/TestCompatibility.java
浏览文件 @
4945dcc0
...
...
@@ -137,7 +137,7 @@ public class TestCompatibility extends TestBase {
String
tableName
=
meta
.
getTableName
(
1
);
if
(
"ID"
.
equals
(
columnName
)
&&
"TEST"
.
equals
(
tableName
))
{
assertTrue
(
mode
+
" mode should not support columnAlias"
,
columnAlias
.
indexOf
(
mode
)
>=
0
);
columnAlias
.
contains
(
mode
)
);
}
else
if
(
"I"
.
equals
(
columnName
)
&&
tableName
.
equals
(
""
))
{
assertTrue
(
mode
+
" mode should support columnAlias"
,
columnAlias
.
indexOf
(
mode
)
<
0
);
...
...
@@ -160,7 +160,7 @@ public class TestCompatibility extends TestBase {
try
{
stat
.
execute
(
"INSERT INTO TEST VALUES(1), (2), (NULL), (NULL)"
);
assertTrue
(
mode
+
" mode should not support multiple NULL"
,
multiNull
.
indexOf
(
mode
)
>=
0
);
multiNull
.
contains
(
mode
)
);
}
catch
(
SQLException
e
)
{
assertTrue
(
mode
+
" mode should support multiple NULL"
,
multiNull
.
indexOf
(
mode
)
<
0
);
...
...
h2/src/test/org/h2/test/db/TestFunctions.java
浏览文件 @
4945dcc0
...
...
@@ -333,7 +333,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
ResultSet
rs
;
rs
=
stat
.
executeQuery
(
"select * from information_schema.views"
);
rs
.
next
();
assertTrue
(
rs
.
getString
(
"VIEW_DEFINITION"
).
indexOf
(
"SCHEMA2.FUNC"
)
>=
0
);
assertTrue
(
rs
.
getString
(
"VIEW_DEFINITION"
).
contains
(
"SCHEMA2.FUNC"
)
);
stat
.
execute
(
"drop view test"
);
stat
.
execute
(
"drop schema schema2"
);
...
...
@@ -736,7 +736,7 @@ public class TestFunctions extends TestBase implements AggregateFunction {
boolean
found
=
false
;
while
(
rs
.
next
())
{
String
sql
=
rs
.
getString
(
1
);
if
(
sql
.
indexOf
(
"MEDIAN"
)
>=
0
)
{
if
(
sql
.
contains
(
"MEDIAN"
)
)
{
found
=
true
;
}
}
...
...
h2/src/test/org/h2/test/db/TestIndex.java
浏览文件 @
4945dcc0
...
...
@@ -147,7 +147,7 @@ public class TestIndex extends TestBase {
int
start
=
m
.
indexOf
(
'\"'
),
end
=
m
.
indexOf
(
'\"'
,
start
+
1
);
String
s
=
m
.
substring
(
start
+
1
,
end
);
for
(
String
t
:
expected
)
{
assertTrue
(
t
+
" not in "
+
s
,
s
.
indexOf
(
t
)
>=
0
);
assertTrue
(
t
+
" not in "
+
s
,
s
.
contains
(
t
)
);
}
}
stat
.
execute
(
"drop table test"
);
...
...
h2/src/test/org/h2/test/db/TestLinkedTable.java
浏览文件 @
4945dcc0
...
...
@@ -138,7 +138,7 @@ public class TestLinkedTable extends TestBase {
"(null, 'jdbc:h2:mem:', 'sa', 'pwd', 'DUAL2')"
);
fail
();
}
catch
(
SQLException
e
)
{
assertTrue
(
e
.
toString
().
indexOf
(
"pwd"
)
>=
0
);
assertTrue
(
e
.
toString
().
contains
(
"pwd"
)
);
}
try
{
conn
.
createStatement
().
execute
(
"create linked table test"
+
...
...
h2/src/test/org/h2/test/db/TestListener.java
浏览文件 @
4945dcc0
...
...
@@ -110,7 +110,7 @@ public class TestListener extends TestBase implements DatabaseEventListener {
@Override
public
void
closingDatabase
()
{
if
(
databaseUrl
.
toUpperCase
().
indexOf
(
"CIPHER"
)
>=
0
)
{
if
(
databaseUrl
.
toUpperCase
().
contains
(
"CIPHER"
)
)
{
return
;
}
Connection
conn
=
null
;
...
...
@@ -132,7 +132,7 @@ public class TestListener extends TestBase implements DatabaseEventListener {
@Override
public
void
opened
()
{
if
(
databaseUrl
.
toUpperCase
().
indexOf
(
"CIPHER"
)
>=
0
)
{
if
(
databaseUrl
.
toUpperCase
().
contains
(
"CIPHER"
)
)
{
return
;
}
Connection
conn
=
null
;
...
...
h2/src/test/org/h2/test/db/TestOptimizations.java
浏览文件 @
4945dcc0
...
...
@@ -311,12 +311,12 @@ public class TestOptimizations extends TestBase {
rs
=
stat
.
executeQuery
(
"explain select * from test "
+
"where id > 10 order by id"
);
rs
.
next
();
assertTrue
(
rs
.
getString
(
1
).
indexOf
(
"IDX_ID_ASC"
)
>=
0
);
assertTrue
(
rs
.
getString
(
1
).
contains
(
"IDX_ID_ASC"
)
);
rs
=
stat
.
executeQuery
(
"explain select * from test "
+
"where id < 10 order by id desc"
);
rs
.
next
();
assertTrue
(
rs
.
getString
(
1
).
indexOf
(
"IDX_ID_DESC"
)
>=
0
);
assertTrue
(
rs
.
getString
(
1
).
contains
(
"IDX_ID_DESC"
)
);
rs
.
next
();
stat
.
execute
(
"drop table test"
);
...
...
h2/src/test/org/h2/test/db/TestRights.java
浏览文件 @
4945dcc0
...
...
@@ -67,7 +67,7 @@ public class TestRights extends TestBase {
ResultSetMetaData
meta
=
rs
.
getMetaData
();
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
String
s
=
rs
.
getString
(
i
);
assertFalse
(
s
!=
null
&&
s
.
indexOf
(
"'sa'"
)
>=
0
);
assertFalse
(
s
!=
null
&&
s
.
contains
(
"'sa'"
)
);
}
conn2
.
close
();
// password is visible to admin
...
...
@@ -79,7 +79,7 @@ public class TestRights extends TestBase {
boolean
foundPassword
=
false
;
for
(
int
i
=
1
;
i
<=
meta
.
getColumnCount
();
i
++)
{
String
s
=
rs
.
getString
(
i
);
if
(
s
!=
null
&&
s
.
indexOf
(
"'sa'"
)
>=
0
)
{
if
(
s
!=
null
&&
s
.
contains
(
"'sa'"
)
)
{
foundPassword
=
true
;
}
}
...
...
h2/src/test/org/h2/test/db/TestScript.java
浏览文件 @
4945dcc0
...
...
@@ -154,7 +154,7 @@ public class TestScript extends TestBase {
while
(
rs
.
next
())
{
String
sql
=
rs
.
getString
(
"SQL"
);
if
(
sql
!=
null
)
{
if
(
sql
.
indexOf
(
"TEMPORARY"
)
>=
0
)
{
if
(
sql
.
contains
(
"TEMPORARY"
)
)
{
return
true
;
}
}
...
...
@@ -281,7 +281,7 @@ public class TestScript extends TestBase {
}
private
void
writeResultSet
(
String
sql
,
ResultSet
rs
)
throws
Exception
{
boolean
ordered
=
StringUtils
.
toLowerEnglish
(
sql
).
indexOf
(
"order by"
)
>=
0
;
boolean
ordered
=
StringUtils
.
toLowerEnglish
(
sql
).
contains
(
"order by"
)
;
ResultSetMetaData
meta
=
rs
.
getMetaData
();
int
len
=
meta
.
getColumnCount
();
int
[]
max
=
new
int
[
len
];
...
...
h2/src/test/org/h2/test/jdbc/TestPreparedStatement.java
浏览文件 @
4945dcc0
...
...
@@ -774,7 +774,7 @@ public class TestPreparedStatement extends TestBase {
ResultSet
rs
=
prep
.
executeQuery
();
rs
.
next
();
String
plan
=
rs
.
getString
(
1
);
assertTrue
(
plan
.
indexOf
(
".tableScan"
)
>=
0
);
assertTrue
(
plan
.
contains
(
".tableScan"
)
);
rs
=
prepExe
.
executeQuery
();
rs
.
next
();
assertEquals
(
"World"
,
rs
.
getString
(
2
));
...
...
@@ -785,7 +785,7 @@ public class TestPreparedStatement extends TestBase {
rs
=
prep
.
executeQuery
();
rs
.
next
();
String
plan1
=
rs
.
getString
(
1
);
assertTrue
(
plan1
.
indexOf
(
"IDXNAME"
)
>=
0
);
assertTrue
(
plan1
.
contains
(
"IDXNAME"
)
);
rs
=
prepExe
.
executeQuery
();
rs
.
next
();
assertEquals
(
"Hello"
,
rs
.
getString
(
2
));
...
...
h2/src/test/org/h2/test/jdbcx/TestConnectionPool.java
浏览文件 @
4945dcc0
...
...
@@ -104,7 +104,7 @@ public class TestConnectionPool extends TestBase {
man
.
getConnection
();
fail
();
}
catch
(
SQLException
e
)
{
assertTrue
(
e
.
toString
().
toLowerCase
().
indexOf
(
"timeout"
)
>=
0
);
assertTrue
(
e
.
toString
().
toLowerCase
().
contains
(
"timeout"
)
);
time
=
System
.
currentTimeMillis
()
-
time
;
assertTrue
(
"timeout after "
+
time
+
" ms"
,
time
>
1000
);
}
finally
{
...
...
h2/src/test/org/h2/test/server/TestWeb.java
浏览文件 @
4945dcc0
...
...
@@ -141,7 +141,7 @@ public class TestWeb extends TestBase {
Server
server
=
Server
.
createWebServer
(
"-webPort"
,
"8182"
,
"-properties"
,
"null"
);
server
.
start
();
assertTrue
(
server
.
getStatus
().
indexOf
(
"server running"
)
>=
0
);
assertTrue
(
server
.
getStatus
().
contains
(
"server running"
)
);
Server
server2
=
Server
.
createWebServer
(
"-webPort"
,
"8182"
,
"-properties"
,
"null"
);
assertEquals
(
"Not started"
,
server2
.
getStatus
());
...
...
@@ -149,9 +149,9 @@ public class TestWeb extends TestBase {
server2
.
start
();
fail
();
}
catch
(
Exception
e
)
{
assertTrue
(
e
.
toString
().
indexOf
(
"port may be in use"
)
>=
0
);
assertTrue
(
server2
.
getStatus
().
indexOf
(
"could not be started"
)
>=
0
);
assertTrue
(
e
.
toString
().
contains
(
"port may be in use"
)
);
assertTrue
(
server2
.
getStatus
().
contains
(
"could not be started"
));
}
server
.
stop
();
}
...
...
h2/src/test/org/h2/test/store/TestMVTableEngine.java
浏览文件 @
4945dcc0
...
...
@@ -281,7 +281,7 @@ public class TestMVTableEngine extends TestBase {
rs
.
next
();
plan
=
rs
.
getString
(
1
);
// transaction log is larger than the table, so read the table
assertTrue
(
plan
,
plan
.
indexOf
(
"reads:"
)
>=
0
);
assertTrue
(
plan
,
plan
.
contains
(
"reads:"
)
);
rs
=
stat2
.
executeQuery
(
"select count(*) from test"
);
rs
.
next
();
assertEquals
(
10000
,
rs
.
getInt
(
1
));
...
...
@@ -363,7 +363,7 @@ public class TestMVTableEngine extends TestBase {
rs
.
next
();
String
plan
=
rs
.
getString
(
1
);
// expect about 249 reads
assertTrue
(
plan
,
plan
.
indexOf
(
"reads: 2"
)
>=
0
);
assertTrue
(
plan
,
plan
.
contains
(
"reads: 2"
)
);
conn
.
close
();
}
...
...
h2/src/test/org/h2/test/synth/TestCrashAPI.java
浏览文件 @
4945dcc0
...
...
@@ -406,7 +406,7 @@ if (connectTime > 2000) {
private
void
printIfBad
(
int
seed
,
int
id
,
int
objectId
,
Throwable
t
)
{
if
(
t
instanceof
BatchUpdateException
)
{
// do nothing
}
else
if
(
t
.
getClass
().
getName
().
indexOf
(
"SQLClientInfoException"
)
>=
0
)
{
}
else
if
(
t
.
getClass
().
getName
().
contains
(
"SQLClientInfoException"
)
)
{
// do nothing
}
else
if
(
t
instanceof
SQLException
)
{
SQLException
s
=
(
SQLException
)
t
;
...
...
h2/src/test/org/h2/test/synth/TestNestedJoins.java
浏览文件 @
4945dcc0
...
...
@@ -290,7 +290,7 @@ public class TestNestedJoins extends TestBase {
"inner join c on c.id = b.id on b.id = a.id"
);
assertTrue
(
rs
.
next
());
sql
=
rs
.
getString
(
1
);
assertTrue
(
"nested"
,
sql
.
indexOf
(
"("
)
>=
0
);
assertTrue
(
"nested"
,
sql
.
contains
(
"("
)
);
stat
.
execute
(
"drop table a, b, c"
);
// see roadmap, tag: swapInnerJoinTables
...
...
@@ -355,7 +355,7 @@ public class TestNestedJoins extends TestBase {
"left outer join (test c) on a.id = c.id"
);
assertTrue
(
rs
.
next
());
sql
=
rs
.
getString
(
1
);
assertTrue
(
sql
.
indexOf
(
"PRIMARY_KEY"
)
>=
0
);
assertTrue
(
sql
.
contains
(
"PRIMARY_KEY"
)
);
stat
.
execute
(
"drop table test"
);
/*
...
...
@@ -634,7 +634,7 @@ public class TestNestedJoins extends TestBase {
r
.
setSkipRemarks
(
true
);
sql
=
r
.
readStatement
();
sql
=
sql
.
replaceAll
(
"\\n"
,
" "
);
while
(
sql
.
indexOf
(
" "
)
>=
0
)
{
while
(
sql
.
contains
(
" "
)
)
{
sql
=
sql
.
replaceAll
(
" "
,
" "
);
}
return
sql
;
...
...
h2/src/test/org/h2/test/synth/TestOuterJoins.java
浏览文件 @
4945dcc0
...
...
@@ -309,7 +309,7 @@ public class TestOuterJoins extends TestBase {
"left outer join (test c) on a.id = c.id"
);
assertTrue
(
rs
.
next
());
sql
=
rs
.
getString
(
1
);
assertTrue
(
sql
.
indexOf
(
"PRIMARY_KEY"
)
>=
0
);
assertTrue
(
sql
.
contains
(
"PRIMARY_KEY"
)
);
stat
.
execute
(
"drop table test"
);
/*
...
...
@@ -584,7 +584,7 @@ public class TestOuterJoins extends TestBase {
r
.
setSkipRemarks
(
true
);
sql
=
r
.
readStatement
();
sql
=
sql
.
replaceAll
(
"\\n"
,
" "
);
while
(
sql
.
indexOf
(
" "
)
>=
0
)
{
while
(
sql
.
contains
(
" "
)
)
{
sql
=
sql
.
replaceAll
(
" "
,
" "
);
}
return
sql
;
...
...
h2/src/test/org/h2/test/trace/Parser.java
浏览文件 @
4945dcc0
...
...
@@ -186,8 +186,8 @@ class Parser {
Float
v
=
Float
.
parseFloat
(
number
);
return
new
Arg
(
float
.
class
,
v
);
}
else
if
(
number
.
endsWith
(
"d"
)
||
number
.
indexOf
(
"e"
)
>=
0
||
number
.
indexOf
(
"."
)
>=
0
)
{
number
.
indexOf
(
'e'
)
>=
0
||
number
.
indexOf
(
'.'
)
>=
0
)
{
Double
v
=
Double
.
parseDouble
(
number
);
return
new
Arg
(
double
.
class
,
v
);
}
else
if
(
number
.
endsWith
(
"L"
)
||
number
.
endsWith
(
"l"
))
{
...
...
h2/src/test/org/h2/test/unit/TestClearReferences.java
浏览文件 @
4945dcc0
...
...
@@ -120,7 +120,7 @@ public class TestClearReferences extends TestBase {
try
{
clazz
=
Class
.
forName
(
className
);
}
catch
(
NoClassDefFoundError
e
)
{
if
(
e
.
toString
().
indexOf
(
"lucene"
)
>=
0
)
{
if
(
e
.
toString
().
contains
(
"lucene"
)
)
{
// Lucene is not in the classpath, OK
}
}
catch
(
ClassNotFoundException
e
)
{
...
...
@@ -142,13 +142,13 @@ public class TestClearReferences extends TestBase {
try
{
fields
=
clazz
.
getDeclaredFields
();
}
catch
(
NoClassDefFoundError
e
)
{
if
(
e
.
toString
().
indexOf
(
"lucene"
)
>=
0
)
{
if
(
e
.
toString
().
contains
(
"lucene"
)
)
{
// Lucene is not in the classpath, OK
return
;
}
else
if
(
e
.
toString
().
indexOf
(
"jts"
)
>=
0
)
{
}
else
if
(
e
.
toString
().
contains
(
"jts"
)
)
{
// JTS is not in the classpath, OK
return
;
}
else
if
(
e
.
toString
().
indexOf
(
"slf4j"
)
>=
0
)
{
}
else
if
(
e
.
toString
().
contains
(
"slf4j"
)
)
{
// slf4j is not in the classpath, OK
return
;
}
...
...
h2/src/test/org/h2/test/unit/TestJmx.java
浏览文件 @
4945dcc0
...
...
@@ -98,32 +98,32 @@ public class TestJmx extends TestBase {
getAttribute
(
name
,
"Version"
).
toString
().
startsWith
(
"1."
));
assertEquals
(
14
,
info
.
getAttributes
().
length
);
result
=
mbeanServer
.
invoke
(
name
,
"listSettings"
,
null
,
null
).
toString
();
assertTrue
(
result
.
indexOf
(
"ANALYZE_AUTO"
)
>=
0
);
assertTrue
(
result
.
contains
(
"ANALYZE_AUTO"
)
);
conn
.
setAutoCommit
(
false
);
stat
.
execute
(
"create table test(id int)"
);
stat
.
execute
(
"insert into test values(1)"
);
result
=
mbeanServer
.
invoke
(
name
,
"listSessions"
,
null
,
null
).
toString
();
assertTrue
(
result
.
indexOf
(
"session id"
)
>=
0
);
assertTrue
(
result
.
contains
(
"session id"
)
);
if
(
config
.
mvcc
)
{
assertTrue
(
result
.
indexOf
(
"read lock"
)
>=
0
);
assertTrue
(
result
.
contains
(
"read lock"
)
);
}
else
{
assertTrue
(
result
.
indexOf
(
"write lock"
)
>=
0
);
assertTrue
(
result
.
contains
(
"write lock"
)
);
}
assertEquals
(
2
,
info
.
getOperations
().
length
);
assertTrue
(
info
.
getDescription
().
indexOf
(
"database"
)
>=
0
);
assertTrue
(
info
.
getDescription
().
contains
(
"database"
)
);
attrMap
=
New
.
hashMap
();
for
(
MBeanAttributeInfo
a
:
info
.
getAttributes
())
{
attrMap
.
put
(
a
.
getName
(),
a
);
}
assertTrue
(
attrMap
.
get
(
"CacheSize"
).
getDescription
().
indexOf
(
"KB"
)
>=
0
);
assertTrue
(
attrMap
.
get
(
"CacheSize"
).
getDescription
().
contains
(
"KB"
)
);
opMap
=
New
.
hashMap
();
for
(
MBeanOperationInfo
o
:
info
.
getOperations
())
{
opMap
.
put
(
o
.
getName
(),
o
);
}
assertTrue
(
opMap
.
get
(
"listSessions"
).
getDescription
().
indexOf
(
"lock"
)
>=
0
);
assertTrue
(
opMap
.
get
(
"listSessions"
).
getDescription
().
contains
(
"lock"
)
);
assertEquals
(
MBeanOperationInfo
.
INFO
,
opMap
.
get
(
"listSessions"
).
getImpact
());
conn
.
close
();
...
...
h2/src/test/org/h2/test/unit/TestPgServer.java
浏览文件 @
4945dcc0
...
...
@@ -231,8 +231,8 @@ public class TestPgServer extends TestBase {
"select version(), pg_postmaster_start_time(), current_schema()"
);
rs
.
next
();
String
s
=
rs
.
getString
(
1
);
assertTrue
(
s
.
indexOf
(
"H2"
)
>=
0
);
assertTrue
(
s
.
indexOf
(
"PostgreSQL"
)
>=
0
);
assertTrue
(
s
.
contains
(
"H2"
)
);
assertTrue
(
s
.
contains
(
"PostgreSQL"
)
);
s
=
rs
.
getString
(
2
);
s
=
rs
.
getString
(
3
);
assertEquals
(
s
,
"PUBLIC"
);
...
...
h2/src/test/org/h2/test/unit/TestRecovery.java
浏览文件 @
4945dcc0
...
...
@@ -160,7 +160,7 @@ public class TestRecovery extends TestBase {
byte
[]
buff
=
new
byte
[
Constants
.
DEFAULT_PAGE_SIZE
];
while
(
f
.
position
()
<
f
.
size
())
{
FileUtils
.
readFully
(
f
,
ByteBuffer
.
wrap
(
buff
));
if
(
new
String
(
buff
).
indexOf
(
"Hello World1"
)
>=
0
)
{
if
(
new
String
(
buff
).
contains
(
"Hello World1"
)
)
{
buff
[
buff
.
length
-
1
]++;
f
.
position
(
f
.
position
()
-
buff
.
length
);
f
.
write
(
ByteBuffer
.
wrap
(
buff
));
...
...
@@ -291,7 +291,7 @@ public class TestRecovery extends TestBase {
rec
.
setOut
(
new
PrintStream
(
buff
));
rec
.
runTool
(
"-dir"
,
getBaseDir
(),
"-db"
,
"recovery"
,
"-trace"
);
String
out
=
new
String
(
buff
.
toByteArray
());
assertTrue
(
out
.
indexOf
(
"Created file"
)
>=
0
);
assertTrue
(
out
.
contains
(
"Created file"
)
);
Connection
conn2
=
getConnection
(
"recovery2"
);
Statement
stat2
=
conn2
.
createStatement
();
...
...
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
4945dcc0
...
...
@@ -508,36 +508,36 @@ public class TestTools extends TestBase {
Connection
conn
;
result
=
runServer
(
0
,
new
String
[]{
"-?"
});
assertTrue
(
result
.
indexOf
(
"Starts the H2 Console"
)
>=
0
);
assertTrue
(
result
.
contains
(
"Starts the H2 Console"
)
);
assertTrue
(
result
.
indexOf
(
"Unknown option"
)
<
0
);
result
=
runServer
(
1
,
new
String
[]{
"-xy"
});
assertTrue
(
result
.
indexOf
(
"Starts the H2 Console"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
"Feature not supported"
)
>=
0
);
assertTrue
(
result
.
contains
(
"Starts the H2 Console"
)
);
assertTrue
(
result
.
contains
(
"Feature not supported"
)
);
result
=
runServer
(
0
,
new
String
[]{
"-tcp"
,
"-tcpPort"
,
"9001"
,
"-tcpPassword"
,
"abc"
});
assertTrue
(
result
.
indexOf
(
"tcp://"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
":9001"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
"only local"
)
>=
0
);
assertTrue
(
result
.
contains
(
"tcp://"
)
);
assertTrue
(
result
.
contains
(
":9001"
)
);
assertTrue
(
result
.
contains
(
"only local"
)
);
assertTrue
(
result
.
indexOf
(
"Starts the H2 Console"
)
<
0
);
conn
=
getConnection
(
"jdbc:h2:tcp://localhost:9001/mem:"
,
"sa"
,
"sa"
);
conn
.
close
();
result
=
runServer
(
0
,
new
String
[]{
"-tcpShutdown"
,
"tcp://localhost:9001"
,
"-tcpPassword"
,
"abc"
,
"-tcpShutdownForce"
});
assertTrue
(
result
.
indexOf
(
"Shutting down"
)
>=
0
);
assertTrue
(
result
.
contains
(
"Shutting down"
)
);
result
=
runServer
(
0
,
new
String
[]{
"-tcp"
,
"-tcpAllowOthers"
,
"-tcpPort"
,
"9001"
,
"-tcpPassword"
,
"abcdef"
,
"-tcpSSL"
});
assertTrue
(
result
.
indexOf
(
"ssl://"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
":9001"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
"others can"
)
>=
0
);
assertTrue
(
result
.
contains
(
"ssl://"
)
);
assertTrue
(
result
.
contains
(
":9001"
)
);
assertTrue
(
result
.
contains
(
"others can"
)
);
assertTrue
(
result
.
indexOf
(
"Starts the H2 Console"
)
<
0
);
conn
=
getConnection
(
"jdbc:h2:ssl://localhost:9001/mem:"
,
"sa"
,
"sa"
);
conn
.
close
();
result
=
runServer
(
0
,
new
String
[]{
"-tcpShutdown"
,
"ssl://localhost:9001"
,
"-tcpPassword"
,
"abcdef"
});
assertTrue
(
result
.
indexOf
(
"Shutting down"
)
>=
0
);
assertTrue
(
result
.
contains
(
"Shutting down"
)
);
assertThrows
(
ErrorCode
.
CONNECTION_BROKEN_1
,
this
).
getConnection
(
"jdbc:h2:ssl://localhost:9001/mem:"
,
"sa"
,
"sa"
);
...
...
@@ -546,21 +546,21 @@ public class TestTools extends TestBase {
"-pg"
,
"-pgAllowOthers"
,
"-pgPort"
,
"9003"
,
"-tcp"
,
"-tcpAllowOthers"
,
"-tcpPort"
,
"9006"
,
"-tcpPassword"
,
"abc"
});
Server
stop
=
server
;
assertTrue
(
result
.
indexOf
(
"https://"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
":9002"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
"pg://"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
":9003"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
"others can"
)
>=
0
);
assertTrue
(
result
.
contains
(
"https://"
)
);
assertTrue
(
result
.
contains
(
":9002"
)
);
assertTrue
(
result
.
contains
(
"pg://"
)
);
assertTrue
(
result
.
contains
(
":9003"
)
);
assertTrue
(
result
.
contains
(
"others can"
)
);
assertTrue
(
result
.
indexOf
(
"only local"
)
<
0
);
assertTrue
(
result
.
indexOf
(
"tcp://"
)
>=
0
);
assertTrue
(
result
.
indexOf
(
":9006"
)
>=
0
);
assertTrue
(
result
.
contains
(
"tcp://"
)
);
assertTrue
(
result
.
contains
(
":9006"
)
);
conn
=
getConnection
(
"jdbc:h2:tcp://localhost:9006/mem:"
,
"sa"
,
"sa"
);
conn
.
close
();
result
=
runServer
(
0
,
new
String
[]{
"-tcpShutdown"
,
"tcp://localhost:9006"
,
"-tcpPassword"
,
"abc"
,
"-tcpShutdownForce"
});
assertTrue
(
result
.
indexOf
(
"Shutting down"
)
>=
0
);
assertTrue
(
result
.
contains
(
"Shutting down"
)
);
stop
.
shutdown
();
assertThrows
(
ErrorCode
.
CONNECTION_BROKEN_1
,
this
).
getConnection
(
"jdbc:h2:tcp://localhost:9006/mem:"
,
"sa"
,
"sa"
);
...
...
@@ -868,7 +868,7 @@ public class TestTools extends TestBase {
tool
.
setOut
(
new
PrintStream
(
buff
));
tool
.
runTool
(
"-url"
,
url
,
"-user"
,
user
,
"-password"
,
password
,
"-script"
,
fileName
+
".txt"
,
"-showResults"
);
assertTrue
(
buff
.
toString
().
indexOf
(
"Hello"
)
>=
0
);
assertTrue
(
buff
.
toString
().
contains
(
"Hello"
)
);
}
private
void
testBackupRestore
()
throws
SQLException
{
...
...
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
4945dcc0
...
...
@@ -295,7 +295,7 @@ public class BuildBase {
}
private
static
boolean
isWindows
()
{
return
System
.
getProperty
(
"os.name"
).
toLowerCase
().
indexOf
(
"windows"
)
>=
0
;
return
System
.
getProperty
(
"os.name"
).
toLowerCase
().
contains
(
"windows"
)
;
}
/**
...
...
h2/src/tools/org/h2/build/doc/LinkChecker.java
浏览文件 @
4945dcc0
...
...
@@ -90,7 +90,7 @@ public class LinkChecker {
if
(
targets
.
get
(
name
).
equals
(
"id"
))
{
boolean
ignore
=
false
;
for
(
String
to
:
IGNORE_MISSING_LINKS_TO
)
{
if
(
name
.
indexOf
(
to
)
>=
0
)
{
if
(
name
.
contains
(
to
)
)
{
ignore
=
true
;
break
;
}
...
...
h2/src/tools/org/h2/build/doc/UploadBuild.java
浏览文件 @
4945dcc0
...
...
@@ -56,7 +56,7 @@ public class UploadBuild {
byte
[]
data
=
IOUtils
.
readBytesAndClose
(
new
FileInputStream
(
"coverage/index.html"
),
-
1
);
String
index
=
new
String
(
data
,
"ISO-8859-1"
);
coverageFailed
=
index
.
indexOf
(
"CLASS=\"h\""
)
>=
0
;
coverageFailed
=
index
.
contains
(
"CLASS=\"h\""
)
;
while
(
true
)
{
int
idx
=
index
.
indexOf
(
"<A HREF=\""
);
if
(
idx
<
0
)
{
...
...
@@ -90,7 +90,7 @@ public class UploadBuild {
if
(
new
File
(
"docs/html/testOutput.html"
).
exists
())
{
testOutput
=
IOUtils
.
readStringAndClose
(
new
FileReader
(
"docs/html/testOutput.html"
),
-
1
);
error
=
testOutput
.
indexOf
(
OutputCatcher
.
START_ERROR
)
>=
0
;
error
=
testOutput
.
contains
(
OutputCatcher
.
START_ERROR
)
;
}
else
if
(
new
File
(
"log.txt"
).
exists
())
{
testOutput
=
IOUtils
.
readStringAndClose
(
new
FileReader
(
"log.txt"
),
-
1
);
error
=
true
;
...
...
h2/src/tools/org/h2/build/indexer/Indexer.java
浏览文件 @
4945dcc0
...
...
@@ -196,7 +196,7 @@ public class Indexer {
if
(!
lower
.
endsWith
(
".html"
)
&&
!
lower
.
endsWith
(
".htm"
))
{
return
;
}
if
(
lower
.
indexOf
(
"_ja."
)
>=
0
)
{
if
(
lower
.
contains
(
"_ja."
)
)
{
return
;
}
if
(!
noIndex
.
contains
(
fileName
))
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论