Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBJ Hargrave2008-10-03 12:59:14 +0000
committerBJ Hargrave2008-10-03 12:59:14 +0000
commit437c4421cba93385c7a0cd2aa461f0c74ecd2f53 (patch)
tree5424c943afa056c51f6919abe441277ab7078714
parent3dedc7afe2f312404fff15da63f7fe5945049506 (diff)
downloadrt.equinox.framework-437c4421cba93385c7a0cd2aa461f0c74ecd2f53.tar.gz
rt.equinox.framework-437c4421cba93385c7a0cd2aa461f0c74ecd2f53.tar.xz
rt.equinox.framework-437c4421cba93385c7a0cd2aa461f0c74ecd2f53.zip
ASSIGNED - bug 244625: Implement new service registry hooks (RFC 126)
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244625 small simplification to some methods to reduce nesting in if statements
-rwxr-xr-xbundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java39
1 files changed, 21 insertions, 18 deletions
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
index 38b4c9ca5..0b150a230 100755
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java
@@ -769,11 +769,12 @@ public class ServiceRegistry {
*/
private static void checkRegisterServicePermission(String[] names) {
SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- int len = names.length;
- for (int i = 0; i < len; i++) {
- sm.checkPermission(new ServicePermission(names[i], ServicePermission.REGISTER));
- }
+ if (sm == null) {
+ return;
+ }
+ int len = names.length;
+ for (int i = 0; i < len; i++) {
+ sm.checkPermission(new ServicePermission(names[i], ServicePermission.REGISTER));
}
}
@@ -782,9 +783,10 @@ public class ServiceRegistry {
*/
private static void checkGetServicePermission(String name) {
SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- sm.checkPermission(new ServicePermission(name, ServicePermission.GET));
+ if (sm == null) {
+ return;
}
+ sm.checkPermission(new ServicePermission(name, ServicePermission.GET));
}
/**
@@ -794,19 +796,20 @@ public class ServiceRegistry {
*/
private static void checkGetServicePermission(String[] names) {
SecurityManager sm = System.getSecurityManager();
- if (sm != null) {
- SecurityException se = null;
- int len = names.length;
- for (int i = 0; i < len; i++) {
- try {
- sm.checkPermission(new ServicePermission(names[i], ServicePermission.GET));
- return;
- } catch (SecurityException e) {
- se = e;
- }
+ if (sm == null) {
+ return;
+ }
+ SecurityException se = null;
+ int len = names.length;
+ for (int i = 0; i < len; i++) {
+ try {
+ sm.checkPermission(new ServicePermission(names[i], ServicePermission.GET));
+ return;
+ } catch (SecurityException e) {
+ se = e;
}
- throw se;
}
+ throw se;
}
/**

Back to the top