Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
33ca45da
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
33ca45da
编写于
7月 19, 2011
作者:
K
ksrini
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7067922: (launcher) java -jar throws NPE if JAR file does not contain Main-Class attribute
Reviewed-by: darcy, ohair, alanb, mduigou
上级
c0de421c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
35 addition
and
12 deletion
+35
-12
src/share/classes/sun/launcher/LauncherHelper.java
src/share/classes/sun/launcher/LauncherHelper.java
+5
-1
test/tools/launcher/Arrrghs.java
test/tools/launcher/Arrrghs.java
+12
-1
test/tools/launcher/TestHelper.java
test/tools/launcher/TestHelper.java
+18
-10
未找到文件。
src/share/classes/sun/launcher/LauncherHelper.java
浏览文件 @
33ca45da
...
...
@@ -396,7 +396,11 @@ public enum LauncherHelper {
if
(
mainAttrs
==
null
)
{
abort
(
ostream
,
null
,
"java.launcher.jar.error3"
,
jarname
);
}
return
mainAttrs
.
getValue
(
MAIN_CLASS
).
trim
();
String
mainValue
=
mainAttrs
.
getValue
(
MAIN_CLASS
);
if
(
mainValue
==
null
)
{
abort
(
ostream
,
null
,
"java.launcher.jar.error3"
,
jarname
);
}
return
mainValue
.
trim
();
}
finally
{
if
(
jarFile
!=
null
)
{
jarFile
.
close
();
...
...
test/tools/launcher/Arrrghs.java
浏览文件 @
33ca45da
...
...
@@ -24,7 +24,7 @@
/**
* @test
* @bug 5030233 6214916 6356475 6571029 6684582 6742159 4459600 6758881 6753938
* 6894719 6968053
* 6894719 6968053
7067922
* @summary Argument parsing validation.
* @compile -XDignore.symbol.file Arrrghs.java TestHelper.java
* @run main Arrrghs
...
...
@@ -362,6 +362,16 @@ public class Arrrghs {
tr
.
checkPositive
();
System
.
out
.
println
(
tr
);
}
static
void
test7067922
()
{
// a missing manifest entry 7067922
TestHelper
.
TestResult
tr
=
null
;
TestHelper
.
createJar
(
"cvf"
,
"missingmainentry.jar"
,
"."
);
tr
=
TestHelper
.
doExec
(
TestHelper
.
javaCmd
,
"-jar"
,
"missingmainentry.jar"
);
tr
.
contains
(
"no main manifest attribute"
);
System
.
out
.
println
(
tr
);
}
/**
* @param args the command line arguments
* @throws java.io.FileNotFoundException
...
...
@@ -374,6 +384,7 @@ public class Arrrghs {
runBasicErrorMessageTests
();
runMainMethodTests
();
test6894719
();
test7067922
();
runDiagOptionTests
();
if
(
TestHelper
.
testExitValue
>
0
)
{
System
.
out
.
println
(
"Total of "
+
TestHelper
.
testExitValue
+
" failed"
);
...
...
test/tools/launcher/TestHelper.java
浏览文件 @
33ca45da
...
...
@@ -171,15 +171,15 @@ public enum TestHelper {
if
(
jarName
.
exists
())
{
jarName
.
delete
();
}
PrintStream
ps
=
new
PrintStream
(
new
FileOutputStream
(
mainClass
+
".java"
));
ps
.
println
(
"public class Foo {"
);
if
(
mainDefs
!=
null
)
{
for
(
String
x
:
mainDefs
)
{
ps
.
println
(
x
);
try
(
PrintStream
ps
=
new
PrintStream
(
new
FileOutputStream
(
mainClass
+
".java"
)))
{
ps
.
println
(
"public class Foo {"
);
if
(
mainDefs
!=
null
)
{
for
(
String
x
:
mainDefs
)
{
ps
.
println
(
x
);
}
}
ps
.
println
(
"}"
);
}
ps
.
println
(
"}"
);
ps
.
close
();
String
compileArgs
[]
=
{
mainClass
+
".java"
...
...
@@ -196,12 +196,20 @@ public enum TestHelper {
mEntry
,
mainClass
.
getName
()
+
".class"
};
createJar
(
jarArgs
);
}
static
void
createJar
(
String
...
args
)
{
sun
.
tools
.
jar
.
Main
jarTool
=
new
sun
.
tools
.
jar
.
Main
(
System
.
out
,
System
.
err
,
"JarCreator"
);
if
(!
jarTool
.
run
(
jarArgs
))
{
throw
new
RuntimeException
(
"jar creation failed "
+
jarName
);
if
(!
jarTool
.
run
(
args
))
{
String
message
=
"jar creation failed with command:"
;
for
(
String
x
:
args
)
{
message
=
message
.
concat
(
" "
+
x
);
}
throw
new
RuntimeException
(
message
);
}
}
}
static
void
copyFile
(
File
src
,
File
dst
)
throws
IOException
{
Path
parent
=
dst
.
toPath
().
getParent
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录