/hg/icedtea-web: PolicyEditor does not add duplicate visual code...
aazores at icedtea.classpath.org
aazores at icedtea.classpath.org
Wed Mar 12 13:47:07 UTC 2014
changeset 9417633d1f86 in /hg/icedtea-web
details: http://icedtea.classpath.org/hg/icedtea-web?cmd=changeset;node=9417633d1f86
author: Andrew Azores <aazores at redhat.com>
date: Wed Mar 12 09:46:59 2014 -0400
PolicyEditor does not add duplicate visual codebases
* netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java:
(initializeMapForCodebase) returns boolean indicating if the given
codebase already existed. (addNewCodebase) do not add codebases if they
already exist
diffstat:
ChangeLog | 7 ++++
netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java | 17 +++++++--
2 files changed, 20 insertions(+), 4 deletions(-)
diffs (63 lines):
diff -r 932c096d423c -r 9417633d1f86 ChangeLog
--- a/ChangeLog Wed Mar 12 09:43:36 2014 -0400
+++ b/ChangeLog Wed Mar 12 09:46:59 2014 -0400
@@ -1,3 +1,10 @@
+2014-03-12 Andrew Azores <aazores at redhat.com>
+
+ * netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java:
+ (initializeMapForCodebase) returns boolean indicating if the given
+ codebase already existed. (addNewCodebase) do not add codebases if they
+ already exist
+
2014-03-12 Andrew Azores <aazores at redhat.com>
* netx/net/sourceforge/jnlp/resources/Messages.properties:
diff -r 932c096d423c -r 9417633d1f86 netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java
--- a/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java Wed Mar 12 09:43:36 2014 -0400
+++ b/netx/net/sourceforge/jnlp/security/policyeditor/PolicyEditor.java Wed Mar 12 09:46:59 2014 -0400
@@ -470,16 +470,18 @@
OutputController.getLogger().log(mfue);
return;
}
- initializeMapForCodebase(codebase);
+ final boolean existingCodebase = initializeMapForCodebase(codebase);
final String model;
if (codebase.isEmpty()) {
model = R("PEGlobalSettings");
} else {
model = codebase;
}
- listModel.addElement(model);
+ if (!existingCodebase) {
+ listModel.addElement(model);
+ changesMade = true;
+ }
list.setSelectedValue(model, true);
- changesMade = true;
}
/**
@@ -897,8 +899,13 @@
* Ensure that the model contains a specified mapping. No action is taken
* if there already is a map with this key
* @param codebase for which a permissions mapping is required
+ * @return true iff there was already an entry for this codebase
*/
- private void initializeMapForCodebase(final String codebase) {
+ private boolean initializeMapForCodebase(final String codebase) {
+ if (codebasePermissionsMap.containsKey(codebase) || customPermissionsMap.containsKey(codebase)) {
+ return true;
+ }
+
if (codebasePermissionsMap.get(codebase) == null) {
final Map<PolicyEditorPermissions, Boolean> map = new HashMap<PolicyEditorPermissions, Boolean>();
for (final PolicyEditorPermissions perm : PolicyEditorPermissions.values()) {
@@ -911,6 +918,8 @@
final Set<CustomPermission> set = new HashSet<CustomPermission>();
customPermissionsMap.put(codebase, set);
}
+
+ return false;
}
/**
More information about the distro-pkg-dev
mailing list