diff options
author | BJ Hargrave | 2013-05-21 20:23:12 +0000 |
---|---|---|
committer | BJ Hargrave | 2013-05-22 20:57:48 +0000 |
commit | da591a101c0a8a9ba0f8077143998aaebec887ed (patch) | |
tree | 31f75eccda4d6fc03b898107e6f4e5e595b4ff1c | |
parent | 25139a28c94158b7acd3a81fee2d712b1d9b6def (diff) | |
download | rt.equinox.framework-da591a101c0a8a9ba0f8077143998aaebec887ed.tar.gz rt.equinox.framework-da591a101c0a8a9ba0f8077143998aaebec887ed.tar.xz rt.equinox.framework-da591a101c0a8a9ba0f8077143998aaebec887ed.zip |
Use PrivilegedAction<Void> when the action does not return any value
Signed-off-by: BJ Hargrave <hargrave@us.ibm.com>
13 files changed, 47 insertions, 46 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/SecureAction.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/SecureAction.java index 7138c36a5..6b51ba69a 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/SecureAction.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/framework/util/SecureAction.java @@ -435,8 +435,8 @@ public class SecureAction { tracker.open(); return; } - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { tracker.open(); return null; } @@ -455,8 +455,8 @@ public class SecureAction { return; } try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws BundleException { + AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { + public Void run() throws BundleException { module.start(options); return null; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java index 208d6c86b..4ab886e2f 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/BundleContextImpl.java @@ -209,8 +209,8 @@ public class BundleContextImpl implements BundleContext, EventDispatcher<Object, if (System.getSecurityManager() == null) { notifyFindHooksPriviledged(context, shrinkable); } else { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { notifyFindHooksPriviledged(context, shrinkable); return null; } @@ -757,8 +757,8 @@ public class BundleContextImpl implements BundleContext, EventDispatcher<Object, */ private void startActivator(final BundleActivator bundleActivator) throws BundleException { try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws Exception { + AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { + public Void run() throws Exception { if (bundleActivator != null) { // make sure the context class loader is set correctly Object previousTCCL = setContextFinder(); @@ -812,14 +812,15 @@ public class BundleContextImpl implements BundleContext, EventDispatcher<Object, */ protected void stop() throws BundleException { try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws Exception { - if (activator != null) { + final BundleActivator bundleActivator = activator; + AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { + public Void run() throws Exception { + if (bundleActivator != null) { // make sure the context class loader is set correctly Object previousTCCL = setContextFinder(); try { /* Stop the bundle synchronously */ - activator.stop(BundleContextImpl.this); + bundleActivator.stop(BundleContextImpl.this); } finally { if (previousTCCL != Boolean.FALSE) Thread.currentThread().setContextClassLoader((ClassLoader) previousTCCL); diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java index f54936c3a..aaf52d388 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/ContextFinder.java @@ -30,8 +30,8 @@ public class ContextFinder extends ClassLoader implements PrivilegedAction<List< static ClassLoader finderClassLoader; static Finder contextFinder; static { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { finderClassLoader = ContextFinder.class.getClassLoader(); contextFinder = new Finder(); return null; diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java index 70cdfd8b3..11d4a676b 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/EquinoxEventPublisher.java @@ -74,8 +74,8 @@ public class EquinoxEventPublisher { if (System.getSecurityManager() == null) { publishBundleEventPrivileged(event); } else { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { publishBundleEventPrivileged(event); return null; } @@ -221,8 +221,8 @@ public class EquinoxEventPublisher { if (System.getSecurityManager() == null) { publishFrameworkEventPrivileged(event, listeners); } else { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { publishFrameworkEventPrivileged(event, listeners); return null; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java index d0995a9c2..7e56cf5eb 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/FilterImpl.java @@ -1753,14 +1753,14 @@ public class FilterImpl implements Filter /* since Framework 1.1 */{ } } - private static class SetAccessibleAction implements PrivilegedAction<Object> { + private static class SetAccessibleAction implements PrivilegedAction<Void> { private final AccessibleObject accessible; SetAccessibleAction(AccessibleObject accessible) { this.accessible = accessible; } - public Object run() { + public Void run() { accessible.setAccessible(true); return null; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/OSGiFrameworkHooks.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/OSGiFrameworkHooks.java index 91c1f9903..234cb0eb8 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/OSGiFrameworkHooks.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/framework/OSGiFrameworkHooks.java @@ -89,8 +89,8 @@ class OSGiFrameworkHooks { if (System.getSecurityManager() == null) { notifyCollisionHooksPriviledged(operationType, target, shrinkable); } else { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { notifyCollisionHooksPriviledged(operationType, target, shrinkable); return null; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java index 6833e59b3..d05096e32 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/log/ExtendedLogReaderServiceFactory.java @@ -168,8 +168,8 @@ public class ExtendedLogReaderServiceFactory implements ServiceFactory<ExtendedL void log(final Bundle bundle, final String name, final Object context, final int level, final String message, final Throwable exception) { if (System.getSecurityManager() != null) { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { logPrivileged(bundle, name, context, level, message, exception); return null; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/EquinoxSecurityManager.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/EquinoxSecurityManager.java index 10d5ce78e..d2c975ba4 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/EquinoxSecurityManager.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/permadmin/EquinoxSecurityManager.java @@ -45,7 +45,7 @@ public class EquinoxSecurityManager extends SecurityManager { } } - static class CheckPermissionAction implements PrivilegedAction<Object> { + static class CheckPermissionAction implements PrivilegedAction<Void> { Permission perm; Object context; EquinoxSecurityManager fsm; @@ -56,7 +56,7 @@ public class EquinoxSecurityManager extends SecurityManager { this.context = context; } - public Object run() { + public Void run() { fsm.internalCheckPermission(perm, context); return null; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java index 6448300a2..b60636bcf 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/serviceregistry/ServiceRegistry.java @@ -763,8 +763,8 @@ public class ServiceRegistry { if (System.getSecurityManager() == null) { publishServiceEventPrivileged(event); } else { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { publishServiceEventPrivileged(event); return null; } @@ -1125,8 +1125,8 @@ public class ServiceRegistry { if (System.getSecurityManager() == null) { notifyFindHooksPrivileged(context, clazz, filterstring, allservices, result); } else { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { notifyFindHooksPrivileged(context, clazz, filterstring, allservices, result); return null; } @@ -1267,8 +1267,8 @@ public class ServiceRegistry { if (System.getSecurityManager() == null) { notifyNewListenerHookPrivileged(registration); } else { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { notifyNewListenerHookPrivileged(registration); return null; } @@ -1324,8 +1324,8 @@ public class ServiceRegistry { if (System.getSecurityManager() == null) { notifyListenerHooksPrivileged(listeners, added); } else { - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { notifyListenerHooksPrivileged(listeners, added); return null; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java index d34081b29..4c2ca2e36 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/internal/weaving/WovenClassImpl.java @@ -218,8 +218,8 @@ public final class WovenClassImpl implements WovenClass, HookContext { registry.notifyHooksPrivileged(context); else { try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { + public Void run() { registry.notifyHooksPrivileged(context); return null; } @@ -239,8 +239,8 @@ public final class WovenClassImpl implements WovenClass, HookContext { registry.notifyHooksPrivileged(this); } else { try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { + public Void run() { registry.notifyHooksPrivileged(WovenClassImpl.this); return null; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java index 7702fd2aa..93f0530db 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/FrameworkExtensionInstaller.java @@ -77,9 +77,9 @@ public class FrameworkExtensionInstaller { addExtensionContent0(revision, systemModule); } else { try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { + AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override - public Object run() throws BundleException { + public Void run() throws BundleException { addExtensionContent0(revision, systemModule); return null; } diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java index 45e600a66..40424ddaa 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java @@ -898,8 +898,8 @@ public class Storage { delete0(delete); } else { try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws IOException { + AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { + public Void run() throws IOException { delete0(delete); return null; } @@ -928,8 +928,8 @@ public class Storage { save0(); } else { try { - AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { - public Object run() throws IOException { + AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { + public Void run() throws IOException { save0(); return null; } diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java index b604a2c5c..715afa293 100644 --- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java +++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/util/NLS.java @@ -143,8 +143,8 @@ public abstract class NLS { load(baseName, clazz); return; } - AccessController.doPrivileged(new PrivilegedAction<Object>() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction<Void>() { + public Void run() { load(baseName, clazz); return null; } |