PolicyTool Tiny Behavior Change

PolicyTool is the only GUI tool included in the JRE, which is used to generate a policy file for Java security permission management. You can use the tool to create a policy file or edit an existing one.

The "Save As" command of the tool opens a file save dialog, let you choose a file, and save the current policy into that file. When the file you choose already exists, the tool will issue a warning asking you if you want to overwrite it.

Here comes the problem, back in the old days, the file save dialog is drawn by Java itself, and it does not care about file overwriting at all. Therefore, it's the PolicyTool itself showing the prompt of overwrite warning. Nowadays, the file save dialog is loaded using the standard dialog of the native platforms, say, Windows style, GTK style, Mac style, etc, etc. This is nice, because people are familiar with those dialogs on their platforms and each of them provides some nice features on locating and navigating through the file system. But, there is one issue, as far as I know, all of these Save As dialogs already provide the overwrite warning feature internally, that is to say, when you click OK there, before the dialog closes, it warns you about possible file overwriting. Now in PolicyTool, you see the warning and click YES, the save file dialog is closed, but then, PolicyTool warns you again and you have to click another YES button. This is quite confusing as well as frustrating.

Therefore we remove PolicyTool's warning dialog in JDK 7. The client/awt guys are also looking through all Save As dialogs on different platforms, to make sure the behavior is the same.

The lesson is: there is much more to care about in an API design. A spec can be never too complicated. I mean the java.awt.FileDialog class.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

This blog has a comments managing system that requires me to approve each comment manually. Please do not re-post and I will reply it (if I have an answer) when I get pinged.

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today