PolicyTool Tiny Behavior Change
By Weijun-Oracle on Jan 06, 2011
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.