[rfc][icedtea-web] PolicyEditor NPE-on-save fix
Andrew Azores
aazores at redhat.com
Wed May 21 13:51:14 UTC 2014
Hi,
Currently, PolicyEditor has an NPE bug which can be reproduced as follows:
1) Open PolicyEditor with no arguments
2) Select and deselect a checkbox
3) Click "Close"
4) "Yes" to save changes before exiting
5) NPE occurs
I think this is a regression from the
PolicyEditorFrame/PolicyEditorDialog refactor, but I'm not sure of that
as it doesn't seem worth the time to go back and check anyway. The
problem is just that the quit() methods provided by these two classes do
not verify that there is a File to save to before attempting to save to
that file, so unless PolicyEditor is opened with a file path argument or
the user specifically uses the Open or Save/Save As options, no file
will ever be selected to save to, hence the NPE in the savePolicyFile
method. The attached patch simply performs a check in the quit() methods
and adds a file chooser dialog if the file has not yet been selected and
the user chooses to save their changes.
After applying the patch, the NPE in (5) should no longer occur, and a
file chooser should appear instead, allowing the file to be saved to the
desired location.
ChangeLog:
* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
(quit): select file to save to using fileChooser if file is null
Thanks,
--
Andrew A
-------------- next part --------------
A non-text attachment was scrubbed...
Name: policyeditor-save-npe.patch
Type: text/x-patch
Size: 1959 bytes
Desc: not available
URL: <http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20140521/4131bbfb/policyeditor-save-npe.patch>
More information about the distro-pkg-dev
mailing list