Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
705e592e
Unverified
提交
705e592e
authored
7 年前
作者:
Noel Grandin
提交者:
GitHub
7 年前
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #863 from igor-suhorukov/master
Polish: use isEmpty() to check whether the collection is empty or not.
上级
77b6e4b1
a8a1c5ea
隐藏空白字符变更
内嵌
并排
正在显示
43 个修改的文件
包含
82 行增加
和
82 行删除
+82
-82
Parser.java
h2/src/main/org/h2/command/Parser.java
+3
-3
CreateTable.java
h2/src/main/org/h2/command/ddl/CreateTable.java
+1
-1
CreateView.java
h2/src/main/org/h2/command/ddl/CreateView.java
+1
-1
DropTable.java
h2/src/main/org/h2/command/ddl/DropTable.java
+2
-2
Insert.java
h2/src/main/org/h2/command/dml/Insert.java
+3
-3
Merge.java
h2/src/main/org/h2/command/dml/Merge.java
+4
-4
MergeUsing.java
h2/src/main/org/h2/command/dml/MergeUsing.java
+3
-3
Replace.java
h2/src/main/org/h2/command/dml/Replace.java
+4
-4
Database.java
h2/src/main/org/h2/engine/Database.java
+3
-3
Engine.java
h2/src/main/org/h2/engine/Engine.java
+1
-1
FunctionAlias.java
h2/src/main/org/h2/engine/FunctionAlias.java
+1
-1
Session.java
h2/src/main/org/h2/engine/Session.java
+7
-7
SessionRemote.java
h2/src/main/org/h2/engine/SessionRemote.java
+2
-2
SessionWithState.java
h2/src/main/org/h2/engine/SessionWithState.java
+1
-1
Aggregate.java
h2/src/main/org/h2/expression/Aggregate.java
+1
-1
FullText.java
h2/src/main/org/h2/fulltext/FullText.java
+4
-4
FullTextLucene.java
h2/src/main/org/h2/fulltext/FullTextLucene.java
+3
-3
JdbcXAConnection.java
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
+1
-1
Trace.java
h2/src/main/org/h2/message/Trace.java
+1
-1
MVStore.java
h2/src/main/org/h2/mvstore/MVStore.java
+4
-4
MVTable.java
h2/src/main/org/h2/mvstore/db/MVTable.java
+1
-1
SpatialDataType.java
h2/src/main/org/h2/mvstore/rtree/SpatialDataType.java
+1
-1
UpdatableRow.java
h2/src/main/org/h2/result/UpdatableRow.java
+1
-1
CipherFactory.java
h2/src/main/org/h2/security/CipherFactory.java
+1
-1
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+1
-1
PageParser.java
h2/src/main/org/h2/server/web/PageParser.java
+1
-1
WebApp.java
h2/src/main/org/h2/server/web/WebApp.java
+1
-1
WebSession.java
h2/src/main/org/h2/server/web/WebSession.java
+1
-1
PageStore.java
h2/src/main/org/h2/store/PageStore.java
+1
-1
RegularTable.java
h2/src/main/org/h2/table/RegularTable.java
+1
-1
Table.java
h2/src/main/org/h2/table/Table.java
+7
-7
TableFilter.java
h2/src/main/org/h2/table/TableFilter.java
+2
-2
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+2
-2
Backup.java
h2/src/main/org/h2/tools/Backup.java
+1
-1
ChangeFileEncryption.java
h2/src/main/org/h2/tools/ChangeFileEncryption.java
+1
-1
Csv.java
h2/src/main/org/h2/tools/Csv.java
+1
-1
DeleteDbFiles.java
h2/src/main/org/h2/tools/DeleteDbFiles.java
+1
-1
Recover.java
h2/src/main/org/h2/tools/Recover.java
+1
-1
Shell.java
h2/src/main/org/h2/tools/Shell.java
+1
-1
SimpleResultSet.java
h2/src/main/org/h2/tools/SimpleResultSet.java
+1
-1
AbbaDetector.java
h2/src/main/org/h2/util/AbbaDetector.java
+1
-1
CacheLRU.java
h2/src/main/org/h2/util/CacheLRU.java
+2
-2
Profiler.java
h2/src/main/org/h2/util/Profiler.java
+1
-1
没有找到文件。
h2/src/main/org/h2/command/Parser.java
浏览文件 @
705e592e
...
...
@@ -548,7 +548,7 @@ public class Parser {
}
private
DbException
getSyntaxError
()
{
if
(
expectedList
==
null
||
expectedList
.
size
()
==
0
)
{
if
(
expectedList
==
null
||
expectedList
.
isEmpty
()
)
{
return
DbException
.
getSyntaxError
(
sqlCommand
,
parseIndex
);
}
StatementBuilder
buff
=
new
StatementBuilder
();
...
...
@@ -3023,7 +3023,7 @@ public class Parser {
// this can occur when parsing expressions only (for
// example check constraints)
throw
getSyntaxError
();
}
else
if
(
parameters
.
size
()
>
0
)
{
}
else
if
(
!
parameters
.
isEmpty
()
)
{
throw
DbException
.
get
(
ErrorCode
.
CANNOT_MIX_INDEXED_AND_UNINDEXED_PARAMS
);
}
...
...
@@ -4725,7 +4725,7 @@ public class Parser {
int
scale
,
displaySize
;
Column
column
;
String
columnName
=
"C"
+
(
i
+
1
);
if
(
rows
.
size
()
==
0
)
{
if
(
rows
.
isEmpty
()
)
{
if
(
type
==
Value
.
UNKNOWN
)
{
type
=
Value
.
STRING
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/CreateTable.java
浏览文件 @
705e592e
...
...
@@ -119,7 +119,7 @@ public class CreateTable extends SchemaCommand {
}
if
(
asQuery
!=
null
)
{
asQuery
.
prepare
();
if
(
data
.
columns
.
size
()
==
0
)
{
if
(
data
.
columns
.
isEmpty
()
)
{
generateColumnsFromQuery
();
}
else
if
(
data
.
columns
.
size
()
!=
asQuery
.
getColumnCount
())
{
throw
DbException
.
get
(
ErrorCode
.
COLUMN_COUNT_DOES_NOT_MATCH
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/CreateView.java
浏览文件 @
705e592e
...
...
@@ -98,7 +98,7 @@ public class CreateView extends SchemaCommand {
querySQL
=
selectSQL
;
}
else
{
ArrayList
<
Parameter
>
params
=
select
.
getParameters
();
if
(
params
!=
null
&&
params
.
size
()
>
0
)
{
if
(
params
!=
null
&&
!
params
.
isEmpty
()
)
{
throw
DbException
.
getUnsupportedException
(
"parameters in views"
);
}
querySQL
=
select
.
getPlanSQL
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/ddl/DropTable.java
浏览文件 @
705e592e
...
...
@@ -77,7 +77,7 @@ public class DropTable extends SchemaCommand {
if
(
dropAction
==
ConstraintActionType
.
RESTRICT
)
{
StatementBuilder
buff
=
new
StatementBuilder
();
CopyOnWriteArrayList
<
TableView
>
dependentViews
=
table
.
getDependentViews
();
if
(
dependentViews
!=
null
&&
dependentViews
.
size
()
>
0
)
{
if
(
dependentViews
!=
null
&&
!
dependentViews
.
isEmpty
()
)
{
for
(
TableView
v
:
dependentViews
)
{
buff
.
appendExceptFirst
(
", "
);
buff
.
append
(
v
.
getName
());
...
...
@@ -86,7 +86,7 @@ public class DropTable extends SchemaCommand {
if
(
session
.
getDatabase
()
.
getSettings
().
standardDropTableRestrict
)
{
final
List
<
Constraint
>
constraints
=
table
.
getConstraints
();
if
(
constraints
!=
null
&&
constraints
.
size
()
>
0
)
{
if
(
constraints
!=
null
&&
!
constraints
.
isEmpty
()
)
{
for
(
Constraint
c
:
constraints
)
{
if
(
c
.
getTable
()
!=
table
)
{
buff
.
appendExceptFirst
(
", "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Insert.java
浏览文件 @
705e592e
...
...
@@ -243,7 +243,7 @@ public class Insert extends Prepared implements ResultTarget {
if
(
sortedInsertMode
)
{
buff
.
append
(
"SORTED "
);
}
if
(
list
.
size
()
>
0
)
{
if
(
!
list
.
isEmpty
()
)
{
buff
.
append
(
"VALUES "
);
int
row
=
0
;
if
(
list
.
size
()
>
1
)
{
...
...
@@ -274,14 +274,14 @@ public class Insert extends Prepared implements ResultTarget {
@Override
public
void
prepare
()
{
if
(
columns
==
null
)
{
if
(
list
.
size
()
>
0
&&
list
.
get
(
0
).
length
==
0
)
{
if
(
!
list
.
isEmpty
()
&&
list
.
get
(
0
).
length
==
0
)
{
// special case where table is used as a sequence
columns
=
new
Column
[
0
];
}
else
{
columns
=
table
.
getColumns
();
}
}
if
(
list
.
size
()
>
0
)
{
if
(
!
list
.
isEmpty
()
)
{
for
(
Expression
[]
expr
:
list
)
{
if
(
expr
.
length
!=
columns
.
length
)
{
throw
DbException
.
get
(
ErrorCode
.
COLUMN_COUNT_DOES_NOT_MATCH
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Merge.java
浏览文件 @
705e592e
...
...
@@ -84,7 +84,7 @@ public class Merge extends Prepared {
session
.
getUser
().
checkRight
(
targetTable
,
Right
.
INSERT
);
session
.
getUser
().
checkRight
(
targetTable
,
Right
.
UPDATE
);
setCurrentRowNumber
(
0
);
if
(
valuesExpressionList
.
size
()
>
0
)
{
if
(
!
valuesExpressionList
.
isEmpty
()
)
{
// process values in list
count
=
0
;
for
(
int
x
=
0
,
size
=
valuesExpressionList
.
size
();
x
<
size
;
x
++)
{
...
...
@@ -221,7 +221,7 @@ public class Merge extends Prepared {
buff
.
append
(
')'
);
}
buff
.
append
(
'\n'
);
if
(
valuesExpressionList
.
size
()
>
0
)
{
if
(
!
valuesExpressionList
.
isEmpty
()
)
{
buff
.
append
(
"VALUES "
);
int
row
=
0
;
for
(
Expression
[]
expr
:
valuesExpressionList
)
{
...
...
@@ -249,14 +249,14 @@ public class Merge extends Prepared {
@Override
public
void
prepare
()
{
if
(
columns
==
null
)
{
if
(
valuesExpressionList
.
size
()
>
0
&&
valuesExpressionList
.
get
(
0
).
length
==
0
)
{
if
(
!
valuesExpressionList
.
isEmpty
()
&&
valuesExpressionList
.
get
(
0
).
length
==
0
)
{
// special case where table is used as a sequence
columns
=
new
Column
[
0
];
}
else
{
columns
=
targetTable
.
getColumns
();
}
}
if
(
valuesExpressionList
.
size
()
>
0
)
{
if
(
!
valuesExpressionList
.
isEmpty
()
)
{
for
(
Expression
[]
expr
:
valuesExpressionList
)
{
if
(
expr
.
length
!=
columns
.
length
)
{
throw
DbException
.
get
(
ErrorCode
.
COLUMN_COUNT_DOES_NOT_MATCH
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/MergeUsing.java
浏览文件 @
705e592e
...
...
@@ -315,7 +315,7 @@ public class MergeUsing extends Prepared {
buff
.
append
(
')'
);
}
buff
.
append
(
'\n'
);
if
(
valuesExpressionList
.
size
()
>
0
)
{
if
(
!
valuesExpressionList
.
isEmpty
()
)
{
buff
.
append
(
"VALUES "
);
int
row
=
0
;
for
(
Expression
[]
expr
:
valuesExpressionList
)
{
...
...
@@ -376,7 +376,7 @@ public class MergeUsing extends Prepared {
onCondition
.
createIndexConditions
(
session
,
targetTableFilter
);
if
(
columns
==
null
)
{
if
(
valuesExpressionList
.
size
()
>
0
if
(
!
valuesExpressionList
.
isEmpty
()
&&
valuesExpressionList
.
get
(
0
).
length
==
0
)
{
// special case where table is used as a sequence
columns
=
new
Column
[
0
];
...
...
@@ -384,7 +384,7 @@ public class MergeUsing extends Prepared {
columns
=
targetTable
.
getColumns
();
}
}
if
(
valuesExpressionList
.
size
()
>
0
)
{
if
(
!
valuesExpressionList
.
isEmpty
()
)
{
for
(
Expression
[]
expr
:
valuesExpressionList
)
{
if
(
expr
.
length
!=
columns
.
length
)
{
throw
DbException
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/command/dml/Replace.java
浏览文件 @
705e592e
...
...
@@ -82,7 +82,7 @@ public class Replace extends Prepared {
session
.
getUser
().
checkRight
(
table
,
Right
.
INSERT
);
session
.
getUser
().
checkRight
(
table
,
Right
.
UPDATE
);
setCurrentRowNumber
(
0
);
if
(
list
.
size
()
>
0
)
{
if
(
!
list
.
isEmpty
()
)
{
count
=
0
;
for
(
int
x
=
0
,
size
=
list
.
size
();
x
<
size
;
x
++)
{
setCurrentRowNumber
(
x
+
1
);
...
...
@@ -208,7 +208,7 @@ public class Replace extends Prepared {
}
buff
.
append
(
')'
);
buff
.
append
(
'\n'
);
if
(
list
.
size
()
>
0
)
{
if
(
!
list
.
isEmpty
()
)
{
buff
.
append
(
"VALUES "
);
int
row
=
0
;
for
(
Expression
[]
expr
:
list
)
{
...
...
@@ -236,14 +236,14 @@ public class Replace extends Prepared {
@Override
public
void
prepare
()
{
if
(
columns
==
null
)
{
if
(
list
.
size
()
>
0
&&
list
.
get
(
0
).
length
==
0
)
{
if
(
!
list
.
isEmpty
()
&&
list
.
get
(
0
).
length
==
0
)
{
// special case where table is used as a sequence
columns
=
new
Column
[
0
];
}
else
{
columns
=
table
.
getColumns
();
}
}
if
(
list
.
size
()
>
0
)
{
if
(
!
list
.
isEmpty
()
)
{
for
(
Expression
[]
expr
:
list
)
{
if
(
expr
.
length
!=
columns
.
length
)
{
throw
DbException
.
get
(
ErrorCode
.
COLUMN_COUNT_DOES_NOT_MATCH
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
705e592e
...
...
@@ -1212,7 +1212,7 @@ public class Database implements DataHandler {
trace
.
info
(
"disconnecting session #{0}"
,
session
.
getId
());
}
}
if
(
userSessions
.
size
()
==
0
&&
if
(
userSessions
.
isEmpty
()
&&
session
!=
systemSession
&&
session
!=
lobSession
)
{
if
(
closeDelay
==
0
)
{
close
(
false
);
...
...
@@ -1275,7 +1275,7 @@ public class Database implements DataHandler {
}
closing
=
true
;
stopServer
();
if
(
userSessions
.
size
()
>
0
)
{
if
(
!
userSessions
.
isEmpty
()
)
{
if
(!
fromShutdownHook
)
{
return
;
}
...
...
@@ -1290,7 +1290,7 @@ public class Database implements DataHandler {
// set it to null, to make sure it's called only once
eventListener
=
null
;
e
.
closingDatabase
();
if
(
userSessions
.
size
()
>
0
)
{
if
(
!
userSessions
.
isEmpty
()
)
{
// if a connection was opened, we can't close the database
return
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Engine.java
浏览文件 @
705e592e
...
...
@@ -63,7 +63,7 @@ public class Engine implements SessionFactory {
}
database
=
new
Database
(
ci
,
cipher
);
opened
=
true
;
if
(
database
.
getAllUsers
().
size
()
==
0
)
{
if
(
database
.
getAllUsers
().
isEmpty
()
)
{
// users is the last thing we add, so if no user is around,
// the database is new (or not initialized correctly)
user
=
new
User
(
database
,
database
.
allocateObjectId
(),
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/FunctionAlias.java
浏览文件 @
705e592e
...
...
@@ -163,7 +163,7 @@ public class FunctionAlias extends SchemaObjectBase {
list
.
add
(
javaMethod
);
}
}
if
(
list
.
size
()
==
0
)
{
if
(
list
.
isEmpty
()
)
{
throw
DbException
.
get
(
ErrorCode
.
PUBLIC_STATIC_JAVA_METHOD_NOT_FOUND_1
,
methodName
+
" ("
+
className
+
")"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Session.java
浏览文件 @
705e592e
...
...
@@ -251,7 +251,7 @@ public class Session extends SessionWithState {
}
}
public
String
getParsingCreateViewName
()
{
if
(
viewNameStack
.
size
()
==
0
)
{
if
(
viewNameStack
.
isEmpty
()
)
{
return
null
;
}
return
viewNameStack
.
peek
();
...
...
@@ -652,7 +652,7 @@ public class Session extends SessionWithState {
// increment the data mod count, so that other sessions
// see the changes
// TODO should not rely on locking
if
(
locks
.
size
()
>
0
)
{
if
(
!
locks
.
isEmpty
()
)
{
for
(
int
i
=
0
,
size
=
locks
.
size
();
i
<
size
;
i
++)
{
Table
t
=
locks
.
get
(
i
);
if
(
t
instanceof
MVTable
)
{
...
...
@@ -726,10 +726,10 @@ public class Session extends SessionWithState {
}
temporaryLobs
.
clear
();
}
if
(
temporaryResultLobs
!=
null
&&
temporaryResultLobs
.
size
()
>
0
)
{
if
(
temporaryResultLobs
!=
null
&&
!
temporaryResultLobs
.
isEmpty
()
)
{
long
keepYoungerThan
=
System
.
nanoTime
()
-
TimeUnit
.
MILLISECONDS
.
toNanos
(
database
.
getSettings
().
lobTimeout
);
while
(
temporaryResultLobs
.
size
()
>
0
)
{
while
(
!
temporaryResultLobs
.
isEmpty
()
)
{
TimeoutValue
tv
=
temporaryResultLobs
.
getFirst
();
if
(
onTimeout
&&
tv
.
created
>=
keepYoungerThan
)
{
break
;
...
...
@@ -743,7 +743,7 @@ public class Session extends SessionWithState {
}
private
void
checkCommitRollback
()
{
if
(
commitOrRollbackDisabled
&&
locks
.
size
()
>
0
)
{
if
(
commitOrRollbackDisabled
&&
!
locks
.
isEmpty
()
)
{
throw
DbException
.
get
(
ErrorCode
.
COMMIT_ROLLBACK_NOT_ALLOWED
);
}
}
...
...
@@ -783,7 +783,7 @@ public class Session extends SessionWithState {
transaction
.
commit
();
transaction
=
null
;
}
if
(
locks
.
size
()
>
0
||
needCommit
)
{
if
(
!
locks
.
isEmpty
()
||
needCommit
)
{
database
.
commit
(
this
);
}
cleanTempTables
(
false
);
...
...
@@ -990,7 +990,7 @@ public class Session extends SessionWithState {
DbException
.
throwInternalError
();
}
}
if
(
locks
.
size
()
>
0
)
{
if
(
!
locks
.
isEmpty
()
)
{
// don't use the enhanced for loop to save memory
for
(
int
i
=
0
,
size
=
locks
.
size
();
i
<
size
;
i
++)
{
Table
t
=
locks
.
get
(
i
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/SessionRemote.java
浏览文件 @
705e592e
...
...
@@ -482,7 +482,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
public
void
removeServer
(
IOException
e
,
int
i
,
int
count
)
{
trace
.
debug
(
e
,
"removing server because of exception"
);
transferList
.
remove
(
i
);
if
(
transferList
.
size
()
==
0
&&
autoReconnect
(
count
))
{
if
(
transferList
.
isEmpty
()
&&
autoReconnect
(
count
))
{
return
;
}
checkClosed
();
...
...
@@ -653,7 +653,7 @@ public class SessionRemote extends SessionWithState implements DataHandler {
@Override
public
boolean
isClosed
()
{
return
transferList
==
null
||
transferList
.
size
()
==
0
;
return
transferList
==
null
||
transferList
.
isEmpty
()
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/SessionWithState.java
浏览文件 @
705e592e
...
...
@@ -24,7 +24,7 @@ abstract class SessionWithState implements SessionInterface {
* Re-create the session state using the stored sessionState list.
*/
protected
void
recreateSessionState
()
{
if
(
sessionState
!=
null
&&
sessionState
.
size
()
>
0
)
{
if
(
sessionState
!=
null
&&
!
sessionState
.
isEmpty
()
)
{
sessionStateUpdating
=
true
;
try
{
for
(
String
sql
:
sessionState
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/expression/Aggregate.java
浏览文件 @
705e592e
...
...
@@ -328,7 +328,7 @@ public class Aggregate extends Expression {
Value
v
=
data
.
getValue
(
session
.
getDatabase
(),
dataType
,
distinct
);
if
(
type
==
AggregateType
.
GROUP_CONCAT
)
{
ArrayList
<
Value
>
list
=
((
AggregateDataGroupConcat
)
data
).
getList
();
if
(
list
==
null
||
list
.
size
()
==
0
)
{
if
(
list
==
null
||
list
.
isEmpty
()
)
{
return
ValueNull
.
INSTANCE
;
}
if
(
groupConcatOrderList
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/fulltext/FullText.java
浏览文件 @
705e592e
...
...
@@ -624,7 +624,7 @@ public class FullText {
}
}
}
if
(
rIds
==
null
||
rIds
.
size
()
==
0
)
{
if
(
rIds
==
null
||
rIds
.
isEmpty
()
)
{
return
result
;
}
PreparedStatement
prepSelectRowById
=
setting
.
prepare
(
conn
,
SELECT_ROW_BY_ID
);
...
...
@@ -913,7 +913,7 @@ public class FullText {
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
columnTypes
[
i
]
=
rs
.
getInt
(
"DATA_TYPE"
);
}
if
(
keyList
.
size
()
==
0
)
{
if
(
keyList
.
isEmpty
()
)
{
rs
=
meta
.
getPrimaryKeys
(
null
,
StringUtils
.
escapeMetaDataPattern
(
schemaName
),
tableName
);
...
...
@@ -921,7 +921,7 @@ public class FullText {
keyList
.
add
(
rs
.
getString
(
"COLUMN_NAME"
));
}
}
if
(
keyList
.
size
()
==
0
)
{
if
(
keyList
.
isEmpty
()
)
{
throw
throwException
(
"No primary key for table "
+
tableName
);
}
ArrayList
<
String
>
indexList
=
New
.
arrayList
();
...
...
@@ -938,7 +938,7 @@ public class FullText {
Collections
.
addAll
(
indexList
,
StringUtils
.
arraySplit
(
columns
,
','
,
true
));
}
}
if
(
indexList
.
size
()
==
0
)
{
if
(
indexList
.
isEmpty
()
)
{
indexList
.
addAll
(
columnList
);
}
index
.
keys
=
new
int
[
keyList
.
size
()];
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/fulltext/FullTextLucene.java
浏览文件 @
705e592e
...
...
@@ -505,7 +505,7 @@ public class FullTextLucene extends FullText {
for
(
int
i
=
0
;
rs
.
next
();
i
++)
{
columnTypes
[
i
]
=
rs
.
getInt
(
"DATA_TYPE"
);
}
if
(
keyList
.
size
()
==
0
)
{
if
(
keyList
.
isEmpty
()
)
{
rs
=
meta
.
getPrimaryKeys
(
null
,
StringUtils
.
escapeMetaDataPattern
(
schemaName
),
tableName
);
...
...
@@ -513,7 +513,7 @@ public class FullTextLucene extends FullText {
keyList
.
add
(
rs
.
getString
(
"COLUMN_NAME"
));
}
}
if
(
keyList
.
size
()
==
0
)
{
if
(
keyList
.
isEmpty
()
)
{
throw
throwException
(
"No primary key for table "
+
tableName
);
}
ArrayList
<
String
>
indexList
=
New
.
arrayList
();
...
...
@@ -530,7 +530,7 @@ public class FullTextLucene extends FullText {
StringUtils
.
arraySplit
(
cols
,
','
,
true
));
}
}
if
(
indexList
.
size
()
==
0
)
{
if
(
indexList
.
isEmpty
()
)
{
indexList
.
addAll
(
columnList
);
}
keys
=
new
int
[
keyList
.
size
()];
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/jdbcx/JdbcXAConnection.java
浏览文件 @
705e592e
...
...
@@ -202,7 +202,7 @@ public class JdbcXAConnection extends TraceObject implements XAConnection,
}
rs
.
close
();
Xid
[]
result
=
list
.
toArray
(
new
Xid
[
0
]);
if
(
list
.
size
()
>
0
)
{
if
(
!
list
.
isEmpty
()
)
{
prepared
=
true
;
}
return
result
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/message/Trace.java
浏览文件 @
705e592e
...
...
@@ -241,7 +241,7 @@ public class Trace {
*/
public
static
String
formatParams
(
ArrayList
<?
extends
ParameterInterface
>
parameters
)
{
if
(
parameters
.
size
()
==
0
)
{
if
(
parameters
.
isEmpty
()
)
{
return
""
;
}
StatementBuilder
buff
=
new
StatementBuilder
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/MVStore.java
浏览文件 @
705e592e
...
...
@@ -1479,7 +1479,7 @@ public final class MVStore {
for
(
Chunk
c
:
modified
)
{
meta
.
put
(
Chunk
.
getMetaKey
(
c
.
id
),
c
.
asString
());
}
if
(
modified
.
size
()
==
0
)
{
if
(
modified
.
isEmpty
()
)
{
break
;
}
}
...
...
@@ -1782,7 +1782,7 @@ public final class MVStore {
synchronized
(
this
)
{
old
=
compactGetOldChunks
(
targetFillRate
,
write
);
}
if
(
old
==
null
||
old
.
size
()
==
0
)
{
if
(
old
==
null
||
old
.
isEmpty
()
)
{
return
false
;
}
compactRewrite
(
old
);
...
...
@@ -1838,7 +1838,7 @@ public final class MVStore {
c
.
collectPriority
=
(
int
)
(
c
.
getFillRate
()
*
1000
/
age
);
old
.
add
(
c
);
}
if
(
old
.
size
()
==
0
)
{
if
(
old
.
isEmpty
()
)
{
return
null
;
}
...
...
@@ -2287,7 +2287,7 @@ public final class MVStore {
keep
=
c
;
}
}
if
(
remove
.
size
()
>
0
)
{
if
(
!
remove
.
isEmpty
()
)
{
// remove the youngest first, so we don't create gaps
// (in case we remove many chunks)
Collections
.
sort
(
remove
,
Collections
.
reverseOrder
());
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/db/MVTable.java
浏览文件 @
705e592e
...
...
@@ -610,7 +610,7 @@ public class MVTable extends TableBase {
remaining
--;
}
sortRows
(
buffer
,
index
);
if
(
bufferNames
.
size
()
>
0
)
{
if
(
!
bufferNames
.
isEmpty
()
)
{
String
mapName
=
store
.
nextTemporaryMapName
();
index
.
addRowsToBuffer
(
buffer
,
mapName
);
bufferNames
.
add
(
mapName
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/mvstore/rtree/SpatialDataType.java
浏览文件 @
705e592e
...
...
@@ -305,7 +305,7 @@ public class SpatialDataType implements DataType {
*/
public
int
[]
getExtremes
(
ArrayList
<
Object
>
list
)
{
list
=
getNotNull
(
list
);
if
(
list
.
size
()
==
0
)
{
if
(
list
.
isEmpty
()
)
{
return
null
;
}
SpatialKey
bounds
=
(
SpatialKey
)
createBoundingBox
(
list
.
get
(
0
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/result/UpdatableRow.java
浏览文件 @
705e592e
...
...
@@ -118,7 +118,7 @@ public class UpdatableRow {
}
private
boolean
isIndexUsable
(
ArrayList
<
String
>
indexColumns
)
{
if
(
indexColumns
.
size
()
==
0
)
{
if
(
indexColumns
.
isEmpty
()
)
{
return
false
;
}
for
(
String
c
:
indexColumns
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/security/CipherFactory.java
浏览文件 @
705e592e
...
...
@@ -182,7 +182,7 @@ public class CipherFactory {
boolean
ecdhAnonRemoved
=
algorithms
.
remove
(
"ECDH_anon"
);
if
(
dhAnonRemoved
||
ecdhAnonRemoved
)
{
String
string
=
Arrays
.
toString
(
algorithms
.
toArray
(
new
String
[
algorithms
.
size
()]));
return
(
algorithms
.
size
()
>
0
)
?
string
.
substring
(
1
,
string
.
length
()
-
1
):
""
;
return
(
!
algorithms
.
isEmpty
()
)
?
string
.
substring
(
1
,
string
.
length
()
-
1
):
""
;
}
return
list
;
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
705e592e
...
...
@@ -886,7 +886,7 @@ public class PgServerThread implements Runnable {
}
stat
.
execute
(
"set search_path = PUBLIC, pg_catalog"
);
HashSet
<
Integer
>
typeSet
=
server
.
getTypeSet
();
if
(
typeSet
.
size
()
==
0
)
{
if
(
typeSet
.
isEmpty
()
)
{
try
(
ResultSet
rs
=
stat
.
executeQuery
(
"select oid from pg_catalog.pg_type"
))
{
while
(
rs
.
next
())
{
typeSet
.
add
(
rs
.
getInt
(
1
));
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/PageParser.java
浏览文件 @
705e592e
...
...
@@ -98,7 +98,7 @@ public class PageParser {
result
.
append
(
"?items?"
);
list
=
New
.
arrayList
();
}
if
(
list
.
size
()
==
0
)
{
if
(
list
.
isEmpty
()
)
{
parseBlockUntil
(
"</c:forEach>"
);
}
for
(
Object
o
:
list
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebApp.java
浏览文件 @
705e592e
...
...
@@ -1869,7 +1869,7 @@ public class WebApp {
String
setting
=
attributes
.
getProperty
(
"name"
,
""
);
server
.
removeSetting
(
setting
);
ArrayList
<
ConnectionInfo
>
settings
=
server
.
getSettings
();
if
(
settings
.
size
()
>
0
)
{
if
(
!
settings
.
isEmpty
()
)
{
attributes
.
put
(
"setting"
,
settings
.
get
(
0
));
}
server
.
saveProperties
(
null
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/web/WebSession.java
浏览文件 @
705e592e
...
...
@@ -206,7 +206,7 @@ class WebSession {
"${text.admin.notConnected}"
:
conn
.
getMetaData
().
getURL
());
m
.
put
(
"user"
,
conn
==
null
?
"-"
:
conn
.
getMetaData
().
getUserName
());
m
.
put
(
"lastQuery"
,
commandHistory
.
size
()
==
0
?
m
.
put
(
"lastQuery"
,
commandHistory
.
isEmpty
()
?
""
:
commandHistory
.
get
(
0
));
m
.
put
(
"executing"
,
executingStatement
==
null
?
"${text.admin.no}"
:
"${text.admin.yes}"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/PageStore.java
浏览文件 @
705e592e
...
...
@@ -1407,7 +1407,7 @@ public class PageStore implements CacheWriter {
isEmpty
&=
log
.
recover
(
PageLog
.
RECOVERY_STAGE_REDO
);
boolean
setReadOnly
=
false
;
if
(!
database
.
isReadOnly
())
{
if
(
log
.
getInDoubtTransactions
().
size
()
==
0
)
{
if
(
log
.
getInDoubtTransactions
().
isEmpty
()
)
{
log
.
recoverEnd
();
int
firstUncommittedSection
=
getFirstUncommittedSection
();
log
.
removeUntil
(
firstUncommittedSection
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/RegularTable.java
浏览文件 @
705e592e
...
...
@@ -671,7 +671,7 @@ public class RegularTable extends TableBase {
lockExclusiveSession
=
null
;
}
synchronized
(
database
)
{
if
(
lockSharedSessions
.
size
()
>
0
)
{
if
(
!
lockSharedSessions
.
isEmpty
()
)
{
lockSharedSessions
.
remove
(
s
);
}
if
(!
waitingSessions
.
isEmpty
())
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/Table.java
浏览文件 @
705e592e
...
...
@@ -529,20 +529,20 @@ public abstract class Table extends SchemaObjectBase {
@Override
public
void
removeChildrenAndResources
(
Session
session
)
{
while
(
dependentViews
.
size
()
>
0
)
{
while
(
!
dependentViews
.
isEmpty
()
)
{
TableView
view
=
dependentViews
.
get
(
0
);
dependentViews
.
remove
(
0
);
database
.
removeSchemaObject
(
session
,
view
);
}
while
(
synonyms
!=
null
&&
synonyms
.
size
()
>
0
)
{
while
(
synonyms
!=
null
&&
!
synonyms
.
isEmpty
()
)
{
TableSynonym
synonym
=
synonyms
.
remove
(
0
);
database
.
removeSchemaObject
(
session
,
synonym
);
}
while
(
triggers
!=
null
&&
triggers
.
size
()
>
0
)
{
while
(
triggers
!=
null
&&
!
triggers
.
isEmpty
()
)
{
TriggerObject
trigger
=
triggers
.
remove
(
0
);
database
.
removeSchemaObject
(
session
,
trigger
);
}
while
(
constraints
!=
null
&&
constraints
.
size
()
>
0
)
{
while
(
constraints
!=
null
&&
!
constraints
.
isEmpty
()
)
{
Constraint
constraint
=
constraints
.
remove
(
0
);
database
.
removeSchemaObject
(
session
,
constraint
);
}
...
...
@@ -554,7 +554,7 @@ public abstract class Table extends SchemaObjectBase {
database
.
removeMeta
(
session
,
getId
());
// must delete sequences later (in case there is a power failure
// before removing the table object)
while
(
sequences
!=
null
&&
sequences
.
size
()
>
0
)
{
while
(
sequences
!=
null
&&
!
sequences
.
isEmpty
()
)
{
Sequence
sequence
=
sequences
.
remove
(
0
);
// only remove if no other table depends on this sequence
// this is possible when calling ALTER TABLE ALTER COLUMN
...
...
@@ -975,8 +975,8 @@ public abstract class Table extends SchemaObjectBase {
* @return if there are any triggers or rows defined
*/
public
boolean
fireRow
()
{
return
(
constraints
!=
null
&&
constraints
.
size
()
>
0
)
||
(
triggers
!=
null
&&
triggers
.
size
()
>
0
);
return
(
constraints
!=
null
&&
!
constraints
.
isEmpty
()
)
||
(
triggers
!=
null
&&
!
triggers
.
isEmpty
()
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableFilter.java
浏览文件 @
705e592e
...
...
@@ -197,7 +197,7 @@ public class TableFilter implements ColumnResolver {
if
(
select
!=
null
)
{
sortOrder
=
select
.
getSortOrder
();
}
if
(
indexConditions
.
size
()
==
0
)
{
if
(
indexConditions
.
isEmpty
()
)
{
item1
=
new
PlanItem
();
item1
.
setIndex
(
table
.
getScanIndex
(
s
,
null
,
filters
,
filter
,
sortOrder
,
allColumnsSet
));
...
...
@@ -854,7 +854,7 @@ public class TableFilter implements ColumnResolver {
}
}
planBuff
.
append
(
index
.
getPlanSQL
());
if
(
indexConditions
.
size
()
>
0
)
{
if
(
!
indexConditions
.
isEmpty
()
)
{
planBuff
.
append
(
": "
);
for
(
IndexCondition
condition
:
indexConditions
)
{
planBuff
.
appendExceptFirst
(
"\n AND "
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
705e592e
...
...
@@ -173,7 +173,7 @@ public class TableLink extends Table {
try
(
Statement
stat
=
conn
.
getConnection
().
createStatement
())
{
rs
=
stat
.
executeQuery
(
"SELECT * FROM "
+
qualifiedTableName
+
" T WHERE 1=0"
);
if
(
columnList
.
size
()
==
0
)
{
if
(
columnList
.
isEmpty
()
)
{
// alternative solution
ResultSetMetaData
rsMeta
=
rs
.
getMetaData
();
for
(
i
=
0
;
i
<
rsMeta
.
getColumnCount
();)
{
...
...
@@ -501,7 +501,7 @@ public class TableLink extends Table {
if
(
trace
.
isDebugEnabled
())
{
StatementBuilder
buff
=
new
StatementBuilder
();
buff
.
append
(
getName
()).
append
(
":\n"
).
append
(
sql
);
if
(
params
!=
null
&&
params
.
size
()
>
0
)
{
if
(
params
!=
null
&&
!
params
.
isEmpty
()
)
{
buff
.
append
(
" {"
);
int
i
=
1
;
for
(
Value
v
:
params
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Backup.java
浏览文件 @
705e592e
...
...
@@ -114,7 +114,7 @@ public class Backup extends Tool {
}
else
{
list
=
FileLister
.
getDatabaseFiles
(
directory
,
db
,
true
);
}
if
(
list
.
size
()
==
0
)
{
if
(
list
.
isEmpty
()
)
{
if
(!
quiet
)
{
printNoDatabaseFilesFound
(
directory
,
db
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/ChangeFileEncryption.java
浏览文件 @
705e592e
...
...
@@ -170,7 +170,7 @@ public class ChangeFileEncryption extends Tool {
ArrayList
<
String
>
files
=
FileLister
.
getDatabaseFiles
(
dir
,
db
,
true
);
FileLister
.
tryUnlockDatabase
(
files
,
"encryption"
);
files
=
FileLister
.
getDatabaseFiles
(
dir
,
db
,
false
);
if
(
files
.
size
()
==
0
&&
!
quiet
)
{
if
(
files
.
isEmpty
()
&&
!
quiet
)
{
printNoDatabaseFilesFound
(
dir
,
db
);
}
// first, test only if the file can be renamed
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Csv.java
浏览文件 @
705e592e
...
...
@@ -343,7 +343,7 @@ public class Csv implements SimpleRowSource {
String
v
=
readValue
();
if
(
v
==
null
)
{
if
(
endOfLine
)
{
if
(
endOfFile
||
list
.
size
()
>
0
)
{
if
(
endOfFile
||
!
list
.
isEmpty
()
)
{
break
;
}
}
else
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/DeleteDbFiles.java
浏览文件 @
705e592e
...
...
@@ -84,7 +84,7 @@ public class DeleteDbFiles extends Tool {
*/
private
void
process
(
String
dir
,
String
db
,
boolean
quiet
)
{
ArrayList
<
String
>
files
=
FileLister
.
getDatabaseFiles
(
dir
,
db
,
true
);
if
(
files
.
size
()
==
0
&&
!
quiet
)
{
if
(
files
.
isEmpty
()
&&
!
quiet
)
{
printNoDatabaseFilesFound
(
dir
,
db
);
}
for
(
String
fileName
:
files
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
705e592e
...
...
@@ -330,7 +330,7 @@ public class Recover extends Tool implements DataHandler {
private
void
process
(
String
dir
,
String
db
)
{
ArrayList
<
String
>
list
=
FileLister
.
getDatabaseFiles
(
dir
,
db
,
true
);
if
(
list
.
size
()
==
0
)
{
if
(
list
.
isEmpty
()
)
{
printNoDatabaseFilesFound
(
dir
,
db
);
}
for
(
String
fileName
:
list
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Shell.java
浏览文件 @
705e592e
...
...
@@ -243,7 +243,7 @@ public class Shell extends Tool implements Runnable {
s
=
s
.
replace
(
'\n'
,
' '
).
replace
(
'\r'
,
' '
);
println
(
"#"
+
(
1
+
i
)
+
": "
+
s
);
}
if
(
history
.
size
()
>
0
)
{
if
(
!
history
.
isEmpty
()
)
{
println
(
"To re-run a statement, type the number and press and enter"
);
}
else
{
println
(
"No history"
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/SimpleResultSet.java
浏览文件 @
705e592e
...
...
@@ -116,7 +116,7 @@ public class SimpleResultSet implements ResultSet, ResultSetMetaData,
*/
public
void
addColumn
(
String
name
,
int
sqlType
,
String
sqlTypeName
,
int
precision
,
int
scale
)
{
if
(
rows
!=
null
&&
rows
.
size
()
>
0
)
{
if
(
rows
!=
null
&&
!
rows
.
isEmpty
()
)
{
throw
new
IllegalStateException
(
"Cannot add a column after adding rows"
);
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/AbbaDetector.java
浏览文件 @
705e592e
...
...
@@ -71,7 +71,7 @@ public class AbbaDetector {
System
.
out
.
println
(
thread
+
" "
+
indent
+
"sync "
+
getObjectName
(
o
));
}
if
(
stack
.
size
()
>
0
)
{
if
(
!
stack
.
isEmpty
()
)
{
markHigher
(
o
,
stack
);
}
stack
.
push
(
o
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/CacheLRU.java
浏览文件 @
705e592e
...
...
@@ -163,7 +163,7 @@ public class CacheLRU implements Cache {
if
(
rc
<=
Constants
.
CACHE_MIN_RECORDS
)
{
break
;
}
if
(
changed
.
size
()
==
0
)
{
if
(
changed
.
isEmpty
()
)
{
if
(
mem
<=
maxMemory
)
{
break
;
}
...
...
@@ -209,7 +209,7 @@ public class CacheLRU implements Cache {
remove
(
check
.
getPos
());
}
}
if
(
changed
.
size
()
>
0
)
{
if
(
!
changed
.
isEmpty
()
)
{
if
(!
flushed
)
{
writer
.
flushLog
();
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/Profiler.java
浏览文件 @
705e592e
...
...
@@ -253,7 +253,7 @@ public class Profiler implements Runnable {
line
=
line
.
substring
(
3
).
trim
();
stack
.
add
(
line
);
}
if
(
stack
.
size
()
>
0
)
{
if
(
!
stack
.
isEmpty
()
)
{
String
[]
s
=
stack
.
toArray
(
new
String
[
0
]);
list
.
add
(
s
);
}
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论