Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
ed04a08d
提交
ed04a08d
authored
13 年前
作者:
Thomas Mueller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Server.createTcpServer, createPgServer, createWebServer: invalid arguments are now detected.
上级
6cf432c7
隐藏空白字符变更
内嵌
并排
正在显示
16 个修改的文件
包含
104 行增加
和
23 行删除
+104
-23
Backup.java
h2/src/main/org/h2/tools/Backup.java
+1
-1
ChangeFileEncryption.java
h2/src/main/org/h2/tools/ChangeFileEncryption.java
+1
-1
Console.java
h2/src/main/org/h2/tools/Console.java
+4
-4
ConvertTraceFile.java
h2/src/main/org/h2/tools/ConvertTraceFile.java
+1
-1
CreateCluster.java
h2/src/main/org/h2/tools/CreateCluster.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
Restore.java
h2/src/main/org/h2/tools/Restore.java
+1
-1
RunScript.java
h2/src/main/org/h2/tools/RunScript.java
+1
-1
Script.java
h2/src/main/org/h2/tools/Script.java
+1
-1
Server.java
h2/src/main/org/h2/tools/Server.java
+75
-4
Shell.java
h2/src/main/org/h2/tools/Shell.java
+1
-1
Tool.java
h2/src/main/org/h2/util/Tool.java
+11
-1
FileShell.java
h2/src/tools/org/h2/dev/fs/FileShell.java
+1
-1
FtpServer.java
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
+2
-2
FileViewer.java
h2/src/tools/org/h2/dev/util/FileViewer.java
+1
-1
没有找到文件。
h2/src/main/org/h2/tools/Backup.java
浏览文件 @
ed04a08d
...
@@ -77,7 +77,7 @@ public class Backup extends Tool {
...
@@ -77,7 +77,7 @@ public class Backup extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
try
{
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/ChangeFileEncryption.java
浏览文件 @
ed04a08d
...
@@ -80,7 +80,7 @@ public class ChangeFileEncryption extends Tool {
...
@@ -80,7 +80,7 @@ public class ChangeFileEncryption extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
if
((
encryptPassword
==
null
&&
decryptPassword
==
null
)
||
cipher
==
null
)
{
if
((
encryptPassword
==
null
&&
decryptPassword
==
null
)
||
cipher
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Console.java
浏览文件 @
ed04a08d
...
@@ -146,7 +146,7 @@ ShutdownHandler {
...
@@ -146,7 +146,7 @@ ShutdownHandler {
}
else
if
(
"-webPort"
.
equals
(
arg
))
{
}
else
if
(
"-webPort"
.
equals
(
arg
))
{
i
++;
i
++;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
else
if
(
"-tool"
.
equals
(
arg
))
{
}
else
if
(
"-tool"
.
equals
(
arg
))
{
startDefaultServers
=
false
;
startDefaultServers
=
false
;
...
@@ -177,7 +177,7 @@ ShutdownHandler {
...
@@ -177,7 +177,7 @@ ShutdownHandler {
}
else
if
(
"-tcpShutdownForce"
.
equals
(
arg
))
{
}
else
if
(
"-tcpShutdownForce"
.
equals
(
arg
))
{
tcpShutdownForce
=
true
;
tcpShutdownForce
=
true
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
else
if
(
arg
.
startsWith
(
"-pg"
))
{
}
else
if
(
arg
.
startsWith
(
"-pg"
))
{
if
(
"-pg"
.
equals
(
arg
))
{
if
(
"-pg"
.
equals
(
arg
))
{
...
@@ -190,7 +190,7 @@ ShutdownHandler {
...
@@ -190,7 +190,7 @@ ShutdownHandler {
}
else
if
(
"-pgPort"
.
equals
(
arg
))
{
}
else
if
(
"-pgPort"
.
equals
(
arg
))
{
i
++;
i
++;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
else
if
(
"-properties"
.
equals
(
arg
))
{
}
else
if
(
"-properties"
.
equals
(
arg
))
{
i
++;
i
++;
...
@@ -201,7 +201,7 @@ ShutdownHandler {
...
@@ -201,7 +201,7 @@ ShutdownHandler {
}
else
if
(
"-baseDir"
.
equals
(
arg
))
{
}
else
if
(
"-baseDir"
.
equals
(
arg
))
{
i
++;
i
++;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
if
(
startDefaultServers
)
{
if
(
startDefaultServers
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/ConvertTraceFile.java
浏览文件 @
ed04a08d
...
@@ -93,7 +93,7 @@ public class ConvertTraceFile extends Tool {
...
@@ -93,7 +93,7 @@ public class ConvertTraceFile extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
try
{
try
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/CreateCluster.java
浏览文件 @
ed04a08d
...
@@ -72,7 +72,7 @@ public class CreateCluster extends Tool {
...
@@ -72,7 +72,7 @@ public class CreateCluster extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
if
(
urlSource
==
null
||
urlTarget
==
null
||
serverList
==
null
)
{
if
(
urlSource
==
null
||
urlTarget
==
null
||
serverList
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/DeleteDbFiles.java
浏览文件 @
ed04a08d
...
@@ -58,7 +58,7 @@ public class DeleteDbFiles extends Tool {
...
@@ -58,7 +58,7 @@ public class DeleteDbFiles extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
process
(
dir
,
db
,
quiet
);
process
(
dir
,
db
,
quiet
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Recover.java
浏览文件 @
ed04a08d
...
@@ -167,7 +167,7 @@ public class Recover extends Tool implements DataHandler {
...
@@ -167,7 +167,7 @@ public class Recover extends Tool implements DataHandler {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
process
(
dir
,
db
);
process
(
dir
,
db
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Restore.java
浏览文件 @
ed04a08d
...
@@ -66,7 +66,7 @@ public class Restore extends Tool {
...
@@ -66,7 +66,7 @@ public class Restore extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
execute
(
zipFileName
,
dir
,
db
,
false
);
execute
(
zipFileName
,
dir
,
db
,
false
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/RunScript.java
浏览文件 @
ed04a08d
...
@@ -126,7 +126,7 @@ public class RunScript extends Tool {
...
@@ -126,7 +126,7 @@ public class RunScript extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
if
(
url
==
null
)
{
if
(
url
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Script.java
浏览文件 @
ed04a08d
...
@@ -88,7 +88,7 @@ public class Script extends Tool {
...
@@ -88,7 +88,7 @@ public class Script extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
if
(
url
==
null
)
{
if
(
url
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Server.java
浏览文件 @
ed04a08d
...
@@ -44,6 +44,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
...
@@ -44,6 +44,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
* @param args the command line arguments
* @param args the command line arguments
*/
*/
public
Server
(
Service
service
,
String
...
args
)
throws
SQLException
{
public
Server
(
Service
service
,
String
...
args
)
throws
SQLException
{
verifyArgs
(
args
);
this
.
service
=
service
;
this
.
service
=
service
;
try
{
try
{
service
.
init
(
args
);
service
.
init
(
args
);
...
@@ -115,6 +116,75 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
...
@@ -115,6 +116,75 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
new
Server
().
runTool
(
args
);
new
Server
().
runTool
(
args
);
}
}
private
void
verifyArgs
(
String
...
args
)
throws
SQLException
{
for
(
int
i
=
0
;
args
!=
null
&&
i
<
args
.
length
;
i
++)
{
String
arg
=
args
[
i
];
if
(
arg
==
null
)
{
continue
;
}
else
if
(
"-?"
.
equals
(
arg
)
||
"-help"
.
equals
(
arg
))
{
// ok
}
else
if
(
arg
.
startsWith
(
"-web"
))
{
if
(
"-web"
.
equals
(
arg
))
{
// ok
}
else
if
(
"-webAllowOthers"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-webDaemon"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-webSSL"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-webPort"
.
equals
(
arg
))
{
i
++;
}
else
{
throwUnsupportedOption
(
arg
);
}
}
else
if
(
"-browser"
.
equals
(
arg
))
{
// ok
}
else
if
(
arg
.
startsWith
(
"-tcp"
))
{
if
(
"-tcp"
.
equals
(
arg
))
{
// ok
}
else
if
(
"-tcpAllowOthers"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-tcpDaemon"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-tcpSSL"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-tcpPort"
.
equals
(
arg
))
{
i
++;
}
else
if
(
"-tcpPassword"
.
equals
(
arg
))
{
i
++;
}
else
if
(
"-tcpShutdown"
.
equals
(
arg
))
{
i
++;
}
else
if
(
"-tcpShutdownForce"
.
equals
(
arg
))
{
// ok
}
else
{
throwUnsupportedOption
(
arg
);
}
}
else
if
(
arg
.
startsWith
(
"-pg"
))
{
if
(
"-pg"
.
equals
(
arg
))
{
// ok
}
else
if
(
"-pgAllowOthers"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-pgDaemon"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-pgPort"
.
equals
(
arg
))
{
i
++;
}
else
{
throwUnsupportedOption
(
arg
);
}
}
else
if
(
"-properties"
.
equals
(
arg
))
{
i
++;
}
else
if
(
"-trace"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-ifExists"
.
equals
(
arg
))
{
// no parameters
}
else
if
(
"-baseDir"
.
equals
(
arg
))
{
i
++;
}
else
{
throwUnsupportedOption
(
arg
);
}
}
}
public
void
runTool
(
String
...
args
)
throws
SQLException
{
public
void
runTool
(
String
...
args
)
throws
SQLException
{
boolean
tcpStart
=
false
,
pgStart
=
false
,
webStart
=
false
;
boolean
tcpStart
=
false
,
pgStart
=
false
,
webStart
=
false
;
boolean
browserStart
=
false
;
boolean
browserStart
=
false
;
...
@@ -142,7 +212,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
...
@@ -142,7 +212,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
}
else
if
(
"-webPort"
.
equals
(
arg
))
{
}
else
if
(
"-webPort"
.
equals
(
arg
))
{
i
++;
i
++;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
else
if
(
"-browser"
.
equals
(
arg
))
{
}
else
if
(
"-browser"
.
equals
(
arg
))
{
startDefaultServers
=
false
;
startDefaultServers
=
false
;
...
@@ -168,7 +238,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
...
@@ -168,7 +238,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
}
else
if
(
"-tcpShutdownForce"
.
equals
(
arg
))
{
}
else
if
(
"-tcpShutdownForce"
.
equals
(
arg
))
{
tcpShutdownForce
=
true
;
tcpShutdownForce
=
true
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
else
if
(
arg
.
startsWith
(
"-pg"
))
{
}
else
if
(
arg
.
startsWith
(
"-pg"
))
{
if
(
"-pg"
.
equals
(
arg
))
{
if
(
"-pg"
.
equals
(
arg
))
{
...
@@ -181,7 +251,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
...
@@ -181,7 +251,7 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
}
else
if
(
"-pgPort"
.
equals
(
arg
))
{
}
else
if
(
"-pgPort"
.
equals
(
arg
))
{
i
++;
i
++;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
else
if
(
"-properties"
.
equals
(
arg
))
{
}
else
if
(
"-properties"
.
equals
(
arg
))
{
i
++;
i
++;
...
@@ -192,9 +262,10 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
...
@@ -192,9 +262,10 @@ public class Server extends Tool implements Runnable, ShutdownHandler {
}
else
if
(
"-baseDir"
.
equals
(
arg
))
{
}
else
if
(
"-baseDir"
.
equals
(
arg
))
{
i
++;
i
++;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
verifyArgs
(
args
);
if
(
startDefaultServers
)
{
if
(
startDefaultServers
)
{
tcpStart
=
true
;
tcpStart
=
true
;
pgStart
=
true
;
pgStart
=
true
;
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/tools/Shell.java
浏览文件 @
ed04a08d
...
@@ -136,7 +136,7 @@ public class Shell extends Tool implements Runnable {
...
@@ -136,7 +136,7 @@ public class Shell extends Tool implements Runnable {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
if
(
url
!=
null
)
{
if
(
url
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
h2/src/main/org/h2/util/Tool.java
浏览文件 @
ed04a08d
...
@@ -50,8 +50,18 @@ public abstract class Tool {
...
@@ -50,8 +50,18 @@ public abstract class Tool {
* @param option the unsupported option
* @param option the unsupported option
* @return this method never returns normally
* @return this method never returns normally
*/
*/
protected
SQLException
t
hrowUnsupportedOption
(
String
option
)
throws
SQLException
{
protected
SQLException
showUsageAndT
hrowUnsupportedOption
(
String
option
)
throws
SQLException
{
showUsage
();
showUsage
();
throw
throwUnsupportedOption
(
option
);
}
/**
* Throw a SQLException saying this command line option is not supported.
*
* @param option the unsupported option
* @return this method never returns normally
*/
protected
SQLException
throwUnsupportedOption
(
String
option
)
throws
SQLException
{
throw
new
SQLException
(
"Unsupported option: "
+
option
);
throw
new
SQLException
(
"Unsupported option: "
+
option
);
}
}
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/fs/FileShell.java
浏览文件 @
ed04a08d
...
@@ -113,7 +113,7 @@ public class FileShell extends Tool {
...
@@ -113,7 +113,7 @@ public class FileShell extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
promptLoop
();
promptLoop
();
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/ftp/server/FtpServer.java
浏览文件 @
ed04a08d
...
@@ -170,12 +170,12 @@ public class FtpServer extends Tool implements Service {
...
@@ -170,12 +170,12 @@ public class FtpServer extends Tool implements Service {
}
else
if
(
"-ftpTask"
.
equals
(
arg
))
{
}
else
if
(
"-ftpTask"
.
equals
(
arg
))
{
// no parameters
// no parameters
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
else
if
(
"-trace"
.
equals
(
arg
))
{
}
else
if
(
"-trace"
.
equals
(
arg
))
{
// no parameters
// no parameters
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
Server
server
=
new
Server
(
this
,
args
);
Server
server
=
new
Server
(
this
,
args
);
...
...
This diff is collapsed.
Click to expand it.
h2/src/tools/org/h2/dev/util/FileViewer.java
浏览文件 @
ed04a08d
...
@@ -69,7 +69,7 @@ public class FileViewer extends Tool {
...
@@ -69,7 +69,7 @@ public class FileViewer extends Tool {
showUsage
();
showUsage
();
return
;
return
;
}
else
{
}
else
{
t
hrowUnsupportedOption
(
arg
);
showUsageAndT
hrowUnsupportedOption
(
arg
);
}
}
}
}
if
(
file
==
null
)
{
if
(
file
==
null
)
{
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论