/hg/release/icedtea-web-1.5: PolicyEditor persists empty non-def...

aazores at icedtea.classpath.org aazores at icedtea.classpath.org
Wed Jun 25 15:33:17 UTC 2014


changeset f6301031c729 in /hg/release/icedtea-web-1.5
details: http://icedtea.classpath.org/hg/release/icedtea-web-1.5?cmd=changeset;node=f6301031c729
author: Andrew Azores <aazores at redhat.com>
date: Wed Jun 25 11:33:07 2014 -0400

	PolicyEditor persists empty non-default codebase entries

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

		PolicyEditor persists empty non-default codebase entries
		* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java
		(toString): return empty string only if the codebase both has no
		permissions assigned and is also the default "All Applets" codebase
		* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
		(savePolicyFile): release fileLock with try/finally
	    * NEWS: updated with this and other PolicyEditor backports


diffstat:

 ChangeLog                                                         |   9 ++
 NEWS                                                              |   4 +
 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java |  34 +++++----
 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java  |   4 +-
 4 files changed, 34 insertions(+), 17 deletions(-)

diffs (93 lines):

diff -r fddbf6a65964 -r f6301031c729 ChangeLog
--- a/ChangeLog	Thu Jun 19 16:33:19 2014 +0200
+++ b/ChangeLog	Wed Jun 25 11:33:07 2014 -0400
@@ -1,3 +1,12 @@
+2014-06-25  Andrew Azores  <aazores at redhat.com>
+
+	PolicyEditor persists empty non-default codebase entries
+	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java
+	(toString): return empty string only if the codebase both has no
+	permissions assigned and is also the default "All Applets" codebase
+	* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
+	(savePolicyFile): release fileLock with try/finally
+
 2014-06-19  Jiri Vanek  <jvanek at redhat.com>
 
 	* NEWS: mentioned All JDKs ability, DE localization and KEY_ENABLE_MANIFEST_ATTRIBUTES_CHECK
diff -r fddbf6a65964 -r f6301031c729 NEWS
--- a/NEWS	Thu Jun 19 16:33:19 2014 +0200
+++ b/NEWS	Wed Jun 25 11:33:07 2014 -0400
@@ -14,6 +14,10 @@
 * Added KEY_ENABLE_MANIFEST_ATTRIBUTES_CHECK deployment property to control scan of Manifest file 
 * Plugin
   - PR1743 - Intermittant deadlock in PluginRequestProcessor
+* PolicyEditor
+  - codebases without permissions assigned save to file anyway (and re-appear on next open)
+  - PR1776: NullPointer on save-and-exit
+  - Custom permissions are properly formatted
 
 New in release 1.5 (2014-04-02):
 * IcedTea-Web now using tagsoup as default (tagsoup dependence) sanitizer for input
diff -r fddbf6a65964 -r f6301031c729 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
--- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java	Thu Jun 19 16:33:19 2014 +0200
+++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java	Wed Jun 25 11:33:07 2014 -0400
@@ -1326,27 +1326,29 @@
                 sb.append("\n/* Generated by PolicyEditor at ").append(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
                               .format(Calendar.getInstance().getTime())).append(" */").append(System.getProperty("line.separator"));
                 final Set<PolicyEditorPermissions> enabledPermissions = new HashSet<PolicyEditorPermissions>();
-                FileLock fileLock;
+                FileLock fileLock = null;
                 try {
                     fileLock = FileUtils.getFileLock(file.getAbsolutePath(), false, true);
-                } catch (final FileNotFoundException e) {
+                    for (final String codebase : codebasePermissionsMap.keySet()) {
+                        enabledPermissions.clear();
+                        for (final Map.Entry<PolicyEditorPermissions, Boolean> entry : codebasePermissionsMap.get(codebase).entrySet()) {
+                            if (entry.getValue()) {
+                                enabledPermissions.add(entry.getKey());
+                            }
+                        }
+                        sb.append(new PolicyEntry(codebase, enabledPermissions, customPermissionsMap.get(codebase)).toString());
+                    }
+
+                } catch (final IOException e) {
                     OutputController.getLogger().log(e);
-                    showCouldNotSaveDialog();
-                    return;
-                }
-                for (final String codebase : codebasePermissionsMap.keySet()) {
-                    enabledPermissions.clear();
-                    for (final Map.Entry<PolicyEditorPermissions, Boolean> entry : codebasePermissionsMap.get(codebase).entrySet()) {
-                        if (entry.getValue()) {
-                            enabledPermissions.add(entry.getKey());
+                } finally {
+                    if (fileLock != null) {
+                        try {
+                            fileLock.release();
+                        } catch (final IOException e) {
+                            OutputController.getLogger().log(e);
                         }
                     }
-                    sb.append(new PolicyEntry(codebase, enabledPermissions, customPermissionsMap.get(codebase)).toString());
-                }
-                try {
-                    fileLock.release();
-                } catch (final IOException e) {
-                    OutputController.getLogger().log(e);
                 }
 
                 try {
diff -r fddbf6a65964 -r f6301031c729 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java
--- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java	Thu Jun 19 16:33:19 2014 +0200
+++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEntry.java	Wed Jun 25 11:33:07 2014 -0400
@@ -69,7 +69,9 @@
 
     @Override
     public String toString() {
-        if (permissions.isEmpty() && customPermissions.isEmpty()) {
+        // Empty codebase is the default "All Applets" codebase. If there are no permissions
+        // applied to it, then don't bother recording it in the policy file.
+        if (codebase.isEmpty() && permissions.isEmpty() && customPermissions.isEmpty()) {
             return "";
         }
         final String newline = System.getProperty("line.separator");


More information about the distro-pkg-dev mailing list