Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
e59f6ba5
提交
e59f6ba5
authored
14 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
The option -baseDir didn't work with symbolic links.
上级
57c231c1
显示空白字符变更
内嵌
并排
正在显示
17 个修改的文件
包含
36 行增加
和
78 行删除
+36
-78
BackupCommand.java
h2/src/main/org/h2/command/dml/BackupCommand.java
+2
-2
ConnectionInfo.java
h2/src/main/org/h2/engine/ConnectionInfo.java
+3
-3
Database.java
h2/src/main/org/h2/engine/Database.java
+1
-1
CipherFactory.java
h2/src/main/org/h2/security/CipherFactory.java
+1
-1
FileLister.java
h2/src/main/org/h2/store/FileLister.java
+2
-2
FileSystem.java
h2/src/main/org/h2/store/fs/FileSystem.java
+1
-9
FileSystemDisk.java
h2/src/main/org/h2/store/fs/FileSystemDisk.java
+1
-7
FileSystemMemory.java
h2/src/main/org/h2/store/fs/FileSystemMemory.java
+10
-15
FileSystemWrapper.java
h2/src/main/org/h2/store/fs/FileSystemWrapper.java
+2
-6
FileSystemZip.java
h2/src/main/org/h2/store/fs/FileSystemZip.java
+1
-5
Backup.java
h2/src/main/org/h2/tools/Backup.java
+2
-2
IOUtils.java
h2/src/main/org/h2/util/IOUtils.java
+2
-12
ValueLob.java
h2/src/main/org/h2/value/ValueLob.java
+1
-1
FileSystemDatabase.java
h2/src/test/org/h2/test/unit/FileSystemDatabase.java
+1
-1
TestFileSystem.java
h2/src/test/org/h2/test/unit/TestFileSystem.java
+2
-2
DebugFileSystem.java
h2/src/test/org/h2/test/utils/DebugFileSystem.java
+2
-7
FtpServer.java
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
+2
-2
没有找到文件。
h2/src/main/org/h2/command/dml/BackupCommand.java
浏览文件 @
e59f6ba5
...
@@ -100,8 +100,8 @@ public class BackupCommand extends Prepared {
...
@@ -100,8 +100,8 @@ public class BackupCommand extends Prepared {
}
}
private
static
void
backupFile
(
ZipOutputStream
out
,
String
base
,
String
fn
)
throws
IOException
{
private
static
void
backupFile
(
ZipOutputStream
out
,
String
base
,
String
fn
)
throws
IOException
{
String
f
=
IOUtils
.
get
Absolute
Path
(
fn
);
String
f
=
IOUtils
.
get
Canonical
Path
(
fn
);
base
=
IOUtils
.
get
Absolute
Path
(
base
);
base
=
IOUtils
.
get
Canonical
Path
(
base
);
if
(!
f
.
startsWith
(
base
))
{
if
(!
f
.
startsWith
(
base
))
{
DbException
.
throwInternalError
(
f
+
" does not start with "
+
base
);
DbException
.
throwInternalError
(
f
+
" does not start with "
+
base
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/ConnectionInfo.java
浏览文件 @
e59f6ba5
...
@@ -136,7 +136,7 @@ public class ConnectionInfo implements Cloneable {
...
@@ -136,7 +136,7 @@ public class ConnectionInfo implements Cloneable {
*/
*/
public
void
setBaseDir
(
String
dir
)
{
public
void
setBaseDir
(
String
dir
)
{
if
(
persistent
)
{
if
(
persistent
)
{
String
absDir
=
IOUtils
.
unwrap
(
IOUtils
.
get
Absolute
Path
(
dir
));
String
absDir
=
IOUtils
.
unwrap
(
IOUtils
.
get
Canonical
Path
(
dir
));
boolean
absolute
=
IOUtils
.
isAbsolute
(
name
);
boolean
absolute
=
IOUtils
.
isAbsolute
(
name
);
String
n
;
String
n
;
String
prefix
=
null
;
String
prefix
=
null
;
...
@@ -147,7 +147,7 @@ public class ConnectionInfo implements Cloneable {
...
@@ -147,7 +147,7 @@ public class ConnectionInfo implements Cloneable {
prefix
=
name
.
substring
(
0
,
name
.
length
()
-
n
.
length
());
prefix
=
name
.
substring
(
0
,
name
.
length
()
-
n
.
length
());
n
=
dir
+
SysProperties
.
FILE_SEPARATOR
+
n
;
n
=
dir
+
SysProperties
.
FILE_SEPARATOR
+
n
;
}
}
String
normalizedName
=
IOUtils
.
unwrap
(
IOUtils
.
normalize
(
n
));
String
normalizedName
=
IOUtils
.
unwrap
(
IOUtils
.
getCanonicalPath
(
n
));
if
(
normalizedName
.
equals
(
absDir
)
||
!
normalizedName
.
startsWith
(
absDir
))
{
if
(
normalizedName
.
equals
(
absDir
)
||
!
normalizedName
.
startsWith
(
absDir
))
{
throw
DbException
.
get
(
ErrorCode
.
IO_EXCEPTION_1
,
normalizedName
+
" outside "
+
throw
DbException
.
get
(
ErrorCode
.
IO_EXCEPTION_1
,
normalizedName
+
" outside "
+
absDir
);
absDir
);
...
@@ -341,7 +341,7 @@ public class ConnectionInfo implements Cloneable {
...
@@ -341,7 +341,7 @@ public class ConnectionInfo implements Cloneable {
if
(
persistent
)
{
if
(
persistent
)
{
if
(
nameNormalized
==
null
)
{
if
(
nameNormalized
==
null
)
{
String
suffix
=
Constants
.
SUFFIX_PAGE_FILE
;
String
suffix
=
Constants
.
SUFFIX_PAGE_FILE
;
String
n
=
IOUtils
.
normalize
(
name
+
suffix
);
String
n
=
IOUtils
.
getCanonicalPath
(
name
+
suffix
);
String
fileName
=
IOUtils
.
getFileName
(
n
);
String
fileName
=
IOUtils
.
getFileName
(
n
);
if
(
fileName
.
length
()
<
suffix
.
length
()
+
1
)
{
if
(
fileName
.
length
()
<
suffix
.
length
()
+
1
)
{
throw
DbException
.
get
(
ErrorCode
.
INVALID_DATABASE_NAME_1
,
name
);
throw
DbException
.
get
(
ErrorCode
.
INVALID_DATABASE_NAME_1
,
name
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/engine/Database.java
浏览文件 @
e59f6ba5
...
@@ -1302,7 +1302,7 @@ public class Database implements DataHandler {
...
@@ -1302,7 +1302,7 @@ public class Database implements DataHandler {
public
String
getDatabasePath
()
{
public
String
getDatabasePath
()
{
if
(
persistent
)
{
if
(
persistent
)
{
return
IOUtils
.
get
Absolute
Path
(
databaseName
);
return
IOUtils
.
get
Canonical
Path
(
databaseName
);
}
}
return
null
;
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/security/CipherFactory.java
浏览文件 @
e59f6ba5
...
@@ -198,7 +198,7 @@ public class CipherFactory {
...
@@ -198,7 +198,7 @@ public class CipherFactory {
throw
DbException
.
convertToIOException
(
e
);
throw
DbException
.
convertToIOException
(
e
);
}
}
}
}
String
absolutePath
=
IOUtils
.
get
Absolute
Path
(
fileName
);
String
absolutePath
=
IOUtils
.
get
Canonical
Path
(
fileName
);
System
.
setProperty
(
KEYSTORE_KEY
,
absolutePath
);
System
.
setProperty
(
KEYSTORE_KEY
,
absolutePath
);
}
}
if
(
p
.
getProperty
(
KEYSTORE_PASSWORD_KEY
)
==
null
)
{
if
(
p
.
getProperty
(
KEYSTORE_PASSWORD_KEY
)
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/FileLister.java
浏览文件 @
e59f6ba5
...
@@ -58,7 +58,7 @@ public class FileLister {
...
@@ -58,7 +58,7 @@ public class FileLister {
if
(
dir
==
null
||
dir
.
equals
(
""
))
{
if
(
dir
==
null
||
dir
.
equals
(
""
))
{
return
"."
;
return
"."
;
}
}
return
IOUtils
.
normalize
(
dir
);
return
IOUtils
.
getCanonicalPath
(
dir
);
}
}
/**
/**
...
@@ -73,7 +73,7 @@ public class FileLister {
...
@@ -73,7 +73,7 @@ public class FileLister {
*/
*/
public
static
ArrayList
<
String
>
getDatabaseFiles
(
String
dir
,
String
db
,
boolean
all
)
{
public
static
ArrayList
<
String
>
getDatabaseFiles
(
String
dir
,
String
db
,
boolean
all
)
{
ArrayList
<
String
>
files
=
New
.
arrayList
();
ArrayList
<
String
>
files
=
New
.
arrayList
();
String
start
=
db
==
null
?
null
:
IOUtils
.
normalize
(
dir
+
"/"
+
db
);
String
start
=
db
==
null
?
null
:
IOUtils
.
getCanonicalPath
(
dir
+
"/"
+
db
);
String
[]
list
=
IOUtils
.
listFiles
(
dir
);
String
[]
list
=
IOUtils
.
listFiles
(
dir
);
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
for
(
int
i
=
0
;
list
!=
null
&&
i
<
list
.
length
;
i
++)
{
String
f
=
list
[
i
];
String
f
=
list
[
i
];
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FileSystem.java
浏览文件 @
e59f6ba5
...
@@ -172,7 +172,7 @@ public abstract class FileSystem {
...
@@ -172,7 +172,7 @@ public abstract class FileSystem {
* @param fileName the file name
* @param fileName the file name
* @return the normalized file name
* @return the normalized file name
*/
*/
public
abstract
String
normalize
(
String
fileName
);
public
abstract
String
getCanonicalPath
(
String
fileName
);
/**
/**
* Get the parent directory of a file or directory.
* Get the parent directory of a file or directory.
...
@@ -198,14 +198,6 @@ public abstract class FileSystem {
...
@@ -198,14 +198,6 @@ public abstract class FileSystem {
*/
*/
public
abstract
boolean
isAbsolute
(
String
fileName
);
public
abstract
boolean
isAbsolute
(
String
fileName
);
/**
* Get the absolute file name.
*
* @param fileName the file name
* @return the absolute file name
*/
public
abstract
String
getAbsolutePath
(
String
fileName
);
/**
/**
* Get the last modified date of a file
* Get the last modified date of a file
*
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FileSystemDisk.java
浏览文件 @
e59f6ba5
...
@@ -243,7 +243,7 @@ public class FileSystemDisk extends FileSystem {
...
@@ -243,7 +243,7 @@ public class FileSystemDisk extends FileSystem {
return
f
.
setReadOnly
();
return
f
.
setReadOnly
();
}
}
public
String
normalize
(
String
fileName
)
{
public
String
getCanonicalPath
(
String
fileName
)
{
fileName
=
translateFileName
(
fileName
);
fileName
=
translateFileName
(
fileName
);
File
f
=
new
File
(
fileName
);
File
f
=
new
File
(
fileName
);
try
{
try
{
...
@@ -269,12 +269,6 @@ public class FileSystemDisk extends FileSystem {
...
@@ -269,12 +269,6 @@ public class FileSystemDisk extends FileSystem {
return
file
.
isAbsolute
();
return
file
.
isAbsolute
();
}
}
public
String
getAbsolutePath
(
String
fileName
)
{
fileName
=
translateFileName
(
fileName
);
File
parent
=
new
File
(
fileName
).
getAbsoluteFile
();
return
parent
.
getAbsolutePath
();
}
public
long
getLastModified
(
String
fileName
)
{
public
long
getLastModified
(
String
fileName
)
{
fileName
=
translateFileName
(
fileName
);
fileName
=
translateFileName
(
fileName
);
return
new
File
(
fileName
).
lastModified
();
return
new
File
(
fileName
).
lastModified
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FileSystemMemory.java
浏览文件 @
e59f6ba5
...
@@ -48,8 +48,8 @@ public class FileSystemMemory extends FileSystem {
...
@@ -48,8 +48,8 @@ public class FileSystemMemory extends FileSystem {
}
}
public
void
rename
(
String
oldName
,
String
newName
)
{
public
void
rename
(
String
oldName
,
String
newName
)
{
oldName
=
normalize
(
oldName
);
oldName
=
getCanonicalPath
(
oldName
);
newName
=
normalize
(
newName
);
newName
=
getCanonicalPath
(
newName
);
synchronized
(
MEMORY_FILES
)
{
synchronized
(
MEMORY_FILES
)
{
FileObjectMemoryData
f
=
getMemoryFile
(
oldName
);
FileObjectMemoryData
f
=
getMemoryFile
(
oldName
);
f
.
setName
(
newName
);
f
.
setName
(
newName
);
...
@@ -69,14 +69,14 @@ public class FileSystemMemory extends FileSystem {
...
@@ -69,14 +69,14 @@ public class FileSystemMemory extends FileSystem {
}
}
public
boolean
exists
(
String
fileName
)
{
public
boolean
exists
(
String
fileName
)
{
fileName
=
normalize
(
fileName
);
fileName
=
getCanonicalPath
(
fileName
);
synchronized
(
MEMORY_FILES
)
{
synchronized
(
MEMORY_FILES
)
{
return
MEMORY_FILES
.
get
(
fileName
)
!=
null
;
return
MEMORY_FILES
.
get
(
fileName
)
!=
null
;
}
}
}
}
public
void
delete
(
String
fileName
)
{
public
void
delete
(
String
fileName
)
{
fileName
=
normalize
(
fileName
);
fileName
=
getCanonicalPath
(
fileName
);
synchronized
(
MEMORY_FILES
)
{
synchronized
(
MEMORY_FILES
)
{
MEMORY_FILES
.
remove
(
fileName
);
MEMORY_FILES
.
remove
(
fileName
);
}
}
...
@@ -104,7 +104,7 @@ public class FileSystemMemory extends FileSystem {
...
@@ -104,7 +104,7 @@ public class FileSystemMemory extends FileSystem {
}
}
public
void
deleteRecursive
(
String
fileName
,
boolean
tryOnly
)
{
public
void
deleteRecursive
(
String
fileName
,
boolean
tryOnly
)
{
fileName
=
normalize
(
fileName
);
fileName
=
getCanonicalPath
(
fileName
);
synchronized
(
MEMORY_FILES
)
{
synchronized
(
MEMORY_FILES
)
{
Iterator
<
String
>
it
=
MEMORY_FILES
.
tailMap
(
fileName
).
keySet
().
iterator
();
Iterator
<
String
>
it
=
MEMORY_FILES
.
tailMap
(
fileName
).
keySet
().
iterator
();
while
(
it
.
hasNext
())
{
while
(
it
.
hasNext
())
{
...
@@ -126,7 +126,7 @@ public class FileSystemMemory extends FileSystem {
...
@@ -126,7 +126,7 @@ public class FileSystemMemory extends FileSystem {
return
getMemoryFile
(
fileName
).
setReadOnly
();
return
getMemoryFile
(
fileName
).
setReadOnly
();
}
}
public
String
normalize
(
String
fileName
)
{
public
String
getCanonicalPath
(
String
fileName
)
{
fileName
=
fileName
.
replace
(
'\\'
,
'/'
);
fileName
=
fileName
.
replace
(
'\\'
,
'/'
);
int
idx
=
fileName
.
indexOf
(
':'
)
+
1
;
int
idx
=
fileName
.
indexOf
(
':'
)
+
1
;
if
(
fileName
.
length
()
>
idx
&&
fileName
.
charAt
(
idx
)
!=
'/'
)
{
if
(
fileName
.
length
()
>
idx
&&
fileName
.
charAt
(
idx
)
!=
'/'
)
{
...
@@ -136,7 +136,7 @@ public class FileSystemMemory extends FileSystem {
...
@@ -136,7 +136,7 @@ public class FileSystemMemory extends FileSystem {
}
}
public
String
getParent
(
String
fileName
)
{
public
String
getParent
(
String
fileName
)
{
fileName
=
normalize
(
fileName
);
fileName
=
getCanonicalPath
(
fileName
);
int
idx
=
fileName
.
lastIndexOf
(
'/'
);
int
idx
=
fileName
.
lastIndexOf
(
'/'
);
if
(
idx
<
0
)
{
if
(
idx
<
0
)
{
idx
=
fileName
.
indexOf
(
':'
)
+
1
;
idx
=
fileName
.
indexOf
(
':'
)
+
1
;
...
@@ -155,11 +155,6 @@ public class FileSystemMemory extends FileSystem {
...
@@ -155,11 +155,6 @@ public class FileSystemMemory extends FileSystem {
return
true
;
return
true
;
}
}
public
String
getAbsolutePath
(
String
fileName
)
{
// TODO relative files are not supported
return
normalize
(
fileName
);
}
public
long
getLastModified
(
String
fileName
)
{
public
long
getLastModified
(
String
fileName
)
{
return
getMemoryFile
(
fileName
).
getLastModified
();
return
getMemoryFile
(
fileName
).
getLastModified
();
}
}
...
@@ -188,8 +183,8 @@ public class FileSystemMemory extends FileSystem {
...
@@ -188,8 +183,8 @@ public class FileSystemMemory extends FileSystem {
}
}
public
boolean
fileStartsWith
(
String
fileName
,
String
prefix
)
{
public
boolean
fileStartsWith
(
String
fileName
,
String
prefix
)
{
fileName
=
normalize
(
fileName
);
fileName
=
getCanonicalPath
(
fileName
);
prefix
=
normalize
(
prefix
);
prefix
=
getCanonicalPath
(
prefix
);
return
fileName
.
startsWith
(
prefix
);
return
fileName
.
startsWith
(
prefix
);
}
}
...
@@ -215,7 +210,7 @@ public class FileSystemMemory extends FileSystem {
...
@@ -215,7 +210,7 @@ public class FileSystemMemory extends FileSystem {
}
}
private
FileObjectMemoryData
getMemoryFile
(
String
fileName
)
{
private
FileObjectMemoryData
getMemoryFile
(
String
fileName
)
{
fileName
=
normalize
(
fileName
);
fileName
=
getCanonicalPath
(
fileName
);
synchronized
(
MEMORY_FILES
)
{
synchronized
(
MEMORY_FILES
)
{
FileObjectMemoryData
m
=
MEMORY_FILES
.
get
(
fileName
);
FileObjectMemoryData
m
=
MEMORY_FILES
.
get
(
fileName
);
if
(
m
==
null
)
{
if
(
m
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FileSystemWrapper.java
浏览文件 @
e59f6ba5
...
@@ -66,10 +66,6 @@ public abstract class FileSystemWrapper extends FileSystem {
...
@@ -66,10 +66,6 @@ public abstract class FileSystemWrapper extends FileSystem {
return
IOUtils
.
fileStartsWith
(
unwrap
(
fileName
),
unwrap
(
prefix
));
return
IOUtils
.
fileStartsWith
(
unwrap
(
fileName
),
unwrap
(
prefix
));
}
}
public
String
getAbsolutePath
(
String
fileName
)
{
return
wrap
(
IOUtils
.
getAbsolutePath
(
unwrap
(
fileName
)));
}
public
String
getFileName
(
String
name
)
{
public
String
getFileName
(
String
name
)
{
return
IOUtils
.
getFileName
(
unwrap
(
name
));
return
IOUtils
.
getFileName
(
unwrap
(
name
));
}
}
...
@@ -106,8 +102,8 @@ public abstract class FileSystemWrapper extends FileSystem {
...
@@ -106,8 +102,8 @@ public abstract class FileSystemWrapper extends FileSystem {
return
array
;
return
array
;
}
}
public
String
normalize
(
String
fileName
)
{
public
String
getCanonicalPath
(
String
fileName
)
{
return
wrap
(
IOUtils
.
normalize
(
unwrap
(
fileName
)));
return
wrap
(
IOUtils
.
getCanonicalPath
(
unwrap
(
fileName
)));
}
}
public
InputStream
openFileInputStream
(
String
fileName
)
throws
IOException
{
public
InputStream
openFileInputStream
(
String
fileName
)
throws
IOException
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/store/fs/FileSystemZip.java
浏览文件 @
e59f6ba5
...
@@ -77,10 +77,6 @@ public class FileSystemZip extends FileSystem {
...
@@ -77,10 +77,6 @@ public class FileSystemZip extends FileSystem {
return
fileName
.
startsWith
(
prefix
);
return
fileName
.
startsWith
(
prefix
);
}
}
public
String
getAbsolutePath
(
String
fileName
)
{
return
fileName
;
}
public
String
getFileName
(
String
name
)
{
public
String
getFileName
(
String
name
)
{
name
=
getEntryName
(
name
);
name
=
getEntryName
(
name
);
if
(
name
.
endsWith
(
"/"
))
{
if
(
name
.
endsWith
(
"/"
))
{
...
@@ -189,7 +185,7 @@ public class FileSystemZip extends FileSystem {
...
@@ -189,7 +185,7 @@ public class FileSystemZip extends FileSystem {
}
}
}
}
public
String
normalize
(
String
fileName
)
{
public
String
getCanonicalPath
(
String
fileName
)
{
return
fileName
;
return
fileName
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Backup.java
浏览文件 @
e59f6ba5
...
@@ -122,7 +122,7 @@ public class Backup extends Tool {
...
@@ -122,7 +122,7 @@ public class Backup extends Tool {
if
(!
quiet
)
{
if
(!
quiet
)
{
FileLister
.
tryUnlockDatabase
(
list
,
"backup"
);
FileLister
.
tryUnlockDatabase
(
list
,
"backup"
);
}
}
zipFileName
=
IOUtils
.
normalize
(
zipFileName
);
zipFileName
=
IOUtils
.
getCanonicalPath
(
zipFileName
);
if
(
IOUtils
.
exists
(
zipFileName
))
{
if
(
IOUtils
.
exists
(
zipFileName
))
{
IOUtils
.
delete
(
zipFileName
);
IOUtils
.
delete
(
zipFileName
);
}
}
...
@@ -138,7 +138,7 @@ public class Backup extends Tool {
...
@@ -138,7 +138,7 @@ public class Backup extends Tool {
}
}
}
}
for
(
String
fileName
:
list
)
{
for
(
String
fileName
:
list
)
{
String
f
=
IOUtils
.
get
Absolute
Path
(
fileName
);
String
f
=
IOUtils
.
get
Canonical
Path
(
fileName
);
if
(!
f
.
startsWith
(
base
))
{
if
(!
f
.
startsWith
(
base
))
{
DbException
.
throwInternalError
(
f
+
" does not start with "
+
base
);
DbException
.
throwInternalError
(
f
+
" does not start with "
+
base
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/IOUtils.java
浏览文件 @
e59f6ba5
...
@@ -587,8 +587,8 @@ public class IOUtils {
...
@@ -587,8 +587,8 @@ public class IOUtils {
* @param fileName the file name
* @param fileName the file name
* @return the normalized file name
* @return the normalized file name
*/
*/
public
static
String
normalize
(
String
fileName
)
{
public
static
String
getCanonicalPath
(
String
fileName
)
{
return
getFileSystem
(
fileName
).
normalize
(
fileName
);
return
getFileSystem
(
fileName
).
getCanonicalPath
(
fileName
);
}
}
/**
/**
...
@@ -687,16 +687,6 @@ public class IOUtils {
...
@@ -687,16 +687,6 @@ public class IOUtils {
return
getFileSystem
(
fileName
).
isAbsolute
(
fileName
);
return
getFileSystem
(
fileName
).
isAbsolute
(
fileName
);
}
}
/**
* Get the absolute file name.
*
* @param fileName the file name
* @return the absolute file name
*/
public
static
String
getAbsolutePath
(
String
fileName
)
{
return
getFileSystem
(
fileName
).
getAbsolutePath
(
fileName
);
}
/**
/**
* Check if a file starts with a given prefix.
* Check if a file starts with a given prefix.
*
*
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/value/ValueLob.java
浏览文件 @
e59f6ba5
...
@@ -235,7 +235,7 @@ public class ValueLob extends Value {
...
@@ -235,7 +235,7 @@ public class ValueLob extends Value {
name
=
SysProperties
.
FILE_SEPARATOR
+
f
+
Constants
.
SUFFIX_LOBS_DIRECTORY
+
name
;
name
=
SysProperties
.
FILE_SEPARATOR
+
f
+
Constants
.
SUFFIX_LOBS_DIRECTORY
+
name
;
objectId
/=
SysProperties
.
LOB_FILES_PER_DIRECTORY
;
objectId
/=
SysProperties
.
LOB_FILES_PER_DIRECTORY
;
}
}
name
=
IOUtils
.
normalize
(
path
+
Constants
.
SUFFIX_LOBS_DIRECTORY
+
name
);
name
=
IOUtils
.
getCanonicalPath
(
path
+
Constants
.
SUFFIX_LOBS_DIRECTORY
+
name
);
return
name
;
return
name
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/FileSystemDatabase.java
浏览文件 @
e59f6ba5
...
@@ -352,7 +352,7 @@ public class FileSystemDatabase extends FileSystem {
...
@@ -352,7 +352,7 @@ public class FileSystemDatabase extends FileSystem {
}
}
}
}
public
String
normalize
(
String
fileName
)
{
public
String
getCanonicalPath
(
String
fileName
)
{
return
fileName
;
return
fileName
;
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/unit/TestFileSystem.java
浏览文件 @
e59f6ba5
...
@@ -48,7 +48,7 @@ public class TestFileSystem extends TestBase {
...
@@ -48,7 +48,7 @@ public class TestFileSystem extends TestBase {
testDatabaseInJar
();
testDatabaseInJar
();
// set default part size to 1 << 10
// set default part size to 1 << 10
String
f
=
"split:10:"
+
getBaseDir
()
+
"/fs"
;
String
f
=
"split:10:"
+
getBaseDir
()
+
"/fs"
;
FileSystem
.
getInstance
(
f
).
get
Absolute
Path
(
f
);
FileSystem
.
getInstance
(
f
).
get
Canonical
Path
(
f
);
testFileSystem
(
getBaseDir
()
+
"/fs"
);
testFileSystem
(
getBaseDir
()
+
"/fs"
);
testFileSystem
(
FileSystemMemory
.
PREFIX
);
testFileSystem
(
FileSystemMemory
.
PREFIX
);
FileSystemDatabase
fs
=
FileSystemDatabase
.
register
(
"jdbc:h2:mem:fs"
);
FileSystemDatabase
fs
=
FileSystemDatabase
.
register
(
"jdbc:h2:mem:fs"
);
...
@@ -165,7 +165,7 @@ public class TestFileSystem extends TestBase {
...
@@ -165,7 +165,7 @@ public class TestFileSystem extends TestBase {
private
void
testUserHome
()
{
private
void
testUserHome
()
{
FileSystem
fs
=
FileSystem
.
getInstance
(
"~/test"
);
FileSystem
fs
=
FileSystem
.
getInstance
(
"~/test"
);
String
fileName
=
fs
.
get
Absolute
Path
(
"~/test"
);
String
fileName
=
fs
.
get
Canonical
Path
(
"~/test"
);
String
userDir
=
System
.
getProperty
(
"user.home"
);
String
userDir
=
System
.
getProperty
(
"user.home"
);
assertTrue
(
fileName
.
startsWith
(
userDir
));
assertTrue
(
fileName
.
startsWith
(
userDir
));
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/test/org/h2/test/utils/DebugFileSystem.java
浏览文件 @
e59f6ba5
...
@@ -105,11 +105,6 @@ public class DebugFileSystem extends FileSystemWrapper {
...
@@ -105,11 +105,6 @@ public class DebugFileSystem extends FileSystemWrapper {
return
super
.
fileStartsWith
(
fileName
,
prefix
);
return
super
.
fileStartsWith
(
fileName
,
prefix
);
}
}
public
String
getAbsolutePath
(
String
fileName
)
{
trace
(
fileName
,
"getAbsolutePath"
);
return
super
.
getAbsolutePath
(
fileName
);
}
public
String
getFileName
(
String
name
)
{
public
String
getFileName
(
String
name
)
{
trace
(
name
,
"getFileName"
);
trace
(
name
,
"getFileName"
);
return
super
.
getFileName
(
name
);
return
super
.
getFileName
(
name
);
...
@@ -155,9 +150,9 @@ public class DebugFileSystem extends FileSystemWrapper {
...
@@ -155,9 +150,9 @@ public class DebugFileSystem extends FileSystemWrapper {
return
super
.
listFiles
(
directory
);
return
super
.
listFiles
(
directory
);
}
}
public
String
normalize
(
String
fileName
)
{
public
String
getCanonicalPath
(
String
fileName
)
{
trace
(
fileName
,
"normalize"
);
trace
(
fileName
,
"normalize"
);
return
super
.
normalize
(
fileName
);
return
super
.
getCanonicalPath
(
fileName
);
}
}
public
InputStream
openFileInputStream
(
String
fileName
)
throws
IOException
{
public
InputStream
openFileInputStream
(
String
fileName
)
throws
IOException
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
浏览文件 @
e59f6ba5
...
@@ -328,7 +328,7 @@ public class FtpServer extends Tool implements Service {
...
@@ -328,7 +328,7 @@ public class FtpServer extends Tool implements Service {
if
(
"-ftpPort"
.
equals
(
a
))
{
if
(
"-ftpPort"
.
equals
(
a
))
{
port
=
Integer
.
decode
(
args
[++
i
]);
port
=
Integer
.
decode
(
args
[++
i
]);
}
else
if
(
"-ftpDir"
.
equals
(
a
))
{
}
else
if
(
"-ftpDir"
.
equals
(
a
))
{
root
=
IOUtils
.
normalize
(
args
[++
i
]);
root
=
IOUtils
.
getCanonicalPath
(
args
[++
i
]);
}
else
if
(
"-ftpRead"
.
equals
(
a
))
{
}
else
if
(
"-ftpRead"
.
equals
(
a
))
{
readUserName
=
args
[++
i
];
readUserName
=
args
[++
i
];
}
else
if
(
"-ftpWrite"
.
equals
(
a
))
{
}
else
if
(
"-ftpWrite"
.
equals
(
a
))
{
...
@@ -353,7 +353,7 @@ public class FtpServer extends Tool implements Service {
...
@@ -353,7 +353,7 @@ public class FtpServer extends Tool implements Service {
public
void
start
()
{
public
void
start
()
{
fs
=
FileSystem
.
getInstance
(
root
);
fs
=
FileSystem
.
getInstance
(
root
);
root
=
fs
.
normalize
(
root
);
root
=
fs
.
getCanonicalPath
(
root
);
fs
.
mkdirs
(
root
);
fs
.
mkdirs
(
root
);
serverSocket
=
NetUtils
.
createServerSocket
(
port
,
false
);
serverSocket
=
NetUtils
.
createServerSocket
(
port
,
false
);
port
=
serverSocket
.
getLocalPort
();
port
=
serverSocket
.
getLocalPort
();
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论