Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2008-05-06 12:52:30 -0400
committerThomas Watson2008-05-06 12:52:30 -0400
commit884189772c6e8fcadb32db4b3426e8b2f6c9839d (patch)
treed673a1e39bbf8abda3a217f78ac322a11155fc9b /bundles
parentc471ad52cfce8a96beb85b518e1157e6af42becc (diff)
downloadrt.equinox.framework-884189772c6e8fcadb32db4b3426e8b2f6c9839d.tar.gz
rt.equinox.framework-884189772c6e8fcadb32db4b3426e8b2f6c9839d.tar.xz
rt.equinox.framework-884189772c6e8fcadb32db4b3426e8b2f6c9839d.zip
Bug 229704 DefaultAuthorizationEngine should include version information in the property filev20080506-1745
Diffstat (limited to 'bundles')
-rw-r--r--bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java28
1 files changed, 24 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java
index e64a29c6b..06fa317ec 100644
--- a/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java
+++ b/bundles/org.eclipse.osgi/security/src/org/eclipse/osgi/internal/service/security/DefaultAuthorizationEngine.java
@@ -25,11 +25,14 @@ import org.eclipse.osgi.internal.signedcontent.SignedStorageHook;
import org.eclipse.osgi.service.resolver.*;
import org.eclipse.osgi.signedcontent.SignedContent;
import org.eclipse.osgi.signedcontent.SignerInfo;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
+import org.osgi.framework.*;
public class DefaultAuthorizationEngine extends AuthorizationEngine {
+ private static final String VERSION_PROP = "Version"; //$NON-NLS-1$
+ private static final String VERSION_NUM = "1.0"; //$NON-NLS-1$
+ private static final Version VERSION_MAX = new Version(2, 0, 0);
+
private final State systemState;
private final BundleContext bundleContext;
@@ -64,8 +67,24 @@ public class DefaultAuthorizationEngine extends AuthorizationEngine {
}
}
- if (properties != null && properties.getProperty(POLICY_PROP) != null) {
- enforceFlags = Integer.parseInt(properties.getProperty(POLICY_PROP));
+ if (properties != null) {
+ Version version = new Version(0, 0, 0);
+ String versionProp = properties.getProperty(VERSION_PROP);
+ if (versionProp != null)
+ try {
+ version = new Version(versionProp);
+ } catch (IllegalArgumentException e) {
+ // do nothing;
+ }
+ if (versionProp == null || VERSION_MAX.compareTo(new Version(versionProp)) > 0) {
+ String policy = properties.getProperty(POLICY_PROP);
+ if (policy != null)
+ try {
+ enforceFlags = Integer.parseInt(policy);
+ } catch (NumberFormatException e) {
+ // do nothing;
+ }
+ }
} else {
String policy = FrameworkProperties.getProperty(POLICY_PROP);
if (policy == null || STR_ENFORCE_NONE.equals(policy))
@@ -152,6 +171,7 @@ public class DefaultAuthorizationEngine extends AuthorizationEngine {
enforceFlags = policy;
Properties properties = new Properties();
properties.setProperty(POLICY_PROP, Integer.toString(policy));
+ properties.setProperty(VERSION_PROP, VERSION_NUM); // need to act different when we have different versions
try {
properties.store(new FileOutputStream(policyFile), null);
} catch (IOException e) {

Back to the top