Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e6674c94
提交
e6674c94
authored
6月 18, 2011
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Split long lines.
上级
277312ed
显示空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
84 行增加
和
31 行删除
+84
-31
TestFileLockSerialized.java
h2/src/test/org/h2/test/unit/TestFileLockSerialized.java
+9
-2
TestRecovery.java
h2/src/test/org/h2/test/unit/TestRecovery.java
+3
-1
TestSecurity.java
h2/src/test/org/h2/test/unit/TestSecurity.java
+16
-8
TestTools.java
h2/src/test/org/h2/test/unit/TestTools.java
+3
-1
TestValueMemory.java
h2/src/test/org/h2/test/unit/TestValueMemory.java
+13
-6
OutputCatcher.java
h2/src/test/org/h2/test/utils/OutputCatcher.java
+2
-1
H2Database.java
h2/src/tools/org/h2/android/H2Database.java
+2
-1
BuildBase.java
h2/src/tools/org/h2/build/BuildBase.java
+2
-1
CheckJavadoc.java
h2/src/tools/org/h2/build/code/CheckJavadoc.java
+4
-0
CheckTextFiles.java
h2/src/tools/org/h2/build/code/CheckTextFiles.java
+3
-1
WebSite.java
h2/src/tools/org/h2/build/doc/WebSite.java
+4
-1
Doclet.java
h2/src/tools/org/h2/build/doclet/Doclet.java
+11
-4
SecureKeyStoreBuilder.java
h2/src/tools/org/h2/dev/security/SecureKeyStoreBuilder.java
+3
-1
FileViewer.java
h2/src/tools/org/h2/dev/util/FileViewer.java
+3
-1
ClassReader.java
h2/src/tools/org/h2/jaqu/bytecode/ClassReader.java
+6
-2
没有找到文件。
h2/src/test/org/h2/test/unit/TestFileLockSerialized.java
浏览文件 @
e6674c94
...
...
@@ -348,7 +348,11 @@ public class TestFileLockSerialized extends TestBase {
ResultSet
rs
=
c
.
createStatement
().
executeQuery
(
"select id, id2 from test"
);
while
(
rs
.
next
())
{
if
(
rs
.
getInt
(
1
)
!=
rs
.
getInt
(
2
))
{
throw
new
Exception
(
Thread
.
currentThread
().
getId
()
+
" nextInt: "
+
nextInt
[
0
]
+
" rs.getInt(1): "
+
rs
.
getInt
(
1
)
+
" rs.getInt(2): "
+
rs
.
getInt
(
2
));
throw
new
Exception
(
Thread
.
currentThread
().
getId
()
+
" nextInt: "
+
nextInt
[
0
]
+
" rs.getInt(1): "
+
rs
.
getInt
(
1
)
+
" rs.getInt(2): "
+
rs
.
getInt
(
2
));
}
}
nextInt
[
0
]++;
...
...
@@ -532,7 +536,10 @@ public class TestFileLockSerialized extends TestBase {
deleteDb
(
"fileLockSerialized"
);
int
cacheSizeKb
=
withCache
?
5000
:
0
;
final
String
url
=
"jdbc:h2:"
+
getBaseDir
()
+
"/fileLockSerialized;FILE_LOCK=SERIALIZED;OPEN_NEW=TRUE;CACHE_SIZE="
+
cacheSizeKb
;
final
String
url
=
"jdbc:h2:"
+
getBaseDir
()
+
"/fileLockSerialized"
+
";FILE_LOCK=SERIALIZED"
+
";OPEN_NEW=TRUE"
+
";CACHE_SIZE="
+
cacheSizeKb
;
final
boolean
[]
importFinished
=
{
false
};
final
Task
importUpdate
=
new
Task
()
{
public
void
call
()
throws
Exception
{
...
...
h2/src/test/org/h2/test/unit/TestRecovery.java
浏览文件 @
e6674c94
...
...
@@ -116,7 +116,9 @@ public class TestRecovery extends TestBase {
}
f
.
close
();
Recover
.
main
(
"-dir"
,
getBaseDir
(),
"-db"
,
"recovery"
);
String
script
=
IOUtils
.
readStringAndClose
(
new
InputStreamReader
(
IOUtils
.
openFileInputStream
(
getBaseDir
()
+
"/recovery.h2.sql"
)),
-
1
);
String
script
=
IOUtils
.
readStringAndClose
(
new
InputStreamReader
(
IOUtils
.
openFileInputStream
(
getBaseDir
()
+
"/recovery.h2.sql"
)),
-
1
);
assertContains
(
script
,
"checksum mismatch"
);
assertContains
(
script
,
"dump:"
);
assertContains
(
script
,
"Hello World2"
);
...
...
h2/src/test/org/h2/test/unit/TestSecurity.java
浏览文件 @
e6674c94
...
...
@@ -66,13 +66,20 @@ public class TestSecurity extends TestBase {
getHashString
(
new
byte
[]
{
(
byte
)
0xe3
,
(
byte
)
0xd7
,
0x25
,
0x70
,
(
byte
)
0xdc
,
(
byte
)
0xdd
,
0x78
,
0x7c
,
(
byte
)
0xe3
,
(
byte
)
0x88
,
0x7a
,
(
byte
)
0xb2
,
(
byte
)
0xcd
,
0x68
,
0x46
,
0x52
}));
checkSHA256
(
""
,
"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
);
checkSHA256
(
"a"
,
"CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB"
);
checkSHA256
(
"abc"
,
"BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD"
);
checkSHA256
(
"message digest"
,
"F7846F55CF23E14EEBEAB5B4E1550CAD5B509E3348FBC4EFA3A1413D393CB650"
);
checkSHA256
(
"abcdefghijklmnopqrstuvwxyz"
,
"71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73"
);
checkSHA256
(
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
,
"248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1"
);
checkSHA256
(
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
,
"F371BC4A311F2B009EEF952DD83CA80E2B60026C8E935592D0F9C308453C813E"
);
checkSHA256
(
""
,
"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855"
);
checkSHA256
(
"a"
,
"CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB"
);
checkSHA256
(
"abc"
,
"BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD"
);
checkSHA256
(
"message digest"
,
"F7846F55CF23E14EEBEAB5B4E1550CAD5B509E3348FBC4EFA3A1413D393CB650"
);
checkSHA256
(
"abcdefghijklmnopqrstuvwxyz"
,
"71C480DF93D6AE2F1EFAD1447C66C9525E316218CF51FC8D9ED832F2DAF18B73"
);
checkSHA256
(
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
,
"248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1"
);
checkSHA256
(
"12345678901234567890123456789012345678901234567890123456789012345678901234567890"
,
"F371BC4A311F2B009EEF952DD83CA80E2B60026C8E935592D0F9C308453C813E"
);
StringBuilder
buff
=
new
StringBuilder
(
1000000
);
buff
.
append
(
'a'
);
checkSHA256
(
buff
.
toString
(),
"CA978112CA1BBDCAFAC231B39A23DC4DA786EFF8147C4E72B9807785AFEE48BB"
);
...
...
@@ -116,7 +123,8 @@ public class TestSecurity extends TestBase {
assertEquals
(
"3f5b8cc9ea855a0afa7347d23e8d664e"
,
r
);
// test vector from
// http://www.inconteam.com/index.php?option=com_content&view=article&id=55:aes-test-vectors&catid=41:encryption&Itemid=60#aes-ecb-128
// http://www.inconteam.com/index.php?option=com_content&view=article&
// id=55:aes-test-vectors&catid=41:encryption&Itemid=60#aes-ecb-128
test
.
setKey
(
StringUtils
.
convertHexToBytes
(
"2b7e151628aed2a6abf7158809cf4f3c"
));
data
=
StringUtils
.
convertHexToBytes
(
"6bc1bee22e409f96e93d7e117393172a"
);
test
.
encrypt
(
data
,
0
,
data
.
length
);
...
...
h2/src/test/org/h2/test/unit/TestTools.java
浏览文件 @
e6674c94
...
...
@@ -525,7 +525,9 @@ public class TestTools extends TestBase {
prep
.
executeUpdate
();
conn
.
close
();
ConvertTraceFile
.
main
(
"-traceFile"
,
getBaseDir
()
+
"/toolsConvertTraceFile.trace.db"
,
"-javaClass"
,
getBaseDir
()
+
"/Test"
,
"-script"
,
getBaseDir
()
+
"/test.sql"
);
ConvertTraceFile
.
main
(
"-traceFile"
,
getBaseDir
()
+
"/toolsConvertTraceFile.trace.db"
,
"-javaClass"
,
getBaseDir
()
+
"/Test"
,
"-script"
,
getBaseDir
()
+
"/test.sql"
);
FileSystem
fs
=
FileSystem
.
getInstance
(
getBaseDir
());
fs
.
delete
(
getBaseDir
()
+
"/Test.java"
);
...
...
h2/src/test/org/h2/test/unit/TestValueMemory.java
浏览文件 @
e6674c94
...
...
@@ -72,7 +72,10 @@ public class TestValueMemory extends TestBase implements DataHandler {
testCompare
();
for
(
int
i
=
0
;
i
<
Value
.
TYPE_COUNT
;
i
++)
{
Value
v
=
create
(
i
);
String
s
=
"type: "
+
v
.
getType
()
+
" calculated: "
+
v
.
getMemory
()
+
" real: "
+
MemoryFootprint
.
getObjectSize
(
v
)
+
" "
+
v
.
getClass
().
getName
()
+
": "
+
v
.
toString
();
String
s
=
"type: "
+
v
.
getType
()
+
" calculated: "
+
v
.
getMemory
()
+
" real: "
+
MemoryFootprint
.
getObjectSize
(
v
)
+
" "
+
v
.
getClass
().
getName
()
+
": "
+
v
.
toString
();
trace
(
s
);
}
for
(
int
i
=
0
;
i
<
Value
.
TYPE_COUNT
;
i
++)
{
...
...
@@ -112,11 +115,15 @@ public class TestValueMemory extends TestBase implements DataHandler {
System
.
gc
();
long
used
=
Utils
.
getMemoryUsed
()
-
first
;
memory
/=
1024
;
if
(
config
.
traceTest
||
used
>
memory
*
3
)
{
String
msg
=
"Type: "
+
type
+
" Used memory: "
+
used
+
" calculated: "
+
memory
+
" length: "
+
array
.
length
+
" size: "
+
size
;
if
(
config
.
traceTest
)
{
trace
(
"Type: "
+
type
+
" Used memory: "
+
used
+
" calculated: "
+
memory
+
" length: "
+
array
.
length
+
" size: "
+
size
);
trace
(
msg
);
}
if
(
used
>
memory
*
3
)
{
fail
(
"Type: "
+
type
+
" Used memory: "
+
used
+
" calculated: "
+
memory
+
" length: "
+
array
.
length
+
" size: "
+
size
);
fail
(
msg
);
}
}
}
private
Value
create
(
int
type
)
throws
SQLException
{
...
...
h2/src/test/org/h2/test/utils/OutputCatcher.java
浏览文件 @
e6674c94
...
...
@@ -60,7 +60,8 @@ public class OutputCatcher {
File
file
=
new
File
(
fileName
);
file
.
getParentFile
().
mkdirs
();
PrintWriter
writer
=
new
PrintWriter
(
new
FileOutputStream
(
file
));
writer
.
write
(
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
);
writer
.
write
(
"<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 "
+
"Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
);
writer
.
write
(
"<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n"
);
writer
.
write
(
"<head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=utf-8\" /><title>\n"
);
writer
.
print
(
title
);
...
...
h2/src/tools/org/h2/android/H2Database.java
浏览文件 @
e6674c94
...
...
@@ -320,7 +320,8 @@ public class H2Database {
* @param conflictAlgorithm what conflict resolution to use
* @return TODO
*/
public
long
insertWithOnConflict
(
String
table
,
String
nullColumnHack
,
ContentValues
initialValues
,
int
conflictAlgorithm
)
{
public
long
insertWithOnConflict
(
String
table
,
String
nullColumnHack
,
ContentValues
initialValues
,
int
conflictAlgorithm
)
{
return
0
;
}
...
...
h2/src/tools/org/h2/build/BuildBase.java
浏览文件 @
e6674c94
...
...
@@ -745,7 +745,8 @@ public class BuildBase {
println
(
"Zip "
+
destFile
+
" ("
+
kb
+
" KB)"
);
}
private
static
long
zipOrJar
(
String
destFile
,
FileList
files
,
String
basePath
,
boolean
storeOnly
,
boolean
sortBySuffix
,
boolean
jar
)
{
private
static
long
zipOrJar
(
String
destFile
,
FileList
files
,
String
basePath
,
boolean
storeOnly
,
boolean
sortBySuffix
,
boolean
jar
)
{
if
(
sortBySuffix
)
{
// for better compressibility, sort by suffix, then name
Collections
.
sort
(
files
,
new
Comparator
<
File
>()
{
...
...
h2/src/tools/org/h2/build/code/CheckJavadoc.java
浏览文件 @
e6674c94
...
...
@@ -18,6 +18,7 @@ import java.io.RandomAccessFile;
public
class
CheckJavadoc
{
private
static
final
int
MAX_COMMENT_LINE_SIZE
=
80
;
private
static
final
int
MAX_SOURCE_LINE_SIZE
=
120
;
private
int
errorCount
;
/**
...
...
@@ -114,6 +115,9 @@ public class CheckJavadoc {
System
.
out
.
println
(
"Long line: "
+
file
.
getAbsolutePath
()
+
" ("
+
file
.
getName
()
+
":"
+
lineNumber
+
")"
);
errorCount
++;
}
else
if
(!
inComment
&&
line
.
length
()
>
MAX_SOURCE_LINE_SIZE
)
{
System
.
out
.
println
(
"Long line: "
+
file
.
getAbsolutePath
()
+
" ("
+
file
.
getName
()
+
":"
+
lineNumber
+
")"
);
}
lineNumber
++;
pos
=
next
+
1
;
...
...
h2/src/tools/org/h2/build/code/CheckTextFiles.java
浏览文件 @
e6674c94
...
...
@@ -34,7 +34,9 @@ public class CheckTextFiles {
private
int
spacesPerTab
=
4
;
private
boolean
autoFix
=
true
;
private
boolean
useCRLF
;
private
String
[]
suffixIgnoreLicense
=
{
"bat"
,
"nsi"
,
"txt"
,
"properties"
,
"xml"
,
"java.sql.Driver"
,
"task"
,
"sh"
,
"prefs"
};
private
String
[]
suffixIgnoreLicense
=
{
"bat"
,
"nsi"
,
"txt"
,
"properties"
,
"xml"
,
"java.sql.Driver"
,
"task"
,
"sh"
,
"prefs"
};
private
boolean
hasError
;
/**
...
...
h2/src/tools/org/h2/build/doc/WebSite.java
浏览文件 @
e6674c94
...
...
@@ -27,7 +27,10 @@ public class WebSite {
private
static
final
String
ANALYTICS_TAG
=
"<!-- analytics -->"
;
private
static
final
String
ANALYTICS_SCRIPT
=
"<script src=\"http://www.google-analytics.com/ga.js\" type=\"text/javascript\"></script>\n"
+
"<script type=\"text/javascript\">var pageTracker=_gat._getTracker(\"UA-2351060-1\");pageTracker._initData();pageTracker._trackPageview();</script>"
;
"<script type=\"text/javascript\">"
+
"var pageTracker=_gat._getTracker(\"UA-2351060-1\");"
+
"pageTracker._initData();pageTracker._trackPageview();"
+
"</script>"
;
private
static
final
String
TRANSLATE_START
=
"<!-- translate"
;
private
static
final
String
TRANSLATE_END
=
"translate -->"
;
...
...
h2/src/tools/org/h2/build/doclet/Doclet.java
浏览文件 @
e6674c94
...
...
@@ -139,7 +139,8 @@ public class Doclet {
hasMethods
=
true
;
}
String
type
=
getTypeName
(
method
.
isStatic
(),
false
,
getReturnType
(
method
));
writer
.
println
(
"<tr id=\"__"
+
id
+
"\" onclick=\"return on("
+
id
+
")\"><td class=\"return\">"
+
type
+
"</td><td class=\"method\">"
);
writer
.
println
(
"<tr id=\"__"
+
id
+
"\" onclick=\"return on("
+
id
+
")\">"
);
writer
.
println
(
"<td class=\"return\">"
+
type
+
"</td><td class=\"method\">"
);
Parameter
[]
params
=
method
.
parameters
();
StringBuilder
buff
=
new
StringBuilder
();
StringBuilder
buffSignature
=
new
StringBuilder
(
name
);
...
...
@@ -311,7 +312,8 @@ public class Doclet {
if
(
hasComment
&&
!
method
.
commentText
().
startsWith
(
"["
))
{
// [Not supported] and such are not problematic
addError
(
"Undocumented parameter(s) ("
+
clazz
.
name
()
+
".java:"
+
method
.
position
().
line
()
+
") "
+
name
+
" documented: "
+
paramTags
.
length
+
" params: "
+
params
.
length
);
clazz
.
name
()
+
".java:"
+
method
.
position
().
line
()
+
") "
+
name
+
" documented: "
+
paramTags
.
length
+
" params: "
+
params
.
length
);
}
}
for
(
int
j
=
0
;
j
<
paramTags
.
length
;
j
++)
{
...
...
@@ -420,9 +422,14 @@ public class Doclet {
boolean
setterOrGetter
=
name
.
startsWith
(
"set"
)
&&
method
.
parameters
().
length
==
1
;
setterOrGetter
|=
name
.
startsWith
(
"get"
)
&&
method
.
parameters
().
length
==
0
;
Type
returnType
=
getReturnType
(
method
);
setterOrGetter
|=
name
.
startsWith
(
"is"
)
&&
method
.
parameters
().
length
==
0
&&
returnType
!=
null
&&
returnType
.
toString
().
equals
(
"boolean"
);
setterOrGetter
|=
name
.
startsWith
(
"is"
)
&&
method
.
parameters
().
length
==
0
&&
returnType
!=
null
&&
returnType
.
toString
().
equals
(
"boolean"
);
if
(!
setterOrGetter
)
{
addError
(
"Undocumented method "
+
" ("
+
clazz
.
name
()
+
".java:"
+
method
.
position
().
line
()
+
") "
+
clazz
+
"."
+
name
+
" "
+
raw
);
addError
(
"Undocumented method "
+
" ("
+
clazz
.
name
()
+
".java:"
+
method
.
position
().
line
()
+
") "
+
clazz
+
"."
+
name
+
" "
+
raw
);
return
true
;
}
}
...
...
h2/src/tools/org/h2/dev/security/SecureKeyStoreBuilder.java
浏览文件 @
e6674c94
...
...
@@ -46,7 +46,9 @@ public class SecureKeyStoreBuilder {
printKeystore
(
store
,
password
);
}
private
static
void
printKeystore
(
KeyStore
store
,
String
password
)
throws
KeyStoreException
,
NoSuchAlgorithmException
,
UnrecoverableKeyException
,
CertificateEncodingException
{
private
static
void
printKeystore
(
KeyStore
store
,
String
password
)
throws
KeyStoreException
,
NoSuchAlgorithmException
,
UnrecoverableKeyException
,
CertificateEncodingException
{
System
.
out
.
println
(
"KeyStore store = KeyStore.getInstance(\""
+
store
.
getType
()+
"\");"
);
System
.
out
.
println
(
"store.load(null, password.toCharArray());"
);
//System.out.println("keystore provider="+store.getProvider().getName());
...
...
h2/src/tools/org/h2/dev/util/FileViewer.java
浏览文件 @
e6674c94
...
...
@@ -86,7 +86,9 @@ public class FileViewer extends Tool {
}
}
private
static
void
process
(
String
fileName
,
String
find
,
boolean
head
,
boolean
tail
,
long
start
,
int
lines
,
boolean
quiet
)
throws
IOException
{
private
static
void
process
(
String
fileName
,
String
find
,
boolean
head
,
boolean
tail
,
long
start
,
int
lines
,
boolean
quiet
)
throws
IOException
{
RandomAccessFile
file
=
new
RandomAccessFile
(
fileName
,
"r"
);
long
length
=
file
.
length
();
if
(
head
)
{
...
...
h2/src/tools/org/h2/jaqu/bytecode/ClassReader.java
浏览文件 @
e6674c94
...
...
@@ -1367,7 +1367,9 @@ public class ClassReader {
int
field
=
constantPool
[
fieldRef
].
intValue
();
int
classIndex
=
field
>>>
16
;
int
nameAndType
=
constantPool
[
field
&
0xffff
].
intValue
();
String
className
=
constantPool
[
constantPool
[
classIndex
].
intValue
()]
+
"."
+
constantPool
[
nameAndType
>>>
16
]
+
" "
+
constantPool
[
nameAndType
&
0xffff
];
String
className
=
constantPool
[
constantPool
[
classIndex
].
intValue
()]
+
"."
+
constantPool
[
nameAndType
>>>
16
]
+
" "
+
constantPool
[
nameAndType
&
0xffff
];
return
className
;
}
...
...
@@ -1375,7 +1377,9 @@ public class ClassReader {
int
method
=
constantPool
[
methodRef
].
intValue
();
int
classIndex
=
method
>>>
16
;
int
nameAndType
=
constantPool
[
method
&
0xffff
].
intValue
();
String
className
=
constantPool
[
constantPool
[
classIndex
].
intValue
()]
+
"."
+
constantPool
[
nameAndType
>>>
16
]
+
" "
+
constantPool
[
nameAndType
&
0xffff
];
String
className
=
constantPool
[
constantPool
[
classIndex
].
intValue
()]
+
"."
+
constantPool
[
nameAndType
>>>
16
]
+
" "
+
constantPool
[
nameAndType
&
0xffff
];
return
className
;
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论