Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/resolver/ResolverImpl.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/resolver/ResolverImpl.java?rev=1536612&r1=1536611&r2=1536612&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/resolver/ResolverImpl.java (original) +++ ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/resolver/ResolverImpl.java Tue Oct 29 08:43:57 2013 @@ -28,6 +28,12 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.SortedSet; + + + + + + //import org.apache.felix.framework.BundleWiringImpl; import org.apache.felix.framework.Logger; import org.apache.felix.framework.capabilityset.CapabilitySet; @@ -180,7 +186,7 @@ public class ResolverImpl implements Res calculatePackageSpaces( allCandidates.getWrappedHost(target), allCandidates, revisionPkgMap, - new HashMap(), new HashSet()); + new HashMap<BundleCapability, List<BundleRevision>>(), new HashSet<BundleRevision>()); //System.out.println("+++ PACKAGE SPACES START +++"); //dumpRevisionPkgMap(revisionPkgMap); //System.out.println("+++ PACKAGE SPACES END +++"); @@ -189,7 +195,7 @@ public class ResolverImpl implements Res { checkPackageSpaceConsistency( false, allCandidates.getWrappedHost(target), - allCandidates, revisionPkgMap, new HashMap()); + allCandidates, revisionPkgMap, new HashMap<BundleRevision, Object>()); } catch (ResolveException ex) { @@ -329,7 +335,7 @@ public class ResolverImpl implements Res calculatePackageSpaces( allCandidates.getWrappedHost(revision), allCandidates, revisionPkgMap, - new HashMap(), new HashSet()); + new HashMap<BundleCapability, List<BundleRevision>>(), new HashSet<BundleRevision>()); //System.out.println("+++ PACKAGE SPACES START +++"); //dumpRevisionPkgMap(revisionPkgMap); //System.out.println("+++ PACKAGE SPACES END +++"); @@ -338,7 +344,7 @@ public class ResolverImpl implements Res { checkPackageSpaceConsistency( false, allCandidates.getWrappedHost(revision), - allCandidates, revisionPkgMap, new HashMap()); + allCandidates, revisionPkgMap, new HashMap<BundleRevision, Object>()); } catch (ResolveException ex) { @@ -401,7 +407,7 @@ public class ResolverImpl implements Res Collections.EMPTY_MAP, Collections.EMPTY_MAP); SortedSet<BundleCapability> caps = state.getCandidates(req, true); - List<BundleRevision> singletons = new ArrayList(); + List<BundleRevision> singletons = new ArrayList<BundleRevision>(); for (BundleCapability cap : caps) { if (cap.getRevision().getWiring() != null) @@ -526,8 +532,8 @@ public class ResolverImpl implements Res // Create parallel arrays for requirement and proposed candidate // capability or actual capability if revision is resolved or not. - List<BundleRequirement> reqs = new ArrayList(); - List<BundleCapability> caps = new ArrayList(); + List<BundleRequirement> reqs = new ArrayList<BundleRequirement>(); + List<BundleCapability> caps = new ArrayList<BundleCapability>(); boolean isDynamicImporting = false; if (revision.getWiring() != null) { @@ -653,7 +659,7 @@ public class ResolverImpl implements Res if (!req.getNamespace().equals(BundleRevision.BUNDLE_NAMESPACE) && !req.getNamespace().equals(BundleRevision.PACKAGE_NAMESPACE)) { - List<BundleRequirement> blameReqs = new ArrayList(); + List<BundleRequirement> blameReqs = new ArrayList<BundleRequirement>(); blameReqs.add(req); mergeUses( @@ -674,7 +680,7 @@ public class ResolverImpl implements Res // Ignore revisions that import from themselves. if (!blame.m_cap.getRevision().equals(revision)) { - List<BundleRequirement> blameReqs = new ArrayList(); + List<BundleRequirement> blameReqs = new ArrayList<BundleRequirement>(); blameReqs.add(blame.m_reqs.get(0)); mergeUses( @@ -693,7 +699,7 @@ public class ResolverImpl implements Res { for (Blame blame : entry.getValue()) { - List<BundleRequirement> blameReqs = new ArrayList(); + List<BundleRequirement> blameReqs = new ArrayList<BundleRequirement>(); blameReqs.add(blame.m_reqs.get(0)); mergeUses( @@ -781,6 +787,7 @@ public class ResolverImpl implements Res } else { + @SuppressWarnings("unused") List<BundleRequirement> reqs = (candCap.getRevision().getWiring() != null) ? candCap.getRevision().getWiring().getRequirements(null) : candCap.getRevision().getDeclaredRequirements(null); @@ -824,7 +831,7 @@ public class ResolverImpl implements Res String pkgName = (String) candCap.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE); - List blameReqs = new ArrayList(); + List<BundleRequirement> blameReqs = new ArrayList<BundleRequirement>(); blameReqs.add(currentReq); Packages currentPkgs = revisionPkgMap.get(current); @@ -880,7 +887,7 @@ public class ResolverImpl implements Res Blame candExportedBlame = candSourcePkgs.m_exportedPkgs.get(usedPkgName); if (candExportedBlame != null) { - candSourceBlames = new ArrayList(1); + candSourceBlames = new ArrayList<Blame>(1); candSourceBlames.add(candExportedBlame); } else @@ -911,7 +918,7 @@ public class ResolverImpl implements Res { if (blame.m_reqs != null) { - List<BundleRequirement> blameReqs2 = new ArrayList(blameReqs); + List<BundleRequirement> blameReqs2 = new ArrayList<BundleRequirement>(blameReqs); blameReqs2.add(blame.m_reqs.get(blame.m_reqs.size() - 1)); usedCaps.add(new Blame(blame.m_cap, blameReqs2)); mergeUses(current, currentPkgs, blame.m_cap, blameReqs2, @@ -928,6 +935,7 @@ public class ResolverImpl implements Res } } + @SuppressWarnings("unchecked") private void checkPackageSpaceConsistency( boolean isDynamicImporting, BundleRevision revision, @@ -1367,7 +1375,7 @@ public class ResolverImpl implements Res } private Map<BundleCapability, List<BundleCapability>> m_packageSourcesCache - = new HashMap(); + = new HashMap<BundleCapability, List<BundleCapability>>(); private List<BundleCapability> getPackageSources( BundleCapability cap, Map<BundleRevision, Packages> revisionPkgMap) @@ -1378,7 +1386,7 @@ public class ResolverImpl implements Res if (sources == null) { sources = getPackageSourcesInternal( - cap, revisionPkgMap, new ArrayList(), new HashSet()); + cap, revisionPkgMap, new ArrayList<BundleCapability>(), new HashSet<BundleCapability>()); m_packageSourcesCache.put(cap, sources); } return sources; @@ -1495,6 +1503,7 @@ public class ResolverImpl implements Res populateWireMap(cand.getRevision(), revisionPkgMap, wireMap, allCandidates); } + @SuppressWarnings("unused") Packages candPkgs = revisionPkgMap.get(cand.getRevision()); ResolverWire wire = new ResolverWireImpl( unwrappedRevision, @@ -1588,7 +1597,7 @@ public class ResolverImpl implements Res allCandidates); } - Map<String, Object> attrs = new HashMap(1); + Map<String, Object> attrs = new HashMap<String, Object>(1); attrs.put(BundleRevision.PACKAGE_NAMESPACE, pkgName); packageWires.add( new ResolverWireImpl( @@ -1603,6 +1612,7 @@ public class ResolverImpl implements Res return wireMap; } + @SuppressWarnings("unused") private static void dumpRevisionPkgMap(Map<BundleRevision, Packages> revisionPkgMap) { System.out.println("+++BUNDLE REVISION PKG MAP+++"); @@ -1738,11 +1748,12 @@ public class ResolverImpl implements Res private static class Packages { + @SuppressWarnings("unused") private final BundleRevision m_revision; - public final Map<String, Blame> m_exportedPkgs = new HashMap(); - public final Map<String, List<Blame>> m_importedPkgs = new HashMap(); - public final Map<String, List<Blame>> m_requiredPkgs = new HashMap(); - public final Map<String, List<Blame>> m_usedPkgs = new HashMap(); + public final Map<String, Blame> m_exportedPkgs = new HashMap<String, Blame>(); + public final Map<String, List<Blame>> m_importedPkgs = new HashMap<String, List<Blame>>(); + public final Map<String, List<Blame>> m_requiredPkgs = new HashMap<String, List<Blame>>(); + public final Map<String, List<Blame>> m_usedPkgs = new HashMap<String, List<Blame>>(); public Packages(BundleRevision revision) {
Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/MapToDictionary.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/MapToDictionary.java?rev=1536612&r1=1536611&r2=1536612&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/MapToDictionary.java (original) +++ ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/MapToDictionary.java Tue Oct 29 08:43:57 2013 @@ -25,6 +25,7 @@ import java.util.*; * This is a simple class that implements a <tt>Dictionary</tt> * from a <tt>Map</tt>. The resulting dictionary is immutable. **/ +@SuppressWarnings("unchecked") public class MapToDictionary extends Dictionary { /** Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/SecureAction.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/SecureAction.java?rev=1536612&r1=1536611&r2=1536612&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/SecureAction.java (original) +++ ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/SecureAction.java Tue Oct 29 08:43:57 2013 @@ -18,40 +18,44 @@ */ package org.apache.felix.framework.util; -import java.io.*; -import java.lang.reflect.*; -import java.net.*; -import java.security.*; -import java.util.Collection; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.AccessibleObject; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URL; +import java.net.URLClassLoader; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.security.AccessControlContext; +import java.security.AccessController; +import java.security.Policy; +import java.security.PrivilegedActionException; +import java.security.PrivilegedExceptionAction; import java.util.HashMap; import java.util.Hashtable; -import java.util.Map; import java.util.zip.ZipFile; -import org.osgi.framework.Bundle; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.ServiceEvent; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.hooks.resolver.ResolverHook; -import org.osgi.framework.hooks.service.ListenerHook; -import org.osgi.framework.wiring.BundleCapability; -import org.osgi.framework.wiring.BundleRequirement; -import org.osgi.framework.wiring.BundleRevision; /** * <p> - * This is a utility class to centralize all action that should be performed - * in a <tt>doPrivileged()</tt> block. To perform a secure action, simply - * create an instance of this class and use the specific method to perform - * the desired action. When an instance is created, this class will capture - * the security context and will then use that context when checking for - * permission to perform the action. Instances of this class should not be - * passed around since they may grant the receiver a capability to perform - * privileged actions. + * This is a utility class to centralize all action that should be performed in a <tt>doPrivileged()</tt> block. To + * perform a secure action, simply create an instance of this class and use the specific method to perform the desired + * action. When an instance is created, this class will capture the security context and will then use that context when + * checking for permission to perform the action. Instances of this class should not be passed around since they may + * grant the receiver a capability to perform privileged actions. * </p> -**/ + **/ +@SuppressWarnings({ "unused", "unchecked" }) public class SecureAction { private static final ThreadLocal m_actions = new ThreadLocal() @@ -704,9 +708,9 @@ public class SecureAction { Method addURL = URLClassLoader.class.getDeclaredMethod("addURL", - new Class[] {URL.class}); + new Class[] { URL.class }); addURL.setAccessible(true); - addURL.invoke(loader, new Object[]{extension}); + addURL.invoke(loader, new Object[] { extension }); } } @@ -1052,323 +1056,86 @@ public class SecureAction } } - /* public void invokeBundleFindHook( - org.osgi.framework.hooks.bundle.FindHook fh, - BundleContext bc, Collection<Bundle> bundles) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_BUNDLE_FIND_HOOK, fh, bc, bundles); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - fh.find(bc, bundles); - } - } - - public void invokeBundleEventHook( - org.osgi.framework.hooks.bundle.EventHook eh, - BundleEvent event, Collection<BundleContext> contexts) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_BUNDLE_EVENT_HOOK, eh, contexts); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - eh.event(event, contexts); - } - } - - public void invokeWeavingHook( - org.osgi.framework.hooks.weaving.WeavingHook wh, - org.osgi.framework.hooks.weaving.WovenClass wc) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_WEAVING_HOOK, wh, wc); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - wh.weave(wc); - } - } - - public void invokeServiceEventHook( - org.osgi.framework.hooks.service.EventHook eh, - ServiceEvent event, Collection<BundleContext> contexts) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_SERVICE_EVENT_HOOK, eh, contexts); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - eh.event(event, contexts); - } - } - - public void invokeServiceFindHook( - org.osgi.framework.hooks.service.FindHook fh, - BundleContext context, String name, String filter, - boolean allServices, Collection<ServiceReference<?>> references) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set( - Actions.INVOKE_SERVICE_EVENT_HOOK, fh, context, name, filter, - (allServices) ? Boolean.TRUE : Boolean.FALSE, references); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - fh.find(context, name, filter, allServices, references); - } - } - - public void invokeServiceListenerHookAdded( - org.osgi.framework.hooks.service.ListenerHook lh, - Collection<ListenerHook.ListenerInfo> listeners) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_SERVICE_LISTENER_HOOK_ADDED, lh, listeners); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - lh.added(listeners); - } - } - - public void invokeServiceListenerHookRemoved( - org.osgi.framework.hooks.service.ListenerHook lh, - Collection<ListenerHook.ListenerInfo> listeners) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_SERVICE_LISTENER_HOOK_REMOVED, lh, listeners); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - lh.removed(listeners); - } - } - - public void invokeServiceEventListenerHook( - org.osgi.framework.hooks.service.EventListenerHook elh, - ServiceEvent event, - Map<BundleContext, Collection<ListenerHook.ListenerInfo>> listeners) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_SERVICE_EVENT_LISTENER_HOOK, elh, listeners); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - elh.event(event, listeners); - } - } - - public ResolverHook invokeResolverHookFactory( - org.osgi.framework.hooks.resolver.ResolverHookFactory rhf, - Collection<BundleRevision> triggers) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_RESOLVER_HOOK_FACTORY, rhf, triggers); - try - { - return (ResolverHook) AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - return rhf.begin(triggers); - } - } - - public void invokeResolverHookResolvable( - org.osgi.framework.hooks.resolver.ResolverHook rh, - Collection<BundleRevision> candidates) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_RESOLVER_HOOK_RESOLVABLE, rh, candidates); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - rh.filterResolvable(candidates); - } - } - - public void invokeResolverHookSingleton( - org.osgi.framework.hooks.resolver.ResolverHook rh, - BundleCapability singleton, - Collection<BundleCapability> collisions) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_RESOLVER_HOOK_SINGLETON, rh, singleton, collisions); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - rh.filterSingletonCollisions(singleton, collisions); - } - } - - public void invokeResolverHookMatches( - org.osgi.framework.hooks.resolver.ResolverHook rh, - BundleRequirement req, - Collection<BundleCapability> candidates) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_RESOLVER_HOOK_MATCHES, rh, req, candidates); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - rh.filterMatches(req, candidates); - } - } - - public void invokeResolverHookEnd( - org.osgi.framework.hooks.resolver.ResolverHook rh) - throws Exception - { - if (System.getSecurityManager() != null) - { - Actions actions = (Actions) m_actions.get(); - actions.set(Actions.INVOKE_RESOLVER_HOOK_END, rh); - try - { - AccessController.doPrivileged(actions, m_acc); - } - catch (PrivilegedActionException e) - { - throw e.getException(); - } - } - else - { - rh.end(); - } - } -*/ + /* + * public void invokeBundleFindHook( org.osgi.framework.hooks.bundle.FindHook fh, BundleContext bc, + * Collection<Bundle> bundles) throws Exception { if (System.getSecurityManager() != null) { Actions actions = + * (Actions) m_actions.get(); actions.set(Actions.INVOKE_BUNDLE_FIND_HOOK, fh, bc, bundles); try { + * AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw e.getException(); } + * } else { fh.find(bc, bundles); } } + * + * public void invokeBundleEventHook( org.osgi.framework.hooks.bundle.EventHook eh, BundleEvent event, + * Collection<BundleContext> contexts) throws Exception { if (System.getSecurityManager() != null) { Actions actions + * = (Actions) m_actions.get(); actions.set(Actions.INVOKE_BUNDLE_EVENT_HOOK, eh, contexts); try { + * AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw e.getException(); } + * } else { eh.event(event, contexts); } } + * + * public void invokeWeavingHook( org.osgi.framework.hooks.weaving.WeavingHook wh, + * org.osgi.framework.hooks.weaving.WovenClass wc) throws Exception { if (System.getSecurityManager() != null) { + * Actions actions = (Actions) m_actions.get(); actions.set(Actions.INVOKE_WEAVING_HOOK, wh, wc); try { + * AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw e.getException(); } + * } else { wh.weave(wc); } } + * + * public void invokeServiceEventHook( org.osgi.framework.hooks.service.EventHook eh, ServiceEvent event, + * Collection<BundleContext> contexts) throws Exception { if (System.getSecurityManager() != null) { Actions actions + * = (Actions) m_actions.get(); actions.set(Actions.INVOKE_SERVICE_EVENT_HOOK, eh, contexts); try { + * AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw e.getException(); } + * } else { eh.event(event, contexts); } } + * + * public void invokeServiceFindHook( org.osgi.framework.hooks.service.FindHook fh, BundleContext context, String + * name, String filter, boolean allServices, Collection<ServiceReference<?>> references) throws Exception { if + * (System.getSecurityManager() != null) { Actions actions = (Actions) m_actions.get(); actions.set( + * Actions.INVOKE_SERVICE_EVENT_HOOK, fh, context, name, filter, (allServices) ? Boolean.TRUE : Boolean.FALSE, + * references); try { AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw + * e.getException(); } } else { fh.find(context, name, filter, allServices, references); } } + * + * public void invokeServiceListenerHookAdded( org.osgi.framework.hooks.service.ListenerHook lh, + * Collection<ListenerHook.ListenerInfo> listeners) throws Exception { if (System.getSecurityManager() != null) { + * Actions actions = (Actions) m_actions.get(); actions.set(Actions.INVOKE_SERVICE_LISTENER_HOOK_ADDED, lh, + * listeners); try { AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw + * e.getException(); } } else { lh.added(listeners); } } + * + * public void invokeServiceListenerHookRemoved( org.osgi.framework.hooks.service.ListenerHook lh, + * Collection<ListenerHook.ListenerInfo> listeners) throws Exception { if (System.getSecurityManager() != null) { + * Actions actions = (Actions) m_actions.get(); actions.set(Actions.INVOKE_SERVICE_LISTENER_HOOK_REMOVED, lh, + * listeners); try { AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw + * e.getException(); } } else { lh.removed(listeners); } } + * + * public void invokeServiceEventListenerHook( org.osgi.framework.hooks.service.EventListenerHook elh, ServiceEvent + * event, Map<BundleContext, Collection<ListenerHook.ListenerInfo>> listeners) throws Exception { if + * (System.getSecurityManager() != null) { Actions actions = (Actions) m_actions.get(); + * actions.set(Actions.INVOKE_SERVICE_EVENT_LISTENER_HOOK, elh, listeners); try { + * AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw e.getException(); } + * } else { elh.event(event, listeners); } } + * + * public ResolverHook invokeResolverHookFactory( org.osgi.framework.hooks.resolver.ResolverHookFactory rhf, + * Collection<BundleRevision> triggers) throws Exception { if (System.getSecurityManager() != null) { Actions + * actions = (Actions) m_actions.get(); actions.set(Actions.INVOKE_RESOLVER_HOOK_FACTORY, rhf, triggers); try { + * return (ResolverHook) AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { + * throw e.getException(); } } else { return rhf.begin(triggers); } } + * + * public void invokeResolverHookResolvable( org.osgi.framework.hooks.resolver.ResolverHook rh, + * Collection<BundleRevision> candidates) throws Exception { if (System.getSecurityManager() != null) { Actions + * actions = (Actions) m_actions.get(); actions.set(Actions.INVOKE_RESOLVER_HOOK_RESOLVABLE, rh, candidates); try { + * AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw e.getException(); } + * } else { rh.filterResolvable(candidates); } } + * + * public void invokeResolverHookSingleton( org.osgi.framework.hooks.resolver.ResolverHook rh, BundleCapability + * singleton, Collection<BundleCapability> collisions) throws Exception { if (System.getSecurityManager() != null) { + * Actions actions = (Actions) m_actions.get(); actions.set(Actions.INVOKE_RESOLVER_HOOK_SINGLETON, rh, singleton, + * collisions); try { AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw + * e.getException(); } } else { rh.filterSingletonCollisions(singleton, collisions); } } + * + * public void invokeResolverHookMatches( org.osgi.framework.hooks.resolver.ResolverHook rh, BundleRequirement req, + * Collection<BundleCapability> candidates) throws Exception { if (System.getSecurityManager() != null) { Actions + * actions = (Actions) m_actions.get(); actions.set(Actions.INVOKE_RESOLVER_HOOK_MATCHES, rh, req, candidates); try + * { AccessController.doPrivileged(actions, m_acc); } catch (PrivilegedActionException e) { throw e.getException(); + * } } else { rh.filterMatches(req, candidates); } } + * + * public void invokeResolverHookEnd( org.osgi.framework.hooks.resolver.ResolverHook rh) throws Exception { if + * (System.getSecurityManager() != null) { Actions actions = (Actions) m_actions.get(); + * actions.set(Actions.INVOKE_RESOLVER_HOOK_END, rh); try { AccessController.doPrivileged(actions, m_acc); } catch + * (PrivilegedActionException e) { throw e.getException(); } } else { rh.end(); } } + */ private static class Actions implements PrivilegedExceptionAction { public static final int INITIALIZE_CONTEXT_ACTION = 0; @@ -1505,7 +1272,7 @@ public class SecureAction public Object run() throws Exception { - int action = m_action; + int action = m_action; Object arg1 = m_arg1; Object arg2 = m_arg2; Object arg3 = m_arg3; @@ -1522,9 +1289,9 @@ public class SecureAction case ADD_EXTENSION_URL_ACTION: Method addURL = URLClassLoader.class.getDeclaredMethod("addURL", - new Class[] {URL.class}); + new Class[] { URL.class }); addURL.setAccessible(true); - addURL.invoke(arg2, new Object[]{arg1}); + addURL.invoke(arg2, new Object[] { arg1 }); return null; case CREATE_TMPFILE_ACTION: return File.createTempFile((String) arg1, (String) arg2, (File) arg3); @@ -1612,65 +1379,38 @@ public class SecureAction return null; case GET_CLASS_LOADER_ACTION: return ((Class) arg1).getClassLoader(); - /* case INVOKE_BUNDLE_FIND_HOOK: - ((org.osgi.framework.hooks.bundle.FindHook) arg1).find( - (BundleContext) arg2, (Collection<Bundle>) arg3); - return null; - case INVOKE_BUNDLE_EVENT_HOOK: - ((org.osgi.framework.hooks.bundle.EventHook) arg1).event( - (BundleEvent) arg2, (Collection<BundleContext>) arg3); - return null; - case INVOKE_WEAVING_HOOK: - ((org.osgi.framework.hooks.weaving.WeavingHook) arg1).weave( - (org.osgi.framework.hooks.weaving.WovenClass) arg2); - return null; - case INVOKE_SERVICE_EVENT_HOOK: - ((org.osgi.framework.hooks.service.EventHook) arg1).event( - (ServiceEvent) arg2, (Collection<BundleContext>) arg3); - return null; - case INVOKE_SERVICE_FIND_HOOK: - ((org.osgi.framework.hooks.service.FindHook) arg1).find( - (BundleContext) arg2, (String) arg3, (String) arg4, - ((Boolean) arg5).booleanValue(), - (Collection<ServiceReference<?>>) arg6); - return null; - case INVOKE_SERVICE_LISTENER_HOOK_ADDED: - ((org.osgi.framework.hooks.service.ListenerHook) arg1).added( - (Collection<ListenerHook.ListenerInfo>) arg2); - return null; - case INVOKE_SERVICE_LISTENER_HOOK_REMOVED: - ((org.osgi.framework.hooks.service.ListenerHook) arg1).removed( - (Collection<ListenerHook.ListenerInfo>) arg2); - return null; - case INVOKE_SERVICE_EVENT_LISTENER_HOOK: - ((org.osgi.framework.hooks.service.EventListenerHook) arg1).event( - (ServiceEvent) arg2, - (Map<BundleContext, Collection<ListenerHook.ListenerInfo>>) arg3); - return null; - case INVOKE_RESOLVER_HOOK_FACTORY: - return ((org.osgi.framework.hooks.resolver.ResolverHookFactory) arg1).begin( - (Collection<BundleRevision>) arg2); - case INVOKE_RESOLVER_HOOK_RESOLVABLE: - ((org.osgi.framework.hooks.resolver.ResolverHook) arg1).filterResolvable( - (Collection<BundleRevision>) arg2); - return null; - case INVOKE_RESOLVER_HOOK_SINGLETON: - ((org.osgi.framework.hooks.resolver.ResolverHook) arg1) - .filterSingletonCollisions( - (BundleCapability) arg2, - (Collection<BundleCapability>) arg3); - return null; - case INVOKE_RESOLVER_HOOK_MATCHES: - ((org.osgi.framework.hooks.resolver.ResolverHook) arg1).filterMatches( - (BundleRequirement) arg2, - (Collection<BundleCapability>) arg3); - return null; - case INVOKE_RESOLVER_HOOK_END: - ((org.osgi.framework.hooks.resolver.ResolverHook) arg1).end(); - return null;*/ + /* + * case INVOKE_BUNDLE_FIND_HOOK: ((org.osgi.framework.hooks.bundle.FindHook) arg1).find( + * (BundleContext) arg2, (Collection<Bundle>) arg3); return null; case INVOKE_BUNDLE_EVENT_HOOK: + * ((org.osgi.framework.hooks.bundle.EventHook) arg1).event( (BundleEvent) arg2, + * (Collection<BundleContext>) arg3); return null; case INVOKE_WEAVING_HOOK: + * ((org.osgi.framework.hooks.weaving.WeavingHook) arg1).weave( + * (org.osgi.framework.hooks.weaving.WovenClass) arg2); return null; case INVOKE_SERVICE_EVENT_HOOK: + * ((org.osgi.framework.hooks.service.EventHook) arg1).event( (ServiceEvent) arg2, + * (Collection<BundleContext>) arg3); return null; case INVOKE_SERVICE_FIND_HOOK: + * ((org.osgi.framework.hooks.service.FindHook) arg1).find( (BundleContext) arg2, (String) arg3, + * (String) arg4, ((Boolean) arg5).booleanValue(), (Collection<ServiceReference<?>>) arg6); return + * null; case INVOKE_SERVICE_LISTENER_HOOK_ADDED: ((org.osgi.framework.hooks.service.ListenerHook) + * arg1).added( (Collection<ListenerHook.ListenerInfo>) arg2); return null; case + * INVOKE_SERVICE_LISTENER_HOOK_REMOVED: ((org.osgi.framework.hooks.service.ListenerHook) + * arg1).removed( (Collection<ListenerHook.ListenerInfo>) arg2); return null; case + * INVOKE_SERVICE_EVENT_LISTENER_HOOK: ((org.osgi.framework.hooks.service.EventListenerHook) + * arg1).event( (ServiceEvent) arg2, (Map<BundleContext, Collection<ListenerHook.ListenerInfo>>) + * arg3); return null; case INVOKE_RESOLVER_HOOK_FACTORY: return + * ((org.osgi.framework.hooks.resolver.ResolverHookFactory) arg1).begin( + * (Collection<BundleRevision>) arg2); case INVOKE_RESOLVER_HOOK_RESOLVABLE: + * ((org.osgi.framework.hooks.resolver.ResolverHook) arg1).filterResolvable( + * (Collection<BundleRevision>) arg2); return null; case INVOKE_RESOLVER_HOOK_SINGLETON: + * ((org.osgi.framework.hooks.resolver.ResolverHook) arg1) .filterSingletonCollisions( + * (BundleCapability) arg2, (Collection<BundleCapability>) arg3); return null; case + * INVOKE_RESOLVER_HOOK_MATCHES: ((org.osgi.framework.hooks.resolver.ResolverHook) + * arg1).filterMatches( (BundleRequirement) arg2, (Collection<BundleCapability>) arg3); return null; + * case INVOKE_RESOLVER_HOOK_END: ((org.osgi.framework.hooks.resolver.ResolverHook) arg1).end(); + * return null; + */ } return null; } } -} \ No newline at end of file +} Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/Util.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/Util.java?rev=1536612&r1=1536611&r2=1536612&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/Util.java (original) +++ ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/Util.java Tue Oct 29 08:43:57 2013 @@ -20,18 +20,17 @@ package org.apache.felix.framework.util; import java.io.*; import java.net.URL; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; + import org.apache.felix.framework.Logger; import org.apache.felix.framework.capabilityset.CapabilitySet; import org.apache.felix.framework.wiring.BundleCapabilityImpl; import org.apache.felix.framework.wiring.BundleRequirementImpl; - import org.osgi.framework.Bundle; import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; @@ -313,7 +312,7 @@ public class Util public static List<BundleCapability> getCapabilityByNamespace( BundleRevision br, String namespace) { - final List<BundleCapability> matching = new ArrayList(); + final List<BundleCapability> matching = new ArrayList<BundleCapability>(); final List<BundleCapability> caps = (br.getWiring() != null) ? br.getWiring().getCapabilities(null) : br.getDeclaredCapabilities(null); @@ -377,6 +376,7 @@ public class Util 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x2b, 0x2f }; + @SuppressWarnings("unused") private static final byte decTab[] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, @@ -508,14 +508,14 @@ public class Util * property placeholder syntax or a recursive variable reference. **/ public static String substVars(String val, String currentKey, - Map cycleMap, Properties configProps) + Map<String, String> cycleMap, Properties configProps) throws IllegalArgumentException { // If there is currently no cycle map, then create // one for detecting cycles for this invocation. if (cycleMap == null) { - cycleMap = new HashMap(); + cycleMap = new HashMap<String, String>(); } // Put the current key in the cycle map. Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/manifestparser/ManifestParser.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/manifestparser/ManifestParser.java?rev=1536612&r1=1536611&r2=1536612&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/manifestparser/ManifestParser.java (original) +++ ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/manifestparser/ManifestParser.java Tue Oct 29 08:43:57 2013 @@ -19,7 +19,6 @@ package org.apache.felix.framework.util.manifestparser; import java.util.*; -import java.util.ArrayList; import java.util.Map.Entry; import org.apache.felix.framework.Logger; @@ -35,6 +34,7 @@ import org.osgi.framework.wiring.BundleC import org.osgi.framework.wiring.BundleRequirement; import org.osgi.framework.wiring.BundleRevision; +@SuppressWarnings({"unchecked", "deprecation"}) public class ManifestParser { private final Logger m_logger; Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java?rev=1536612&r1=1536611&r2=1536612&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java (original) +++ ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/util/manifestparser/R4LibraryClause.java Tue Oct 29 08:43:57 2013 @@ -25,6 +25,7 @@ import org.apache.felix.framework.util.F import org.apache.felix.framework.util.VersionRange; import org.osgi.framework.*; +@SuppressWarnings({ "unchecked" }) public class R4LibraryClause { private final String[] m_libraryEntries; @@ -136,14 +137,14 @@ public class R4LibraryClause { boolean win32 = currentOSName.startsWith("win") && (currentOSName.equals("windows95") - || currentOSName.equals("windows98") - || currentOSName.equals("windowsnt") - || currentOSName.equals("windows2000") - || currentOSName.equals("windows2003") - || currentOSName.equals("windowsxp") - || currentOSName.equals("windowsce") - || currentOSName.equals("windowsvista") - || currentOSName.equals("windows7")); + || currentOSName.equals("windows98") + || currentOSName.equals("windowsnt") + || currentOSName.equals("windows2000") + || currentOSName.equals("windows2003") + || currentOSName.equals("windowsxp") + || currentOSName.equals("windowsce") + || currentOSName.equals("windowsvista") + || currentOSName.equals("windows7")); for (int i = 0; (osnames != null) && (i < osnames.length); i++) { @@ -207,7 +208,7 @@ public class R4LibraryClause { // Get all framework properties Dictionary dict = new Hashtable(); - for (Iterator i = configMap.keySet().iterator(); i.hasNext(); ) + for (Iterator i = configMap.keySet().iterator(); i.hasNext();) { Object key = i.next(); dict.put(key, configMap.get(key)); @@ -317,7 +318,7 @@ public class R4LibraryClause } else if (property.equals(Constants.SELECTION_FILTER_ATTRIBUTE)) { -// TODO: NATIVE - I believe we can have multiple selection filters too. + // TODO: NATIVE - I believe we can have multiple selection filters too. selectionFilter = value; } } @@ -460,7 +461,7 @@ public class R4LibraryClause { value = value.toLowerCase(); - if (value.startsWith("x86-64") || value.startsWith("amd64") || + if (value.startsWith("x86-64") || value.startsWith("amd64") || value.startsWith("em64") || value.startsWith("x86_64")) { return "x86-64"; @@ -520,4 +521,4 @@ public class R4LibraryClause return Version.emptyVersion.toString(); } } -} \ No newline at end of file +} Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/wiring/BundleCapabilityImpl.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/wiring/BundleCapabilityImpl.java?rev=1536612&r1=1536611&r2=1536612&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/wiring/BundleCapabilityImpl.java (original) +++ ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/wiring/BundleCapabilityImpl.java Tue Oct 29 08:43:57 2013 @@ -25,6 +25,7 @@ import java.util.Set; import java.util.Map; import java.util.List; import java.util.StringTokenizer; + import org.apache.felix.framework.capabilityset.SimpleFilter; import org.apache.felix.framework.util.Util; import org.apache.felix.framework.util.manifestparser.ManifestParser; @@ -32,6 +33,7 @@ import org.osgi.framework.Constants; import org.osgi.framework.wiring.BundleCapability; import org.osgi.framework.wiring.BundleRevision; +@SuppressWarnings("unchecked") public class BundleCapabilityImpl implements BundleCapability { public static final String SINGLETON_NAMESPACE = "singleton"; Modified: ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/wiring/BundleRequirementImpl.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/wiring/BundleRequirementImpl.java?rev=1536612&r1=1536611&r2=1536612&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/wiring/BundleRequirementImpl.java (original) +++ ace/trunk/org.apache.ace.verifier/src/org/apache/felix/framework/wiring/BundleRequirementImpl.java Tue Oct 29 08:43:57 2013 @@ -18,14 +18,11 @@ */ package org.apache.felix.framework.wiring; -import java.util.ArrayList; import java.util.Collections; -import java.util.List; import java.util.Map; -import java.util.Map.Entry; + import org.apache.felix.framework.capabilityset.CapabilitySet; import org.apache.felix.framework.capabilityset.SimpleFilter; -import org.apache.felix.framework.util.VersionRange; import org.osgi.framework.Constants; import org.osgi.framework.wiring.BundleCapability; import org.osgi.framework.wiring.BundleRequirement; Modified: ace/trunk/org.apache.ace.verifier/test/org/apache/ace/deployment/verifier/impl/VerifierTest.java URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.verifier/test/org/apache/ace/deployment/verifier/impl/VerifierTest.java?rev=1536612&r1=1536611&r2=1536612&view=diff ============================================================================== --- ace/trunk/org.apache.ace.verifier/test/org/apache/ace/deployment/verifier/impl/VerifierTest.java (original) +++ ace/trunk/org.apache.ace.verifier/test/org/apache/ace/deployment/verifier/impl/VerifierTest.java Tue Oct 29 08:43:57 2013 @@ -1,9 +1,6 @@ package org.apache.ace.deployment.verifier.impl; -import org.testng.annotations.Test; -import org.testng.AssertJUnit; import static org.apache.ace.test.utils.TestUtils.UNIT; -import static org.testng.Assert.*; import java.util.HashMap; import java.util.HashSet; @@ -19,7 +16,10 @@ import org.osgi.framework.wiring.BundleC import org.osgi.framework.wiring.BundleRequirement; import org.osgi.framework.wiring.BundleRevision; import org.osgi.service.log.LogEntry; +import org.testng.AssertJUnit; +import org.testng.annotations.Test; +@SuppressWarnings({"deprecation"}) public class VerifierTest { @Test(groups = { UNIT }) public void testResolve() throws BundleException {
