Mercurial > hg > release > icedtea-web-1.5
changeset 933:abec2ce76cdb
PolicyEditor: avoid NPE when saving to a new file
* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java:
(savePolicyFile, updateMd5WithDialog) avoid NPE when saving to a new file
author | Andrew Azores <aazores@redhat.com> |
---|---|
date | Thu, 13 Mar 2014 11:52:14 -0400 |
parents | 71a87178ff7e |
children | dfc27d4d55d5 |
files | ChangeLog netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Mar 13 16:43:45 2014 +0100 +++ b/ChangeLog Thu Mar 13 11:52:14 2014 -0400 @@ -1,3 +1,8 @@ +2014-03-13 Andrew Azores <aazores@redhat.com> + + * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java: + (savePolicyFile, updateMd5WithDialog) avoid NPE when saving to a new file + 2014-03-13 Jiri Vanek <jvanek@redhat.com> * tests/netx/unit/net/sourceforge/jnlp/runtime/JNLPClassLoaderTest.java: adapted
--- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java Thu Mar 13 16:43:45 2014 +0100 +++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java Thu Mar 13 11:52:14 2014 -0400 @@ -984,6 +984,9 @@ try { FileUtils.saveFile(sb.toString(), file); + if (fileWatcher == null) { + fileWatcher = new MD5SumWatcher(file); + } fileWatcher.update(); changesMade = false; showChangesSavedDialog(); @@ -1026,6 +1029,12 @@ * @throws IOException if the file cannot be read */ public int updateMd5WithDialog() throws FileNotFoundException, IOException { + if (fileWatcher == null) { + if (file != null) { + fileWatcher = new MD5SumWatcher(file); + } + return JOptionPane.NO_OPTION; + } final boolean changed = fileWatcher.update(); if (changed) { return JOptionPane.showConfirmDialog(weakThis.get(), R("PEFileModifiedDetail", file.getCanonicalPath()),