/hg/release/icedtea-web-1.5: Fixed PolicyEditor NullPointer on e...

aazores at icedtea.classpath.org aazores at icedtea.classpath.org
Fri Jun 6 13:35:40 UTC 2014


changeset 476ce40cafc7 in /hg/release/icedtea-web-1.5
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.5?cmd=changeset;node=476ce40cafc7
author: Andrew Azores <aazores at redhat.com>
date: Fri Jun 06 09:35:30 2014 -0400

	Fixed PolicyEditor NullPointer on exit-and-save

	2014-06-06  Andrew Azores  <aazores at redhat.com>

	    Fixed NullPointerException when closing PolicyEditor with changes made and
	    no file yet set (editor opened without arguments), and selecting yes to
	    save changes before exit.
	    * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
	    (quit): if file is null, display file chooser prompt before attempting to save


diffstat:

 ChangeLog                                                         |   8 +++++
 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java |  16 ++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diffs (48 lines):

diff -r 216fe105f338 -r 476ce40cafc7 ChangeLog
--- a/ChangeLog	Tue Apr 15 11:32:04 2014 +0200
+++ b/ChangeLog	Fri Jun 06 09:35:30 2014 -0400
@@ -1,3 +1,11 @@
+2014-06-06  Andrew Azores  <aazores at redhat.com>
+
+	Fixed NullPointerException when closing PolicyEditor with changes made and
+	no file yet set (editor opened without arguments), and selecting yes to
+	save changes before exit.
+	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
+	(quit): if file is null, display file chooser prompt before attempting to save
+
 2014-04-15  Jiri Vanek  <jvanek at redhat.com>
 
 	Reflect possibility of disabled manifest check to unit-test
diff -r 216fe105f338 -r 476ce40cafc7 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
--- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java	Tue Apr 15 11:32:04 2014 +0200
+++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java	Fri Jun 06 09:35:30 2014 -0400
@@ -480,6 +480,14 @@
             if (editor.changesMade) {
                 final int save = JOptionPane.showConfirmDialog(this, R("PESaveChanges"));
                 if (save == JOptionPane.YES_OPTION) {
+                    if (editor.file == null) {
+                        final int choice = editor.fileChooser.showSaveDialog(this);
+                        if (choice == JFileChooser.APPROVE_OPTION) {
+                            editor.file = editor.fileChooser.getSelectedFile();
+                        } else if (choice == JFileChooser.CANCEL_OPTION) {
+                            return;
+                        }
+                    }
                     editor.savePolicyFile();
                 } else if (save == JOptionPane.CANCEL_OPTION) {
                     return;
@@ -545,6 +553,14 @@
             if (editor.changesMade) {
                 final int save = JOptionPane.showConfirmDialog(this, R("PESaveChanges"));
                 if (save == JOptionPane.YES_OPTION) {
+                    if (editor.file == null) {
+                        final int choice = editor.fileChooser.showSaveDialog(this);
+                        if (choice == JFileChooser.APPROVE_OPTION) {
+                            editor.file = editor.fileChooser.getSelectedFile();
+                        } else if (choice == JFileChooser.CANCEL_OPTION) {
+                            return;
+                        }
+                    }
                     editor.savePolicyFile();
                 } else if (save == JOptionPane.CANCEL_OPTION) {
                     return;


More information about the distro-pkg-dev mailing list