Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2010-02-25 15:30:29 -0500
committerThomas Watson2010-02-25 15:30:29 -0500
commit2efa032c6a0899dc8084839de9e9e1f8f7547482 (patch)
tree2837761d02261843495595d89a01558a7b2cc25a
parent7779a9e75d92509967ed6542eaf97b8de4b84f56 (diff)
downloadrt.equinox.framework-2efa032c6a0899dc8084839de9e9e1f8f7547482.tar.gz
rt.equinox.framework-2efa032c6a0899dc8084839de9e9e1f8f7547482.tar.xz
rt.equinox.framework-2efa032c6a0899dc8084839de9e9e1f8f7547482.zip
Bug 303930 - ConditionalPermissionInfo.addConditionalPermissionInfo must add rule to the beginning of list
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java
index a8b3892d9..cc369b1d6 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/permadmin/SecurityAdmin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -291,23 +291,22 @@ public final class SecurityAdmin implements PermissionAdmin, ConditionalPermissi
private ConditionalPermissionInfo setConditionalPermissionInfo(String name, ConditionInfo[] conds, PermissionInfo[] perms, boolean firstTry) {
ConditionalPermissionUpdate update = newConditionalPermissionUpdate();
List rows = update.getConditionalPermissionInfos();
- ConditionalPermissionInfo infoBase = newConditionalPermissionInfo(name, conds, perms, ConditionalPermissionInfo.ALLOW);
+ ConditionalPermissionInfo newInfo = newConditionalPermissionInfo(name, conds, perms, ConditionalPermissionInfo.ALLOW);
int index = -1;
- if (name == null) {
- rows.add(infoBase);
- index = rows.size() - 1;
- } else {
+ if (name != null) {
for (int i = 0; i < rows.size() && index < 0; i++) {
ConditionalPermissionInfo info = (ConditionalPermissionInfo) rows.get(i);
if (name.equals(info.getName())) {
- rows.set(i, infoBase);
index = i;
}
}
- if (index < 0) {
- rows.add(infoBase);
- index = rows.size() - 1;
- }
+ }
+ if (index < 0) {
+ // must always add to the beginning (bug 303930)
+ rows.add(0, newInfo);
+ index = 0;
+ } else {
+ rows.set(index, newInfo);
}
synchronized (lock) {
if (!update.commit()) {

Back to the top