Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
65d807b0
提交
65d807b0
authored
7 年前
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use Objects.equals() instead of StringUtils.equals()
上级
5a5fa72f
显示空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
20 行增加
和
28 行删除
+20
-28
Sentence.java
h2/src/main/org/h2/bnf/Sentence.java
+2
-1
Database.java
h2/src/main/org/h2/engine/Database.java
+2
-1
Engine.java
h2/src/main/org/h2/engine/Engine.java
+3
-2
TcpServerThread.java
h2/src/main/org/h2/server/TcpServerThread.java
+3
-2
TableLink.java
h2/src/main/org/h2/table/TableLink.java
+4
-2
TableLinkConnection.java
h2/src/main/org/h2/table/TableLinkConnection.java
+4
-5
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+0
-14
CompareMode.java
h2/src/main/org/h2/value/CompareMode.java
+2
-1
没有找到文件。
h2/src/main/org/h2/bnf/Sentence.java
浏览文件 @
65d807b0
...
@@ -7,6 +7,7 @@ package org.h2.bnf;
...
@@ -7,6 +7,7 @@ package org.h2.bnf;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Objects
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
org.h2.bnf.context.DbSchema
;
import
org.h2.bnf.context.DbSchema
;
...
@@ -186,7 +187,7 @@ public class Sentence {
...
@@ -186,7 +187,7 @@ public class Sentence {
* @param query the query string
* @param query the query string
*/
*/
public
void
setQuery
(
String
query
)
{
public
void
setQuery
(
String
query
)
{
if
(!
StringUtil
s
.
equals
(
this
.
query
,
query
))
{
if
(!
Object
s
.
equals
(
this
.
query
,
query
))
{
this
.
query
=
query
;
this
.
query
=
query
;
this
.
queryUpper
=
StringUtils
.
toUpperEnglish
(
query
);
this
.
queryUpper
=
StringUtils
.
toUpperEnglish
(
query
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
65d807b0
...
@@ -11,6 +11,7 @@ import java.util.ArrayList;
...
@@ -11,6 +11,7 @@ import java.util.ArrayList;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.Objects
;
import
java.util.Properties
;
import
java.util.Properties
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.StringTokenizer
;
import
java.util.StringTokenizer
;
...
@@ -579,7 +580,7 @@ public class Database implements DataHandler {
...
@@ -579,7 +580,7 @@ public class Database implements DataHandler {
* @return true if the cipher algorithm and the password match
* @return true if the cipher algorithm and the password match
*/
*/
boolean
validateFilePasswordHash
(
String
testCipher
,
byte
[]
testHash
)
{
boolean
validateFilePasswordHash
(
String
testCipher
,
byte
[]
testHash
)
{
if
(!
StringUtil
s
.
equals
(
testCipher
,
this
.
cipher
))
{
if
(!
Object
s
.
equals
(
testCipher
,
this
.
cipher
))
{
return
false
;
return
false
;
}
}
return
Utils
.
compareSecure
(
testHash
,
filePasswordHash
);
return
Utils
.
compareSecure
(
testHash
,
filePasswordHash
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Engine.java
浏览文件 @
65d807b0
...
@@ -6,6 +6,8 @@
...
@@ -6,6 +6,8 @@
package
org
.
h2
.
engine
;
package
org
.
h2
.
engine
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Objects
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.CommandInterface
;
import
org.h2.command.CommandInterface
;
import
org.h2.command.Parser
;
import
org.h2.command.Parser
;
...
@@ -15,7 +17,6 @@ import org.h2.message.Trace;
...
@@ -15,7 +17,6 @@ import org.h2.message.Trace;
import
org.h2.store.FileLock
;
import
org.h2.store.FileLock
;
import
org.h2.util.MathUtils
;
import
org.h2.util.MathUtils
;
import
org.h2.util.New
;
import
org.h2.util.New
;
import
org.h2.util.StringUtils
;
import
org.h2.util.ThreadDeadlockDetector
;
import
org.h2.util.ThreadDeadlockDetector
;
import
org.h2.util.Utils
;
import
org.h2.util.Utils
;
...
@@ -245,7 +246,7 @@ public class Engine implements SessionFactory {
...
@@ -245,7 +246,7 @@ public class Engine implements SessionFactory {
String
clusterDb
=
database
.
getCluster
();
String
clusterDb
=
database
.
getCluster
();
if
(!
Constants
.
CLUSTERING_DISABLED
.
equals
(
clusterDb
))
{
if
(!
Constants
.
CLUSTERING_DISABLED
.
equals
(
clusterDb
))
{
if
(!
Constants
.
CLUSTERING_ENABLED
.
equals
(
clusterSession
))
{
if
(!
Constants
.
CLUSTERING_ENABLED
.
equals
(
clusterSession
))
{
if
(!
StringUtil
s
.
equals
(
clusterSession
,
clusterDb
))
{
if
(!
Object
s
.
equals
(
clusterSession
,
clusterDb
))
{
if
(
clusterDb
.
equals
(
Constants
.
CLUSTERING_DISABLED
))
{
if
(
clusterDb
.
equals
(
Constants
.
CLUSTERING_DISABLED
))
{
throw
DbException
.
get
(
throw
DbException
.
get
(
ErrorCode
.
CLUSTER_ERROR_DATABASE_RUNS_ALONE
);
ErrorCode
.
CLUSTER_ERROR_DATABASE_RUNS_ALONE
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/server/TcpServerThread.java
浏览文件 @
65d807b0
...
@@ -14,6 +14,8 @@ import java.io.StringWriter;
...
@@ -14,6 +14,8 @@ import java.io.StringWriter;
import
java.net.Socket
;
import
java.net.Socket
;
import
java.sql.SQLException
;
import
java.sql.SQLException
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Objects
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.Command
;
import
org.h2.command.Command
;
import
org.h2.engine.ConnectionInfo
;
import
org.h2.engine.ConnectionInfo
;
...
@@ -33,7 +35,6 @@ import org.h2.store.LobStorageInterface;
...
@@ -33,7 +35,6 @@ import org.h2.store.LobStorageInterface;
import
org.h2.util.IOUtils
;
import
org.h2.util.IOUtils
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.SmallLRUCache
;
import
org.h2.util.SmallMap
;
import
org.h2.util.SmallMap
;
import
org.h2.util.StringUtils
;
import
org.h2.value.Transfer
;
import
org.h2.value.Transfer
;
import
org.h2.value.Value
;
import
org.h2.value.Value
;
import
org.h2.value.ValueLobDb
;
import
org.h2.value.ValueLobDb
;
...
@@ -540,7 +541,7 @@ public class TcpServerThread implements Runnable {
...
@@ -540,7 +541,7 @@ public class TcpServerThread implements Runnable {
* @param statementId the statement to cancel
* @param statementId the statement to cancel
*/
*/
void
cancelStatement
(
String
targetSessionId
,
int
statementId
)
{
void
cancelStatement
(
String
targetSessionId
,
int
statementId
)
{
if
(
StringUtil
s
.
equals
(
targetSessionId
,
this
.
sessionId
))
{
if
(
Object
s
.
equals
(
targetSessionId
,
this
.
sessionId
))
{
Command
cmd
=
(
Command
)
cache
.
getObject
(
statementId
,
false
);
Command
cmd
=
(
Command
)
cache
.
getObject
(
statementId
,
false
);
cmd
.
cancel
();
cmd
.
cancel
();
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableLink.java
浏览文件 @
65d807b0
...
@@ -15,6 +15,8 @@ import java.sql.Types;
...
@@ -15,6 +15,8 @@ import java.sql.Types;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
org.h2.api.ErrorCode
;
import
org.h2.api.ErrorCode
;
import
org.h2.command.Prepared
;
import
org.h2.command.Prepared
;
import
org.h2.engine.Session
;
import
org.h2.engine.Session
;
...
@@ -137,8 +139,8 @@ public class TableLink extends Table {
...
@@ -137,8 +139,8 @@ public class TableLink extends Table {
if
(
schema
==
null
)
{
if
(
schema
==
null
)
{
schema
=
thisSchema
;
schema
=
thisSchema
;
}
}
if
(!
StringUtil
s
.
equals
(
catalog
,
thisCatalog
)
||
if
(!
Object
s
.
equals
(
catalog
,
thisCatalog
)
||
!
StringUtil
s
.
equals
(
schema
,
thisSchema
))
{
!
Object
s
.
equals
(
schema
,
thisSchema
))
{
// if the table exists in multiple schemas or tables,
// if the table exists in multiple schemas or tables,
// use the alternative solution
// use the alternative solution
columnMap
.
clear
();
columnMap
.
clear
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/table/TableLinkConnection.java
浏览文件 @
65d807b0
...
@@ -11,7 +11,6 @@ import java.util.HashMap;
...
@@ -11,7 +11,6 @@ import java.util.HashMap;
import
java.util.Objects
;
import
java.util.Objects
;
import
org.h2.message.DbException
;
import
org.h2.message.DbException
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.JdbcUtils
;
import
org.h2.util.StringUtils
;
/**
/**
* A connection for a linked table. The same connection may be used for multiple
* A connection for a linked table. The same connection may be used for multiple
...
@@ -105,10 +104,10 @@ public class TableLinkConnection {
...
@@ -105,10 +104,10 @@ public class TableLinkConnection {
public
boolean
equals
(
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
o
instanceof
TableLinkConnection
)
{
if
(
o
instanceof
TableLinkConnection
)
{
TableLinkConnection
other
=
(
TableLinkConnection
)
o
;
TableLinkConnection
other
=
(
TableLinkConnection
)
o
;
return
StringUtil
s
.
equals
(
driver
,
other
.
driver
)
return
Object
s
.
equals
(
driver
,
other
.
driver
)
&&
StringUtil
s
.
equals
(
url
,
other
.
url
)
&&
Object
s
.
equals
(
url
,
other
.
url
)
&&
StringUtil
s
.
equals
(
user
,
other
.
user
)
&&
Object
s
.
equals
(
user
,
other
.
user
)
&&
StringUtil
s
.
equals
(
password
,
other
.
password
);
&&
Object
s
.
equals
(
password
,
other
.
password
);
}
}
return
false
;
return
false
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
65d807b0
...
@@ -76,20 +76,6 @@ public class StringUtils {
...
@@ -76,20 +76,6 @@ public class StringUtils {
}
}
}
}
/**
* Check if two strings are equal. Here, null is equal to null.
*
* @param a the first value
* @param b the second value
* @return true if both are null or both are equal
*/
public
static
boolean
equals
(
String
a
,
String
b
)
{
if
(
a
==
null
)
{
return
b
==
null
;
}
return
a
.
equals
(
b
);
}
/**
/**
* Convert a string to uppercase using the English locale.
* Convert a string to uppercase using the English locale.
*
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/CompareMode.java
浏览文件 @
65d807b0
...
@@ -8,6 +8,7 @@ package org.h2.value;
...
@@ -8,6 +8,7 @@ package org.h2.value;
import
java.nio.charset.Charset
;
import
java.nio.charset.Charset
;
import
java.text.Collator
;
import
java.text.Collator
;
import
java.util.Locale
;
import
java.util.Locale
;
import
java.util.Objects
;
import
org.h2.engine.SysProperties
;
import
org.h2.engine.SysProperties
;
import
org.h2.util.StringUtils
;
import
org.h2.util.StringUtils
;
...
@@ -111,7 +112,7 @@ public class CompareMode {
...
@@ -111,7 +112,7 @@ public class CompareMode {
public
static
CompareMode
getInstance
(
String
name
,
int
strength
,
boolean
binaryUnsigned
)
{
public
static
CompareMode
getInstance
(
String
name
,
int
strength
,
boolean
binaryUnsigned
)
{
CompareMode
last
=
lastUsed
;
CompareMode
last
=
lastUsed
;
if
(
last
!=
null
)
{
if
(
last
!=
null
)
{
if
(
StringUtil
s
.
equals
(
last
.
name
,
name
)
&&
if
(
Object
s
.
equals
(
last
.
name
,
name
)
&&
last
.
strength
==
strength
&&
last
.
strength
==
strength
&&
last
.
binaryUnsigned
==
binaryUnsigned
)
{
last
.
binaryUnsigned
==
binaryUnsigned
)
{
return
last
;
return
last
;
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论