Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
a9ffb7e8
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看板
提交
a9ffb7e8
编写于
12月 07, 2010
作者:
W
weijun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
6986825: policytool can not save file.
Reviewed-by: wetmore
上级
47d11269
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
28 addition
and
140 deletion
+28
-140
src/share/classes/sun/security/tools/policytool/PolicyTool.java
...are/classes/sun/security/tools/policytool/PolicyTool.java
+28
-140
未找到文件。
src/share/classes/sun/security/tools/policytool/PolicyTool.java
浏览文件 @
a9ffb7e8
...
...
@@ -49,7 +49,7 @@ import javax.security.auth.x500.X500Principal;
/**
* PolicyTool may be used by users and administrators to configure the
* overall java security policy (currently stored in the policy file).
* Using PolicyTool administators may add and remove policies from
* Using PolicyTool administ
r
ators may add and remove policies from
* the policy file. <p>
*
* @see java.security.Policy
...
...
@@ -1343,11 +1343,6 @@ class ToolDialog extends Dialog {
PolicyTool
.
rb
.
getString
(
"Actions."
);
/* gridbag index for display OverWriteFile (OW) components */
public
static
final
int
OW_LABEL
=
0
;
public
static
final
int
OW_OK_BUTTON
=
1
;
public
static
final
int
OW_CANCEL_BUTTON
=
2
;
/* gridbag index for display PolicyEntry (PE) components */
public
static
final
int
PE_CODEBASE_LABEL
=
0
;
public
static
final
int
PE_CODEBASE_TEXTFIELD
=
1
;
...
...
@@ -1522,44 +1517,6 @@ class ToolDialog extends Dialog {
return
null
;
}
/**
* ask user if they want to overwrite an existing file
*/
void
displayOverWriteFileDialog
(
String
filename
,
int
nextEvent
)
{
// find where the PolicyTool gui is
Point
location
=
tw
.
getLocationOnScreen
();
setBounds
(
location
.
x
+
75
,
location
.
y
+
100
,
400
,
150
);
setLayout
(
new
GridBagLayout
());
// ask the user if they want to over write the existing file
MessageFormat
form
=
new
MessageFormat
(
PolicyTool
.
rb
.
getString
(
"OK.to.overwrite.existing.file.filename."
));
Object
[]
source
=
{
filename
};
Label
label
=
new
Label
(
form
.
format
(
source
));
tw
.
addNewComponent
(
this
,
label
,
OW_LABEL
,
0
,
0
,
2
,
1
,
0.0
,
0.0
,
GridBagConstraints
.
BOTH
,
tw
.
TOP_PADDING
);
// OK button
Button
button
=
new
Button
(
PolicyTool
.
rb
.
getString
(
"OK"
));
button
.
addActionListener
(
new
OverWriteFileOKButtonListener
(
tool
,
tw
,
this
,
filename
,
nextEvent
));
tw
.
addNewComponent
(
this
,
button
,
OW_OK_BUTTON
,
0
,
1
,
1
,
1
,
0.0
,
0.0
,
GridBagConstraints
.
VERTICAL
,
tw
.
TOP_PADDING
);
// Cancel button
// -- if the user hits cancel, do NOT go on to the next event
button
=
new
Button
(
PolicyTool
.
rb
.
getString
(
"Cancel"
));
button
.
addActionListener
(
new
CancelButtonListener
(
this
));
tw
.
addNewComponent
(
this
,
button
,
OW_CANCEL_BUTTON
,
1
,
1
,
1
,
1
,
0.0
,
0.0
,
GridBagConstraints
.
VERTICAL
,
tw
.
TOP_PADDING
);
setVisible
(
true
);
}
/**
* pop up a dialog so the user can enter info to add a new PolicyEntry
* - if edit is TRUE, then the user is editing an existing entry
...
...
@@ -2339,17 +2296,10 @@ class ToolDialog extends Dialog {
return
;
// get the entered filename
String
filename
=
new
String
(
fd
.
getDirectory
()
+
fd
.
getFile
());
File
saveAsFile
=
new
File
(
fd
.
getDirectory
(),
fd
.
getFile
());
String
filename
=
saveAsFile
.
getPath
();
fd
.
dispose
();
// see if the file already exists
File
saveAsFile
=
new
File
(
filename
);
if
(
saveAsFile
.
exists
())
{
// display a dialog box for the user to enter policy info
ToolDialog
td
=
new
ToolDialog
(
PolicyTool
.
rb
.
getString
(
"Overwrite.File"
),
tool
,
tw
,
true
);
td
.
displayOverWriteFileDialog
(
filename
,
nextEvent
);
}
else
{
try
{
// save the policy entries to a file
tool
.
savePolicy
(
filename
);
...
...
@@ -2381,7 +2331,6 @@ class ToolDialog extends Dialog {
tw
.
displayErrorDialog
(
null
,
ee
);
}
}
}
/**
* ask user if they want to save changes
...
...
@@ -2494,7 +2443,7 @@ class ToolDialog extends Dialog {
return
;
// get the entered filename
String
policyFile
=
new
String
(
fd
.
getDirectory
()
+
fd
.
getFile
()
);
String
policyFile
=
new
File
(
fd
.
getDirectory
(),
fd
.
getFile
()).
getPath
(
);
try
{
// open the policy file
...
...
@@ -2861,67 +2810,6 @@ class MainWindowListener implements ActionListener {
}
}
/**
* Event handler for OverWriteFileOKButton button
*/
class
OverWriteFileOKButtonListener
implements
ActionListener
{
private
PolicyTool
tool
;
private
ToolWindow
tw
;
private
ToolDialog
td
;
private
String
filename
;
private
int
nextEvent
;
OverWriteFileOKButtonListener
(
PolicyTool
tool
,
ToolWindow
tw
,
ToolDialog
td
,
String
filename
,
int
nextEvent
)
{
this
.
tool
=
tool
;
this
.
tw
=
tw
;
this
.
td
=
td
;
this
.
filename
=
filename
;
this
.
nextEvent
=
nextEvent
;
}
public
void
actionPerformed
(
ActionEvent
e
)
{
try
{
// save the policy entries to a file
tool
.
savePolicy
(
filename
);
// display status
MessageFormat
form
=
new
MessageFormat
(
PolicyTool
.
rb
.
getString
(
"Policy.successfully.written.to.filename"
));
Object
[]
source
=
{
filename
};
tw
.
displayStatusDialog
(
null
,
form
.
format
(
source
));
// display the new policy filename
TextField
newFilename
=
(
TextField
)
tw
.
getComponent
(
tw
.
MW_FILENAME_TEXTFIELD
);
newFilename
.
setText
(
filename
);
tw
.
setVisible
(
true
);
// now continue with the originally requested command
// (QUIT, NEW, or OPEN)
td
.
setVisible
(
false
);
td
.
dispose
();
td
.
userSaveContinue
(
tool
,
tw
,
td
,
nextEvent
);
}
catch
(
FileNotFoundException
fnfe
)
{
if
(
filename
==
null
||
filename
.
equals
(
""
))
{
tw
.
displayErrorDialog
(
null
,
new
FileNotFoundException
(
PolicyTool
.
rb
.
getString
(
"null.filename"
)));
}
else
{
tw
.
displayErrorDialog
(
null
,
fnfe
);
}
td
.
setVisible
(
false
);
td
.
dispose
();
}
catch
(
Exception
ee
)
{
tw
.
displayErrorDialog
(
null
,
ee
);
td
.
setVisible
(
false
);
td
.
dispose
();
}
}
}
/**
* Event handler for AddEntryDoneButton button
*
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录