Mercurial > hg > release > icedtea-web-1.5
changeset 959:8417559b6a12
Fix NPE on Open action when changes have been made and are to be saved
Fix NPE when trying to open a new file, with changes made, and wanting to
save these changes to a file
* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java:
(openButtonAction) display Save As file chooser if there is no file object
yet and user wishes to save changes
author | Andrew Azores <aazores@redhat.com> |
---|---|
date | Thu, 27 Mar 2014 11:16:58 -0400 |
parents | e9f222be36b5 |
children | cfe6aca11b12 |
files | ChangeLog netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java |
diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Mar 27 11:13:41 2014 -0400 +++ b/ChangeLog Thu Mar 27 11:16:58 2014 -0400 @@ -1,3 +1,11 @@ +2014-03-27 Andrew Azores <aazores@redhat.com> + + Fix NPE when trying to open a new file, with changes made, and wanting to + save these changes to a file + * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java: + (openButtonAction) display Save As file chooser if there is no file object + yet and user wishes to save changes + 2014-03-27 Andrew Azores <aazores@redhat.com> Fix bug with checkboxes not correctly updating on open and with repeats of
--- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java Thu Mar 27 11:13:41 2014 -0400 +++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java Thu Mar 27 11:16:58 2014 -0400 @@ -285,6 +285,14 @@ if (changesMade) { final int save = JOptionPane.showConfirmDialog(weakThis.get(), R("PESaveChanges")); if (save == JOptionPane.YES_OPTION) { + if (file == null) { + final int choice = fileChooser.showSaveDialog(weakThis.get()); + if (choice == JFileChooser.APPROVE_OPTION) { + file = fileChooser.getSelectedFile(); + } else if (choice == JFileChooser.CANCEL_OPTION) { + return; + } + } savePolicyFile(); } else if (save == JOptionPane.CANCEL_OPTION) { return;