Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
027787d0
提交
027787d0
authored
11月 08, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Use String.isEmpty() in some places
上级
46b7cd0f
显示空白字符变更
内嵌
并排
正在显示
27 个修改的文件
包含
72 行增加
和
65 行删除
+72
-65
CreateUser.java
h2/src/main/org/h2/command/ddl/CreateUser.java
+1
-1
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+4
-4
Database.java
h2/src/main/org/h2/engine/Database.java
+2
-2
CompareLike.java
h2/src/main/org/h2/expression/CompareLike.java
+1
-1
Function.java
h2/src/main/org/h2/expression/Function.java
+4
-6
JdbcDatabaseMetaData.java
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
+2
-2
PgServerThread.java
h2/src/main/org/h2/server/pg/PgServerThread.java
+1
-1
PageParser.java
h2/src/main/org/h2/server/web/PageParser.java
+8
-6
WebSession.java
h2/src/main/org/h2/server/web/WebSession.java
+1
-1
FilePathZip.java
h2/src/main/org/h2/store/fs/FilePathZip.java
+2
-2
Backup.java
h2/src/main/org/h2/tools/Backup.java
+1
-1
Csv.java
h2/src/main/org/h2/tools/Csv.java
+4
-4
RunScript.java
h2/src/main/org/h2/tools/RunScript.java
+1
-1
Shell.java
h2/src/main/org/h2/tools/Shell.java
+3
-3
NetUtils.java
h2/src/main/org/h2/util/NetUtils.java
+1
-1
ParserUtil.java
h2/src/main/org/h2/util/ParserUtil.java
+7
-5
StringUtils.java
h2/src/main/org/h2/util/StringUtils.java
+4
-4
ToChar.java
h2/src/main/org/h2/util/ToChar.java
+4
-3
ToDateParser.java
h2/src/main/org/h2/util/ToDateParser.java
+1
-1
ToDateTokenizer.java
h2/src/main/org/h2/util/ToDateTokenizer.java
+1
-1
CompareMode.java
h2/src/main/org/h2/value/CompareMode.java
+3
-2
CompareModeIcu4J.java
h2/src/main/org/h2/value/CompareModeIcu4J.java
+3
-2
ExtTypeInfoEnum.java
h2/src/main/org/h2/value/ExtTypeInfoEnum.java
+1
-1
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+1
-1
ValueLobDb.java
h2/src/main/org/h2/value/ValueLobDb.java
+1
-1
ValueStringFixed.java
h2/src/main/org/h2/value/ValueStringFixed.java
+7
-6
ValueStringIgnoreCase.java
h2/src/main/org/h2/value/ValueStringIgnoreCase.java
+3
-2
没有找到文件。
h2/src/main/org/h2/command/ddl/CreateUser.java
浏览文件 @
027787d0
...
...
@@ -74,7 +74,7 @@ public class CreateUser extends DefineCommand {
char
[]
passwordChars
=
pwd
==
null
?
new
char
[
0
]
:
pwd
.
toCharArray
();
byte
[]
userPasswordHash
;
String
userName
=
user
.
getName
();
if
(
userName
.
length
()
==
0
&&
passwordChars
.
length
==
0
)
{
if
(
userName
.
isEmpty
()
&&
passwordChars
.
length
==
0
)
{
userPasswordHash
=
new
byte
[
0
];
}
else
{
userPasswordHash
=
SHA256
.
getKeyPasswordHash
(
userName
,
passwordChars
);
...
...
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
027787d0
...
...
@@ -252,7 +252,7 @@ public class ConnectionInfo implements Cloneable {
url
=
url
.
substring
(
0
,
idx
);
String
[]
list
=
StringUtils
.
arraySplit
(
settings
,
';'
,
false
);
for
(
String
setting
:
list
)
{
if
(
setting
.
length
()
==
0
)
{
if
(
setting
.
isEmpty
()
)
{
continue
;
}
int
equal
=
setting
.
indexOf
(
'='
);
...
...
@@ -326,7 +326,7 @@ public class ConnectionInfo implements Cloneable {
if
(
passwordHash
)
{
return
StringUtils
.
convertHexToBytes
(
new
String
(
password
));
}
if
(
userName
.
length
()
==
0
&&
password
.
length
==
0
)
{
if
(
userName
.
isEmpty
()
&&
password
.
length
==
0
)
{
return
new
byte
[
0
];
}
return
SHA256
.
getKeyPasswordHash
(
userName
,
password
);
...
...
@@ -643,7 +643,7 @@ public class ConnectionInfo implements Cloneable {
private
static
String
remapURL
(
String
url
)
{
String
urlMap
=
SysProperties
.
URL_MAP
;
if
(
urlMap
!=
null
&&
urlMap
.
length
()
>
0
)
{
if
(
urlMap
!=
null
&&
!
urlMap
.
isEmpty
()
)
{
try
{
SortedProperties
prop
;
prop
=
SortedProperties
.
loadProperties
(
urlMap
);
...
...
@@ -653,7 +653,7 @@ public class ConnectionInfo implements Cloneable {
prop
.
store
(
urlMap
);
}
else
{
url2
=
url2
.
trim
();
if
(
url2
.
length
()
>
0
)
{
if
(
!
url2
.
isEmpty
()
)
{
return
url2
;
}
}
...
...
h2/src/main/org/h2/engine/Database.java
浏览文件 @
027787d0
...
...
@@ -642,7 +642,7 @@ public class Database implements DataHandler {
n
=
tokenizer
.
nextToken
();
}
}
if
(
n
==
null
||
n
.
length
()
==
0
)
{
if
(
n
==
null
||
n
.
isEmpty
()
)
{
n
=
"unnamed"
;
}
return
dbSettings
.
databaseToUpper
?
StringUtils
.
toUpperEnglish
(
n
)
:
n
;
...
...
@@ -2274,7 +2274,7 @@ public class Database implements DataHandler {
}
public
void
setEventListenerClass
(
String
className
)
{
if
(
className
==
null
||
className
.
length
()
==
0
)
{
if
(
className
==
null
||
className
.
isEmpty
()
)
{
eventListener
=
null
;
}
else
{
try
{
...
...
h2/src/main/org/h2/expression/CompareLike.java
浏览文件 @
027787d0
...
...
@@ -72,7 +72,7 @@ public class CompareLike extends Condition {
}
private
static
Character
getEscapeChar
(
String
s
)
{
return
s
==
null
||
s
.
length
()
==
0
?
null
:
s
.
charAt
(
0
);
return
s
==
null
||
s
.
isEmpty
()
?
null
:
s
.
charAt
(
0
);
}
@Override
...
...
h2/src/main/org/h2/expression/Function.java
浏览文件 @
027787d0
...
...
@@ -681,7 +681,7 @@ public class Function extends Expression implements FunctionCall {
// string
case
ASCII:
{
String
s
=
v0
.
getString
();
if
(
s
.
length
()
==
0
)
{
if
(
s
.
isEmpty
()
)
{
result
=
ValueNull
.
INSTANCE
;
}
else
{
result
=
ValueInt
.
get
(
s
.
charAt
(
0
));
...
...
@@ -2710,19 +2710,17 @@ public class Function extends Expression implements FunctionCall {
String
fieldDelimiter
,
String
escapeCharacter
)
{
if
(
fieldSeparator
!=
null
)
{
csv
.
setFieldSeparatorWrite
(
fieldSeparator
);
if
(
fieldSeparator
.
length
()
>
0
)
{
if
(
!
fieldSeparator
.
isEmpty
()
)
{
char
fs
=
fieldSeparator
.
charAt
(
0
);
csv
.
setFieldSeparatorRead
(
fs
);
}
}
if
(
fieldDelimiter
!=
null
)
{
char
fd
=
fieldDelimiter
.
length
()
==
0
?
0
:
fieldDelimiter
.
charAt
(
0
);
char
fd
=
fieldDelimiter
.
isEmpty
()
?
0
:
fieldDelimiter
.
charAt
(
0
);
csv
.
setFieldDelimiter
(
fd
);
}
if
(
escapeCharacter
!=
null
)
{
char
ec
=
escapeCharacter
.
length
()
==
0
?
0
:
escapeCharacter
.
charAt
(
0
);
char
ec
=
escapeCharacter
.
isEmpty
()
?
0
:
escapeCharacter
.
charAt
(
0
);
csv
.
setEscapeCharacter
(
ec
);
}
}
...
...
h2/src/main/org/h2/jdbc/JdbcDatabaseMetaData.java
浏览文件 @
027787d0
...
...
@@ -3093,14 +3093,14 @@ public class JdbcDatabaseMetaData extends TraceObject implements
}
private
static
String
getSchemaPattern
(
String
pattern
)
{
return
pattern
==
null
?
"%"
:
pattern
.
length
()
==
0
?
return
pattern
==
null
?
"%"
:
pattern
.
isEmpty
()
?
Constants
.
SCHEMA_MAIN
:
pattern
;
}
private
static
String
getCatalogPattern
(
String
catalogPattern
)
{
// Workaround for OpenOffice: getColumns is called with "" as the
// catalog
return
catalogPattern
==
null
||
catalogPattern
.
length
()
==
0
?
return
catalogPattern
==
null
||
catalogPattern
.
isEmpty
()
?
"%"
:
catalogPattern
;
}
...
...
h2/src/main/org/h2/server/pg/PgServerThread.java
浏览文件 @
027787d0
...
...
@@ -180,7 +180,7 @@ public class PgServerThread implements Runnable {
" ("
+
(
version
>>
16
)
+
"."
+
(
version
&
0xff
)
+
")"
);
while
(
true
)
{
String
param
=
readString
();
if
(
param
.
length
()
==
0
)
{
if
(
param
.
isEmpty
()
)
{
break
;
}
String
value
=
readString
();
...
...
h2/src/main/org/h2/server/web/PageParser.java
浏览文件 @
027787d0
...
...
@@ -240,14 +240,15 @@ public class PageParser {
if
(
s
==
null
)
{
return
null
;
}
int
length
=
s
.
length
();
if
(
convertBreakAndSpace
)
{
if
(
s
.
length
()
==
0
)
{
if
(
length
==
0
)
{
return
" "
;
}
}
StringBuilder
buff
=
new
StringBuilder
(
s
.
length
()
);
StringBuilder
buff
=
new
StringBuilder
(
length
);
boolean
convertSpace
=
true
;
for
(
int
i
=
0
;
i
<
s
.
length
()
;
i
++)
{
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
if
(
c
==
' '
||
c
==
'\t'
)
{
// convert tabs into spaces
...
...
@@ -312,11 +313,12 @@ public class PageParser {
if
(
s
==
null
)
{
return
null
;
}
if
(
s
.
length
()
==
0
)
{
int
length
=
s
.
length
();
if
(
length
==
0
)
{
return
""
;
}
StringBuilder
buff
=
new
StringBuilder
(
s
.
length
()
);
for
(
int
i
=
0
;
i
<
s
.
length
()
;
i
++)
{
StringBuilder
buff
=
new
StringBuilder
(
length
);
for
(
int
i
=
0
;
i
<
length
;
i
++)
{
char
c
=
s
.
charAt
(
i
);
switch
(
c
)
{
case
'"'
:
...
...
h2/src/main/org/h2/server/web/WebSession.java
浏览文件 @
027787d0
...
...
@@ -167,7 +167,7 @@ class WebSession {
return
;
}
sql
=
sql
.
trim
();
if
(
sql
.
length
()
==
0
)
{
if
(
sql
.
isEmpty
()
)
{
return
;
}
if
(
commandHistory
.
size
()
>
MAX_HISTORY
)
{
...
...
h2/src/main/org/h2/store/fs/FilePathZip.java
浏览文件 @
027787d0
...
...
@@ -51,7 +51,7 @@ public class FilePathZip extends FilePath {
public
boolean
exists
()
{
try
{
String
entryName
=
getEntryName
();
if
(
entryName
.
length
()
==
0
)
{
if
(
entryName
.
isEmpty
()
)
{
return
true
;
}
try
(
ZipFile
file
=
openZipFile
())
{
...
...
@@ -88,7 +88,7 @@ public class FilePathZip extends FilePath {
public
boolean
isDirectory
()
{
try
{
String
entryName
=
getEntryName
();
if
(
entryName
.
length
()
==
0
)
{
if
(
entryName
.
isEmpty
()
)
{
return
true
;
}
try
(
ZipFile
file
=
openZipFile
())
{
...
...
h2/src/main/org/h2/tools/Backup.java
浏览文件 @
027787d0
...
...
@@ -108,7 +108,7 @@ public class Backup extends Tool {
private
void
process
(
String
zipFileName
,
String
directory
,
String
db
,
boolean
quiet
)
throws
SQLException
{
List
<
String
>
list
;
boolean
allFiles
=
db
!=
null
&&
db
.
length
()
==
0
;
boolean
allFiles
=
db
!=
null
&&
db
.
isEmpty
()
;
if
(
allFiles
)
{
list
=
FileUtils
.
newDirectoryStream
(
directory
);
}
else
{
...
...
h2/src/main/org/h2/tools/Csv.java
浏览文件 @
027787d0
...
...
@@ -228,7 +228,7 @@ public class Csv implements SimpleRowSource {
for
(
int
i
=
0
;
i
<
columnNames
.
length
;
i
++)
{
StringBuilder
buff
=
new
StringBuilder
();
String
n
=
columnNames
[
i
];
if
(
n
==
null
||
n
.
length
()
==
0
)
{
if
(
n
==
null
||
n
.
isEmpty
()
)
{
buff
.
append
(
'C'
).
append
(
i
+
1
);
}
else
{
buff
.
append
(
n
);
...
...
@@ -350,7 +350,7 @@ public class Csv implements SimpleRowSource {
list
.
add
(
v
);
}
}
else
{
if
(
v
.
length
()
==
0
)
{
if
(
v
.
isEmpty
()
)
{
v
=
"COLUMN"
+
list
.
size
();
}
else
if
(!
caseSensitiveColumnNames
&&
isSimpleColumnName
(
v
))
{
v
=
StringUtils
.
toUpperEnglish
(
v
);
...
...
@@ -827,13 +827,13 @@ public class Csv implements SimpleRowSource {
String
charset
=
null
;
String
[]
keyValuePairs
=
StringUtils
.
arraySplit
(
options
,
' '
,
false
);
for
(
String
pair
:
keyValuePairs
)
{
if
(
pair
.
length
()
==
0
)
{
if
(
pair
.
isEmpty
()
)
{
continue
;
}
int
index
=
pair
.
indexOf
(
'='
);
String
key
=
StringUtils
.
trim
(
pair
.
substring
(
0
,
index
),
true
,
true
,
" "
);
String
value
=
pair
.
substring
(
index
+
1
);
char
ch
=
value
.
length
()
==
0
?
0
:
value
.
charAt
(
0
);
char
ch
=
value
.
isEmpty
()
?
0
:
value
.
charAt
(
0
);
if
(
isParam
(
key
,
"escape"
,
"esc"
,
"escapeCharacter"
))
{
setEscapeCharacter
(
ch
);
}
else
if
(
isParam
(
key
,
"fieldDelimiter"
,
"fieldDelim"
))
{
...
...
h2/src/main/org/h2/tools/RunScript.java
浏览文件 @
027787d0
...
...
@@ -205,7 +205,7 @@ public class RunScript extends Tool {
break
;
}
String
trim
=
sql
.
trim
();
if
(
trim
.
length
()
==
0
)
{
if
(
trim
.
isEmpty
()
)
{
continue
;
}
if
(
trim
.
startsWith
(
"@"
)
&&
StringUtils
.
toUpperEnglish
(
trim
).
...
...
h2/src/main/org/h2/tools/Shell.java
浏览文件 @
027787d0
...
...
@@ -220,7 +220,7 @@ public class Shell extends Tool implements Runnable {
break
;
}
String
trimmed
=
line
.
trim
();
if
(
trimmed
.
length
()
==
0
)
{
if
(
trimmed
.
isEmpty
()
)
{
continue
;
}
boolean
end
=
trimmed
.
endsWith
(
";"
);
...
...
@@ -366,7 +366,7 @@ public class Shell extends Tool implements Runnable {
println
(
"[Enter] Hide"
);
print
(
"Password "
);
String
password
=
readLine
();
if
(
password
.
length
()
==
0
)
{
if
(
password
.
isEmpty
()
)
{
password
=
readPassword
();
}
conn
=
JdbcUtils
.
getConnection
(
driver
,
url
,
user
,
password
);
...
...
@@ -433,7 +433,7 @@ public class Shell extends Tool implements Runnable {
private
String
readLine
(
String
defaultValue
)
throws
IOException
{
String
s
=
readLine
();
return
s
.
length
()
==
0
?
defaultValue
:
s
;
return
s
.
isEmpty
()
?
defaultValue
:
s
;
}
private
String
readLine
()
throws
IOException
{
...
...
h2/src/main/org/h2/util/NetUtils.java
浏览文件 @
027787d0
...
...
@@ -155,7 +155,7 @@ public class NetUtils {
*/
private
static
InetAddress
getBindAddress
()
throws
UnknownHostException
{
String
host
=
SysProperties
.
BIND_ADDRESS
;
if
(
host
==
null
||
host
.
length
()
==
0
)
{
if
(
host
==
null
||
host
.
isEmpty
()
)
{
return
null
;
}
synchronized
(
NetUtils
.
class
)
{
...
...
h2/src/main/org/h2/util/ParserUtil.java
浏览文件 @
027787d0
...
...
@@ -238,10 +238,11 @@ public class ParserUtil {
* @return true if it is a keyword
*/
public
static
boolean
isKeyword
(
String
s
)
{
if
(
s
.
length
()
==
0
)
{
int
length
=
s
.
length
();
if
(
length
==
0
)
{
return
false
;
}
return
getSaveTokenType
(
s
,
false
,
0
,
s
.
length
()
,
false
)
!=
IDENTIFIER
;
return
getSaveTokenType
(
s
,
false
,
0
,
length
,
false
)
!=
IDENTIFIER
;
}
/**
...
...
@@ -252,7 +253,8 @@ public class ParserUtil {
* @throws NullPointerException if s is {@code null}
*/
public
static
boolean
isSimpleIdentifier
(
String
s
)
{
if
(
s
.
length
()
==
0
)
{
int
length
=
s
.
length
();
if
(
length
==
0
)
{
return
false
;
}
char
c
=
s
.
charAt
(
0
);
...
...
@@ -260,13 +262,13 @@ public class ParserUtil {
if
((
UPPER_OR_OTHER_LETTER
>>>
Character
.
getType
(
c
)
&
1
)
==
0
&&
c
!=
'_'
)
{
return
false
;
}
for
(
int
i
=
1
,
length
=
s
.
length
()
;
i
<
length
;
i
++)
{
for
(
int
i
=
1
;
i
<
length
;
i
++)
{
c
=
s
.
charAt
(
i
);
if
((
UPPER_OR_OTHER_LETTER_OR_DIGIT
>>>
Character
.
getType
(
c
)
&
1
)
==
0
&&
c
!=
'_'
)
{
return
false
;
}
}
return
getSaveTokenType
(
s
,
false
,
0
,
s
.
length
()
,
true
)
==
IDENTIFIER
;
return
getSaveTokenType
(
s
,
false
,
0
,
length
,
true
)
==
IDENTIFIER
;
}
/**
...
...
h2/src/main/org/h2/util/StringUtils.java
浏览文件 @
027787d0
...
...
@@ -777,7 +777,7 @@ public class StringUtils {
* @return true if it is null or empty
*/
public
static
boolean
isNullOrEmpty
(
String
s
)
{
return
s
==
null
||
s
.
length
()
==
0
;
return
s
==
null
||
s
.
isEmpty
()
;
}
/**
...
...
@@ -810,7 +810,7 @@ public class StringUtils {
return
string
;
}
char
paddingChar
;
if
(
padding
==
null
||
padding
.
length
()
==
0
)
{
if
(
padding
==
null
||
padding
.
isEmpty
()
)
{
paddingChar
=
' '
;
}
else
{
paddingChar
=
padding
.
charAt
(
0
);
...
...
@@ -941,7 +941,7 @@ public class StringUtils {
}
if
(
s
==
null
)
{
return
s
;
}
else
if
(
s
.
length
()
==
0
)
{
}
else
if
(
s
.
isEmpty
()
)
{
return
""
;
}
int
hash
=
s
.
hashCode
();
...
...
@@ -1151,7 +1151,7 @@ public class StringUtils {
* @return the escaped pattern
*/
public
static
String
escapeMetaDataPattern
(
String
pattern
)
{
if
(
pattern
==
null
||
pattern
.
length
()
==
0
)
{
if
(
pattern
==
null
||
pattern
.
isEmpty
()
)
{
return
pattern
;
}
return
replaceAll
(
pattern
,
"\\"
,
"\\\\"
);
...
...
h2/src/main/org/h2/util/ToChar.java
浏览文件 @
027787d0
...
...
@@ -362,13 +362,14 @@ public class ToChar {
}
int
i
=
idx
+
1
;
boolean
allZeroes
=
true
;
for
(;
i
<
numberStr
.
length
();
i
++)
{
int
length
=
numberStr
.
length
();
for
(;
i
<
length
;
i
++)
{
if
(
numberStr
.
charAt
(
i
)
!=
'0'
)
{
allZeroes
=
false
;
break
;
}
}
final
char
[]
zeroes
=
new
char
[
allZeroes
?
numberStr
.
length
()
-
idx
-
1
:
i
-
1
-
idx
];
final
char
[]
zeroes
=
new
char
[
allZeroes
?
length
-
idx
-
1
:
i
-
1
-
idx
];
Arrays
.
fill
(
zeroes
,
'0'
);
return
String
.
valueOf
(
zeroes
);
}
...
...
@@ -688,7 +689,7 @@ public class ToChar {
StringBuilder
output
=
new
StringBuilder
();
boolean
fillMode
=
true
;
for
(
int
i
=
0
;
i
<
format
.
length
()
;)
{
for
(
int
i
=
0
,
length
=
format
.
length
();
i
<
length
;)
{
Capitalization
cap
;
...
...
h2/src/main/org/h2/util/ToDateParser.java
浏览文件 @
027787d0
...
...
@@ -249,7 +249,7 @@ public class ToDateParser {
}
private
boolean
hasToParseData
()
{
return
formatStr
.
length
()
>
0
;
return
!
formatStr
.
isEmpty
()
;
}
private
void
removeFirstChar
()
{
...
...
h2/src/main/org/h2/util/ToDateTokenizer.java
浏览文件 @
027787d0
...
...
@@ -651,7 +651,7 @@ class ToDateTokenizer {
* @return the list of tokens, or {@code null}
*/
static
List
<
FormatTokenEnum
>
getTokensInQuestion
(
String
formatStr
)
{
if
(
formatStr
!=
null
&&
formatStr
.
length
()
>
0
)
{
if
(
formatStr
!=
null
&&
!
formatStr
.
isEmpty
()
)
{
char
key
=
Character
.
toUpperCase
(
formatStr
.
charAt
(
0
));
if
(
key
>=
'A'
&&
key
<=
'Y'
)
{
List
<
FormatTokenEnum
>[]
tokens
=
TOKENS
;
...
...
h2/src/main/org/h2/value/CompareMode.java
浏览文件 @
027787d0
...
...
@@ -222,12 +222,13 @@ public class CompareMode implements Comparator<Value> {
}
else
if
(
name
.
startsWith
(
CHARSET
))
{
return
new
CharsetCollator
(
Charset
.
forName
(
name
.
substring
(
CHARSET
.
length
())));
}
if
(
name
.
length
()
==
2
)
{
int
length
=
name
.
length
();
if
(
length
==
2
)
{
Locale
locale
=
new
Locale
(
StringUtils
.
toLowerEnglish
(
name
),
""
);
if
(
compareLocaleNames
(
locale
,
name
))
{
result
=
Collator
.
getInstance
(
locale
);
}
}
else
if
(
name
.
length
()
==
5
)
{
}
else
if
(
length
==
5
)
{
// LL_CC (language_country)
int
idx
=
name
.
indexOf
(
'_'
);
if
(
idx
>=
0
)
{
...
...
h2/src/main/org/h2/value/CompareModeIcu4J.java
浏览文件 @
027787d0
...
...
@@ -49,12 +49,13 @@ public class CompareModeIcu4J extends CompareMode {
"com.ibm.icu.text.Collator"
);
Method
getInstanceMethod
=
collatorClass
.
getMethod
(
"getInstance"
,
Locale
.
class
);
if
(
name
.
length
()
==
2
)
{
int
length
=
name
.
length
();
if
(
length
==
2
)
{
Locale
locale
=
new
Locale
(
StringUtils
.
toLowerEnglish
(
name
),
""
);
if
(
compareLocaleNames
(
locale
,
name
))
{
result
=
(
Comparator
<
String
>)
getInstanceMethod
.
invoke
(
null
,
locale
);
}
}
else
if
(
name
.
length
()
==
5
)
{
}
else
if
(
length
==
5
)
{
// LL_CC (language_country)
int
idx
=
name
.
indexOf
(
'_'
);
if
(
idx
>=
0
)
{
...
...
h2/src/main/org/h2/value/ExtTypeInfoEnum.java
浏览文件 @
027787d0
...
...
@@ -52,7 +52,7 @@ public final class ExtTypeInfoEnum extends ExtTypeInfo {
}
result
.
append
(
'\''
);
String
s
=
enumerators
[
i
];
for
(
int
j
=
0
;
j
<
s
.
length
()
;
j
++)
{
for
(
int
j
=
0
,
length
=
s
.
length
();
j
<
length
;
j
++)
{
char
c
=
s
.
charAt
(
j
);
if
(
c
==
'\''
)
{
result
.
append
(
'\''
);
...
...
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
027787d0
...
...
@@ -275,7 +275,7 @@ public class ValueLob extends Value {
private
static
int
getNewObjectId
(
DataHandler
h
)
{
String
path
=
h
.
getDatabasePath
();
if
(
(
path
!=
null
)
&&
(
path
.
length
()
==
0
))
{
if
(
path
!=
null
&&
path
.
isEmpty
(
))
{
path
=
new
File
(
Utils
.
getProperty
(
"java.io.tmpdir"
,
"."
),
SysProperties
.
PREFIX_TEMP_FILE
).
getAbsolutePath
();
}
...
...
h2/src/main/org/h2/value/ValueLobDb.java
浏览文件 @
027787d0
...
...
@@ -176,7 +176,7 @@ public class ValueLobDb extends Value {
private
static
String
createTempLobFileName
(
DataHandler
handler
)
throws
IOException
{
String
path
=
handler
.
getDatabasePath
();
if
(
path
.
length
()
==
0
)
{
if
(
path
.
isEmpty
()
)
{
path
=
SysProperties
.
PREFIX_TEMP_FILE
;
}
return
FileUtils
.
createTempFile
(
path
,
Constants
.
SUFFIX_TEMP_FILE
,
true
,
true
);
...
...
h2/src/main/org/h2/value/ValueStringFixed.java
浏览文件 @
027787d0
...
...
@@ -47,13 +47,13 @@ public class ValueStringFixed extends ValueString {
}
private
static
String
rightPadWithSpaces
(
String
s
,
int
length
)
{
int
pad
=
length
-
s
.
length
();
if
(
pad
<=
0
)
{
int
used
=
s
.
length
();
if
(
length
<=
used
)
{
return
s
;
}
char
[]
res
=
new
char
[
length
];
s
.
getChars
(
0
,
s
.
length
()
,
res
,
0
);
Arrays
.
fill
(
res
,
s
.
length
()
,
length
,
' '
);
s
.
getChars
(
0
,
used
,
res
,
0
);
Arrays
.
fill
(
res
,
used
,
length
,
' '
);
return
new
String
(
res
);
}
...
...
@@ -109,11 +109,12 @@ public class ValueStringFixed extends ValueString {
// Default behaviour of H2
s
=
trimRight
(
s
);
}
if
(
s
.
length
()
==
0
)
{
int
length
=
s
.
length
();
if
(
length
==
0
)
{
return
EMPTY
;
}
ValueStringFixed
obj
=
new
ValueStringFixed
(
StringUtils
.
cache
(
s
));
if
(
s
.
length
()
>
SysProperties
.
OBJECT_CACHE_MAX_PER_ELEMENT_SIZE
)
{
if
(
length
>
SysProperties
.
OBJECT_CACHE_MAX_PER_ELEMENT_SIZE
)
{
return
obj
;
}
return
(
ValueStringFixed
)
Value
.
cache
(
obj
);
...
...
h2/src/main/org/h2/value/ValueStringIgnoreCase.java
浏览文件 @
027787d0
...
...
@@ -60,11 +60,12 @@ public class ValueStringIgnoreCase extends ValueString {
* @return the value
*/
public
static
ValueStringIgnoreCase
get
(
String
s
)
{
if
(
s
.
length
()
==
0
)
{
int
length
=
s
.
length
();
if
(
length
==
0
)
{
return
EMPTY
;
}
ValueStringIgnoreCase
obj
=
new
ValueStringIgnoreCase
(
StringUtils
.
cache
(
s
));
if
(
s
.
length
()
>
SysProperties
.
OBJECT_CACHE_MAX_PER_ELEMENT_SIZE
)
{
if
(
length
>
SysProperties
.
OBJECT_CACHE_MAX_PER_ELEMENT_SIZE
)
{
return
obj
;
}
ValueStringIgnoreCase
cache
=
(
ValueStringIgnoreCase
)
Value
.
cache
(
obj
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论