You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/04/29 01:33:58 UTC

[2/7] Code formatting and other checkstyle issues

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java
index 68f8af6..9ad1012 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceBuilder.java
@@ -30,7 +30,6 @@ import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 import org.osgi.framework.namespace.IdentityNamespace;
-import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.namespace.service.ServiceNamespace;
 import org.osgi.resource.Capability;
@@ -38,12 +37,29 @@ import org.osgi.resource.Requirement;
 import org.osgi.resource.Resource;
 import org.osgi.service.repository.ContentNamespace;
 
-public class ResourceBuilder {
+public final class ResourceBuilder {
 
     public static final String RESOLUTION_DYNAMIC = "dynamic";
 
-    public static ResourceImpl build(String uri, Map<String, String> headerMap)
-            throws BundleException {
+    private static final char EOF = (char) -1;
+
+    private static final int CLAUSE_START = 0;
+    private static final int PARAMETER_START = 1;
+    private static final int KEY = 2;
+    private static final int DIRECTIVE_OR_TYPEDATTRIBUTE = 4;
+    private static final int ARGUMENT = 8;
+    private static final int VALUE = 16;
+
+    private static final int CHAR = 1;
+    private static final int DELIMITER = 2;
+    private static final int STARTQUOTE = 4;
+    private static final int ENDQUOTE = 8;
+
+
+    private ResourceBuilder() {
+    }
+
+    public static ResourceImpl build(String uri, Map<String, String> headerMap) throws BundleException {
 
         // Verify that only manifest version 2 is specified.
         String manifestVersion = getManifestVersion(headerMap);
@@ -64,7 +80,7 @@ public class ResourceBuilder {
         // Parse bundle symbolic name.
         //
 
-        String bundleSymbolicName = null;
+        String bundleSymbolicName;
         ParsedHeaderClause bundleCap = parseBundleSymbolicName(headerMap);
         if (bundleCap == null) {
             throw new BundleException("Bundle manifest must include bundle symbolic name");
@@ -75,7 +91,7 @@ public class ResourceBuilder {
         String type = headerMap.get(Constants.FRAGMENT_HOST) == null ? IdentityNamespace.TYPE_BUNDLE : IdentityNamespace.TYPE_FRAGMENT;
         ResourceImpl resource = new ResourceImpl(bundleSymbolicName, type, bundleVersion);
         if (uri != null) {
-            Map<String, Object> attrs = new HashMap<String, Object>();
+            Map<String, Object> attrs = new HashMap<>();
             attrs.put(ContentNamespace.CAPABILITY_URL_ATTRIBUTE, uri);
             resource.addCapability(new CapabilityImpl(resource, ContentNamespace.CONTENT_NAMESPACE, Collections.<String, String>emptyMap(), attrs));
         }
@@ -93,7 +109,7 @@ public class ResourceBuilder {
             String attachment = bundleCap.dirs.get(Constants.FRAGMENT_ATTACHMENT_DIRECTIVE);
             attachment = (attachment == null) ? Constants.FRAGMENT_ATTACHMENT_RESOLVETIME : attachment;
             if (!attachment.equalsIgnoreCase(Constants.FRAGMENT_ATTACHMENT_NEVER)) {
-                Map<String, Object> hostAttrs = new HashMap<String, Object>(bundleCap.attrs);
+                Map<String, Object> hostAttrs = new HashMap<>(bundleCap.attrs);
                 Object value = hostAttrs.remove(BundleRevision.BUNDLE_NAMESPACE);
                 hostAttrs.put(BundleRevision.HOST_NAMESPACE, value);
                 resource.addCapability(new CapabilityImpl(
@@ -196,41 +212,23 @@ public class ResourceBuilder {
         return resource;
     }
 
-    public static List<Requirement> parseImport(Resource resource, String imports) throws BundleException {
-        List<ParsedHeaderClause> importClauses = parseStandardHeader(imports);
-        importClauses = normalizeImportClauses(importClauses);
-        List<Requirement> importReqs = convertImports(importClauses, resource);
-        return importReqs;
-    }
-
     public static List<Requirement> parseRequirement(Resource resource, String requirement) throws BundleException {
         List<ParsedHeaderClause> requireClauses = parseStandardHeader(requirement);
         requireClauses = normalizeRequireCapabilityClauses(requireClauses);
-        List<Requirement> requireReqs = convertRequireCapabilities(requireClauses, resource);
-        return requireReqs;
-    }
-
-    public static List<Capability> parseExport(Resource resource, String bundleSymbolicName, Version bundleVersion, String exports) throws BundleException {
-        List<ParsedHeaderClause> exportClauses = parseStandardHeader(exports);
-        exportClauses = normalizeExportClauses(exportClauses, bundleSymbolicName, bundleVersion);
-        List<Capability> exportCaps = convertExports(exportClauses, resource);
-        return exportCaps;
+        return convertRequireCapabilities(requireClauses, resource);
     }
 
     public static List<Capability> parseCapability(Resource resource, String capability) throws BundleException {
         List<ParsedHeaderClause> provideClauses = parseStandardHeader(capability);
         provideClauses = normalizeProvideCapabilityClauses(provideClauses);
-        List<Capability> provideCaps = convertProvideCapabilities(provideClauses, resource);
-        return provideCaps;
+        return convertProvideCapabilities(provideClauses, resource);
     }
 
-    @SuppressWarnings( "deprecation" )
-    private static List<ParsedHeaderClause> normalizeImportClauses(
-            List<ParsedHeaderClause> clauses)
-            throws BundleException {
+    @SuppressWarnings("deprecation")
+    private static List<ParsedHeaderClause> normalizeImportClauses(List<ParsedHeaderClause> clauses) throws BundleException {
         // Verify that the values are equals if the package specifies
         // both version and specification-version attributes.
-        Set<String> dupeSet = new HashSet<String>();
+        Set<String> dupeSet = new HashSet<>();
         for (ParsedHeaderClause clause : clauses) {
             // Check for "version" and "specification-version" attributes
             // and verify they are the same if both are specified.
@@ -264,16 +262,14 @@ public class ResourceBuilder {
                     // Verify that java.* packages are not imported.
                     if (pkgName.startsWith("java.")) {
                         throw new BundleException("Importing java.* packages not allowed: " + pkgName);
-                    }
                     // The character "." has no meaning in the OSGi spec except
                     // when placed on the bundle class path. Some people, however,
                     // mistakenly think it means the default package when imported
                     // or exported. This is not correct. It is invalid.
-                    else if (pkgName.equals(".")) {
+                    } else if (pkgName.equals(".")) {
                         throw new BundleException("Importing '.' is invalid.");
-                    }
                     // Make sure a package name was specified.
-                    else if (pkgName.length() == 0) {
+                    } else if (pkgName.length() == 0) {
                         throw new BundleException(
                                 "Imported package names cannot be zero length.");
                     }
@@ -288,19 +284,19 @@ public class ResourceBuilder {
     }
 
     private static List<Capability> convertExportService(List<ParsedHeaderClause> clauses, Resource resource) {
-        List<Capability> capList = new ArrayList<Capability>();
+        List<Capability> capList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String path : clause.paths) {
-                Map<String, String> dirs = new LinkedHashMap<String, String>();
+                Map<String, String> dirs = new LinkedHashMap<>();
                 dirs.put(ServiceNamespace.CAPABILITY_EFFECTIVE_DIRECTIVE, ServiceNamespace.EFFECTIVE_ACTIVE);
-                Map<String, Object> attrs = new LinkedHashMap<String, Object>();
+                Map<String, Object> attrs = new LinkedHashMap<>();
                 attrs.put(Constants.OBJECTCLASS, path);
                 attrs.putAll(clause.attrs);
                 capList.add(new CapabilityImpl(
-                                resource,
-                                ServiceNamespace.SERVICE_NAMESPACE,
-                                dirs,
-                                attrs));
+                        resource,
+                        ServiceNamespace.SERVICE_NAMESPACE,
+                        dirs,
+                        attrs));
             }
         }
         return capList;
@@ -308,13 +304,13 @@ public class ResourceBuilder {
 
     private static List<Requirement> convertImportService(List<ParsedHeaderClause> clauses, Resource resource) throws BundleException {
         try {
-            List<Requirement> reqList = new ArrayList<Requirement>();
+            List<Requirement> reqList = new ArrayList<>();
             for (ParsedHeaderClause clause : clauses) {
                 for (String path : clause.paths) {
                     String multiple = clause.dirs.get("multiple");
-                    String avail    = clause.dirs.get("availability");
-                    String filter   = (String) clause.attrs.get("filter");
-                    Map<String, String> dirs = new LinkedHashMap<String, String>();
+                    String avail = clause.dirs.get("availability");
+                    String filter = (String) clause.attrs.get("filter");
+                    Map<String, String> dirs = new LinkedHashMap<>();
                     dirs.put(ServiceNamespace.REQUIREMENT_EFFECTIVE_DIRECTIVE, ServiceNamespace.EFFECTIVE_ACTIVE);
                     if ("optional".equals(avail)) {
                         dirs.put(ServiceNamespace.REQUIREMENT_RESOLUTION_DIRECTIVE, ServiceNamespace.RESOLUTION_OPTIONAL);
@@ -331,11 +327,11 @@ public class ResourceBuilder {
                     }
                     dirs.put(ServiceNamespace.REQUIREMENT_FILTER_DIRECTIVE, filter);
                     reqList.add(new RequirementImpl(
-                                    resource,
-                                    ServiceNamespace.SERVICE_NAMESPACE,
-                                    dirs,
-                                    Collections.<String, Object>emptyMap(),
-                                    SimpleFilter.parse(filter)));
+                            resource,
+                            ServiceNamespace.SERVICE_NAMESPACE,
+                            dirs,
+                            Collections.<String, Object>emptyMap(),
+                            SimpleFilter.parse(filter)));
                 }
             }
             return reqList;
@@ -346,7 +342,7 @@ public class ResourceBuilder {
 
     private static List<Requirement> convertImports(List<ParsedHeaderClause> clauses, Resource resource) {
         // Now convert generic header clauses into requirements.
-        List<Requirement> reqList = new ArrayList<Requirement>();
+        List<Requirement> reqList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String path : clause.paths) {
                 // Prepend the package name to the array of attributes.
@@ -354,9 +350,9 @@ public class ResourceBuilder {
                 // Note that we use a linked hash map here to ensure the
                 // package attribute is first, which will make indexing
                 // more efficient.
-    // TODO: OSGi R4.3 - This is ordering is kind of hacky.
+                // TODO: OSGi R4.3 - This is ordering is kind of hacky.
                 // Prepend the package name to the array of attributes.
-                Map<String, Object> newAttrs = new LinkedHashMap<String, Object>(attrs.size() + 1);
+                Map<String, Object> newAttrs = new LinkedHashMap<>(attrs.size() + 1);
                 // We want this first from an indexing perspective.
                 newAttrs.put(BundleRevision.PACKAGE_NAMESPACE, path);
                 newAttrs.putAll(attrs);
@@ -367,9 +363,9 @@ public class ResourceBuilder {
                 SimpleFilter sf = SimpleFilter.convert(newAttrs);
 
                 // Inject filter directive.
-    // TODO: OSGi R4.3 - Can we insert this on demand somehow?
+                // TODO: OSGi R4.3 - Can we insert this on demand somehow?
                 Map<String, String> dirs = clause.dirs;
-                Map<String, String> newDirs = new HashMap<String, String>(dirs.size() + 1);
+                Map<String, String> newDirs = new HashMap<>(dirs.size() + 1);
                 newDirs.putAll(dirs);
                 newDirs.put(Constants.FILTER_DIRECTIVE, sf.toString());
 
@@ -380,17 +376,16 @@ public class ResourceBuilder {
                                 BundleRevision.PACKAGE_NAMESPACE,
                                 newDirs,
                                 Collections.<String, Object>emptyMap(),
-                                sf));
+                                sf)
+                );
             }
         }
 
         return reqList;
     }
 
-    @SuppressWarnings( "deprecation" )
-    private static List<ParsedHeaderClause> normalizeDynamicImportClauses(
-            List<ParsedHeaderClause> clauses)
-            throws BundleException {
+    @SuppressWarnings("deprecation")
+    private static List<ParsedHeaderClause> normalizeDynamicImportClauses(List<ParsedHeaderClause> clauses) throws BundleException {
         // Verify that the values are equals if the package specifies
         // both version and specification-version attributes.
         for (ParsedHeaderClause clause : clauses) {
@@ -439,104 +434,85 @@ public class ResourceBuilder {
     }
 
     private static List<ParsedHeaderClause> normalizeRequireCapabilityClauses(
-            List<ParsedHeaderClause> clauses)
-            throws BundleException {
+            List<ParsedHeaderClause> clauses) throws BundleException {
 
         return clauses;
     }
 
     private static List<ParsedHeaderClause> normalizeProvideCapabilityClauses(
-            List<ParsedHeaderClause> clauses)
-            throws BundleException
-    {
+            List<ParsedHeaderClause> clauses) throws BundleException {
 
         // Convert attributes into specified types.
-        for (ParsedHeaderClause clause : clauses)
-        {
-            for (Map.Entry<String, String> entry : clause.types.entrySet())
-            {
+        for (ParsedHeaderClause clause : clauses) {
+            for (Map.Entry<String, String> entry : clause.types.entrySet()) {
                 String type = entry.getValue();
-                if (!type.equals("String"))
-                {
-                    if (type.equals("Double"))
-                    {
+                if (!type.equals("String")) {
+                    if (type.equals("Double")) {
                         clause.attrs.put(
                                 entry.getKey(),
                                 new Double(clause.attrs.get(entry.getKey()).toString().trim()));
-                    }
-                    else if (type.equals("Version"))
-                    {
+                    } else if (type.equals("Version")) {
                         clause.attrs.put(
                                 entry.getKey(),
                                 new Version(clause.attrs.get(entry.getKey()).toString().trim()));
-                    }
-                    else if (type.equals("Long"))
-                    {
+                    } else if (type.equals("Long")) {
                         clause.attrs.put(
                                 entry.getKey(),
                                 new Long(clause.attrs.get(entry.getKey()).toString().trim()));
-                    }
-                    else if (type.startsWith("List"))
-                    {
+                    } else if (type.startsWith("List")) {
                         int startIdx = type.indexOf('<');
                         int endIdx = type.indexOf('>');
                         if (((startIdx > 0) && (endIdx <= startIdx))
-                                || ((startIdx < 0) && (endIdx > 0)))
-                        {
+                                || ((startIdx < 0) && (endIdx > 0))) {
                             throw new BundleException(
                                     "Invalid Provide-Capability attribute list type for '"
                                             + entry.getKey()
                                             + "' : "
-                                            + type);
+                                            + type
+                            );
                         }
 
                         String listType = "String";
-                        if (endIdx > startIdx)
-                        {
+                        if (endIdx > startIdx) {
                             listType = type.substring(startIdx + 1, endIdx).trim();
                         }
 
                         List<String> tokens = parseDelimitedString(
                                 clause.attrs.get(entry.getKey()).toString(), ",", false);
-                        List<Object> values = new ArrayList<Object>(tokens.size());
-                        for (String token : tokens)
-                        {
-                            if (listType.equals("String"))
-                            {
+                        List<Object> values = new ArrayList<>(tokens.size());
+                        for (String token : tokens) {
+                            switch (listType) {
+                            case "String":
                                 values.add(token);
-                            }
-                            else if (listType.equals("Double"))
-                            {
+                                break;
+                            case "Double":
                                 values.add(new Double(token.trim()));
-                            }
-                            else if (listType.equals("Version"))
-                            {
+                                break;
+                            case "Version":
                                 values.add(new Version(token.trim()));
-                            }
-                            else if (listType.equals("Long"))
-                            {
+                                break;
+                            case "Long":
                                 values.add(new Long(token.trim()));
-                            }
-                            else
-                            {
+                                break;
+                            default:
                                 throw new BundleException(
                                         "Unknown Provide-Capability attribute list type for '"
                                                 + entry.getKey()
                                                 + "' : "
-                                                + type);
+                                                + type
+                                );
                             }
                         }
                         clause.attrs.put(
                                 entry.getKey(),
                                 values);
-                    }
-                    else
-                    {
+                    } else {
                         throw new BundleException(
                                 "Unknown Provide-Capability attribute type for '"
                                         + entry.getKey()
                                         + "' : "
-                                        + type);
+                                        + type
+                        );
                     }
                 }
             }
@@ -546,10 +522,10 @@ public class ResourceBuilder {
     }
 
     private static List<Requirement> convertRequireCapabilities(
-            List<ParsedHeaderClause> clauses, Resource resource)
-            throws BundleException {
+            List<ParsedHeaderClause> clauses, Resource resource) throws BundleException {
+
         // Now convert generic header clauses into requirements.
-        List<Requirement> reqList = new ArrayList<Requirement>();
+        List<Requirement> reqList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             try {
                 String filterStr = clause.dirs.get(Constants.FILTER_DIRECTIVE);
@@ -559,7 +535,7 @@ public class ResourceBuilder {
                 for (String path : clause.paths) {
                     // Create requirement and add to requirement list.
                     reqList.add(new RequirementImpl(
-                                    resource, path, clause.dirs, clause.attrs, sf));
+                            resource, path, clause.dirs, clause.attrs, sf));
                 }
             } catch (Exception ex) {
                 throw new BundleException("Error creating requirement: " + ex, ex);
@@ -570,9 +546,9 @@ public class ResourceBuilder {
     }
 
     private static List<Capability> convertProvideCapabilities(
-            List<ParsedHeaderClause> clauses, Resource resource)
-            throws BundleException {
-        List<Capability> capList = new ArrayList<Capability>();
+            List<ParsedHeaderClause> clauses, Resource resource) throws BundleException {
+
+        List<Capability> capList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String path : clause.paths) {
                 if (path.startsWith("osgi.wiring.")) {
@@ -587,11 +563,11 @@ public class ResourceBuilder {
         return capList;
     }
 
-    @SuppressWarnings( "deprecation" )
+    @SuppressWarnings("deprecation")
     private static List<ParsedHeaderClause> normalizeExportClauses(
             List<ParsedHeaderClause> clauses,
-            String bsn, Version bv)
-            throws BundleException {
+            String bsn, Version bv) throws BundleException {
+
         // Verify that "java.*" packages are not exported.
         for (ParsedHeaderClause clause : clauses) {
             // Verify that the named package has not already been declared.
@@ -599,16 +575,14 @@ public class ResourceBuilder {
                 // Verify that java.* packages are not exported.
                 if (pkgName.startsWith("java.")) {
                     throw new BundleException("Exporting java.* packages not allowed: " + pkgName);
-                }
                 // The character "." has no meaning in the OSGi spec except
                 // when placed on the bundle class path. Some people, however,
                 // mistakenly think it means the default package when imported
                 // or exported. This is not correct. It is invalid.
-                else if (pkgName.equals(".")) {
+                } else if (pkgName.equals(".")) {
                     throw new BundleException("Exporing '.' is invalid.");
-                }
                 // Make sure a package name was specified.
-                else if (pkgName.length() == 0) {
+                } else if (pkgName.length() == 0) {
                     throw new BundleException("Exported package names cannot be zero length.");
                 }
             }
@@ -653,14 +627,13 @@ public class ResourceBuilder {
         return clauses;
     }
 
-    private static List<Capability> convertExports(
-            List<ParsedHeaderClause> clauses, Resource resource) {
-        List<Capability> capList = new ArrayList<Capability>();
+    private static List<Capability> convertExports(List<ParsedHeaderClause> clauses, Resource resource) {
+        List<Capability> capList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String pkgName : clause.paths) {
                 // Prepend the package name to the array of attributes.
                 Map<String, Object> attrs = clause.attrs;
-                Map<String, Object> newAttrs = new HashMap<String, Object>(attrs.size() + 1);
+                Map<String, Object> newAttrs = new HashMap<>(attrs.size() + 1);
                 newAttrs.putAll(attrs);
                 newAttrs.put(BundleRevision.PACKAGE_NAMESPACE, pkgName);
 
@@ -677,69 +650,7 @@ public class ResourceBuilder {
         return (manifestVersion == null) ? "1" : manifestVersion.trim();
     }
 
-    private static List<ParsedHeaderClause> calculateImplicitImports(
-            List<BundleCapability> exports, List<ParsedHeaderClause> imports)
-            throws BundleException {
-        List<ParsedHeaderClause> clauseList = new ArrayList<ParsedHeaderClause>();
-
-        // Since all R3 exports imply an import, add a corresponding
-        // requirement for each existing export capability. Do not
-        // duplicate imports.
-        Map<String, String> map = new HashMap<String, String>();
-        // Add existing imports.
-        for (ParsedHeaderClause anImport : imports) {
-            for (int pathIdx = 0; pathIdx < anImport.paths.size(); pathIdx++) {
-                map.put(anImport.paths.get(pathIdx), anImport.paths.get(pathIdx));
-            }
-        }
-        // Add import requirement for each export capability.
-        for (BundleCapability export : exports) {
-            if (map.get(export.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE).toString()) == null) {
-                // Convert Version to VersionRange.
-                Object version = export.getAttributes().get(Constants.VERSION_ATTRIBUTE);
-                ParsedHeaderClause clause = new ParsedHeaderClause();
-                if (version != null) {
-                    clause.attrs.put(Constants.VERSION_ATTRIBUTE, VersionRange.parseVersionRange(version.toString()));
-                }
-                clause.paths.add((String) export.getAttributes().get(BundleRevision.PACKAGE_NAMESPACE));
-                clauseList.add(clause);
-            }
-        }
-
-        return clauseList;
-    }
-
-    private static List<Capability> calculateImplicitUses(
-            List<Capability> exports, List<ParsedHeaderClause> imports)
-            throws BundleException {
-        // Add a "uses" directive onto each export of R3 bundles
-        // that references every other import (which will include
-        // exports, since export implies import); this is
-        // necessary since R3 bundles assumed a single class space,
-        // but R4 allows for multiple class spaces.
-        String usesValue = "";
-        for (ParsedHeaderClause anImport : imports) {
-            for (int pathIdx = 0; pathIdx < anImport.paths.size(); pathIdx++) {
-                usesValue = usesValue
-                        + ((usesValue.length() > 0) ? "," : "")
-                        + anImport.paths.get(pathIdx);
-            }
-        }
-        for (int i = 0; i < exports.size(); i++) {
-            Map<String, String> dirs = new HashMap<String, String>(1);
-            dirs.put(Constants.USES_DIRECTIVE, usesValue);
-            exports.set(i, new CapabilityImpl(
-                    exports.get(i).getResource(),
-                    BundleRevision.PACKAGE_NAMESPACE,
-                    dirs,
-                    exports.get(i).getAttributes()));
-        }
-
-        return exports;
-    }
-
-    private static ParsedHeaderClause parseBundleSymbolicName(Map<String, String> headerMap)
-            throws BundleException {
+    private static ParsedHeaderClause parseBundleSymbolicName(Map<String, String> headerMap) throws BundleException {
         List<ParsedHeaderClause> clauses = parseStandardHeader(headerMap.get(Constants.BUNDLE_SYMBOLICNAME));
         if (clauses.size() > 0) {
             if (clauses.size() > 1 || clauses.get(0).paths.size() > 1) {
@@ -763,11 +674,8 @@ public class ResourceBuilder {
         return null;
     }
 
-    private static List<RequirementImpl> parseFragmentHost(
-            Resource resource, Map<String, String> headerMap)
-            throws BundleException {
-        List<RequirementImpl> reqs = new ArrayList<RequirementImpl>();
-
+    private static List<RequirementImpl> parseFragmentHost(Resource resource, Map<String, String> headerMap) throws BundleException {
+        List<RequirementImpl> reqs = new ArrayList<>();
         List<ParsedHeaderClause> clauses = parseStandardHeader(headerMap.get(Constants.FRAGMENT_HOST));
         if (clauses.size() > 0) {
             // Make sure that only one fragment host symbolic name is specified.
@@ -784,10 +692,10 @@ public class ResourceBuilder {
             // Note that we use a linked hash map here to ensure the
             // host symbolic name is first, which will make indexing
             // more efficient.
-    // TODO: OSGi R4.3 - This is ordering is kind of hacky.
+            // TODO: OSGi R4.3 - This is ordering is kind of hacky.
             // Prepend the host symbolic name to the map of attributes.
             Map<String, Object> attrs = clauses.get(0).attrs;
-            Map<String, Object> newAttrs = new LinkedHashMap<String, Object>(attrs.size() + 1);
+            Map<String, Object> newAttrs = new LinkedHashMap<>(attrs.size() + 1);
             // We want this first from an indexing perspective.
             newAttrs.put(BundleRevision.HOST_NAMESPACE, clauses.get(0).paths.get(0));
             newAttrs.putAll(attrs);
@@ -798,9 +706,9 @@ public class ResourceBuilder {
             SimpleFilter sf = SimpleFilter.convert(newAttrs);
 
             // Inject filter directive.
-    // TODO: OSGi R4.3 - Can we insert this on demand somehow?
+            // TODO: OSGi R4.3 - Can we insert this on demand somehow?
             Map<String, String> dirs = clauses.get(0).dirs;
-            Map<String, String> newDirs = new HashMap<String, String>(dirs.size() + 1);
+            Map<String, String> newDirs = new HashMap<>(dirs.size() + 1);
             newDirs.putAll(dirs);
             newDirs.put(Constants.FILTER_DIRECTIVE, sf.toString());
 
@@ -826,7 +734,7 @@ public class ResourceBuilder {
     }
 
     private static List<Requirement> convertRequires(List<ParsedHeaderClause> clauses, Resource resource) {
-        List<Requirement> reqList = new ArrayList<Requirement>();
+        List<Requirement> reqList = new ArrayList<>();
         for (ParsedHeaderClause clause : clauses) {
             for (String path : clause.paths) {
                 // Prepend the bundle symbolic name to the array of attributes.
@@ -834,9 +742,9 @@ public class ResourceBuilder {
                 // Note that we use a linked hash map here to ensure the
                 // symbolic name attribute is first, which will make indexing
                 // more efficient.
-    // TODO: OSGi R4.3 - This is ordering is kind of hacky.
+                // TODO: OSGi R4.3 - This is ordering is kind of hacky.
                 // Prepend the symbolic name to the array of attributes.
-                Map<String, Object> newAttrs = new LinkedHashMap<String, Object>(attrs.size() + 1);
+                Map<String, Object> newAttrs = new LinkedHashMap<>(attrs.size() + 1);
                 // We want this first from an indexing perspective.
                 newAttrs.put(BundleRevision.BUNDLE_NAMESPACE, path);
                 newAttrs.putAll(attrs);
@@ -847,9 +755,9 @@ public class ResourceBuilder {
                 SimpleFilter sf = SimpleFilter.convert(newAttrs);
 
                 // Inject filter directive.
-    // TODO: OSGi R4.3 - Can we insert this on demand somehow?
+                // TODO: OSGi R4.3 - Can we insert this on demand somehow?
                 Map<String, String> dirs = clause.dirs;
-                Map<String, String> newDirs = new HashMap<String, String>(dirs.size() + 1);
+                Map<String, String> newDirs = new HashMap<>(dirs.size() + 1);
                 newDirs.putAll(dirs);
                 newDirs.put(Constants.FILTER_DIRECTIVE, sf.toString());
 
@@ -861,30 +769,17 @@ public class ResourceBuilder {
         return reqList;
     }
 
-    private static final char EOF = (char) -1;
-
-    private static char charAt(int pos, String headers, int length)
-    {
-        if (pos >= length)
-        {
+    private static char charAt(int pos, String headers, int length) {
+        if (pos >= length) {
             return EOF;
         }
         return headers.charAt(pos);
     }
 
-    private static final int CLAUSE_START = 0;
-    private static final int PARAMETER_START = 1;
-    private static final int KEY = 2;
-    private static final int DIRECTIVE_OR_TYPEDATTRIBUTE = 4;
-    private static final int ARGUMENT = 8;
-    private static final int VALUE = 16;
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    private static List<ParsedHeaderClause> parseStandardHeader(String header)
-    {
-        List<ParsedHeaderClause> clauses = new ArrayList<ParsedHeaderClause>();
-        if (header == null)
-        {
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    private static List<ParsedHeaderClause> parseStandardHeader(String header) {
+        List<ParsedHeaderClause> clauses = new ArrayList<>();
+        if (header == null) {
             return clauses;
         }
         ParsedHeaderClause clause = null;
@@ -897,133 +792,110 @@ public class ResourceBuilder {
         boolean quoted = false;
         boolean escaped = false;
 
-        char currentChar = EOF;
-        do
-        {
+        char currentChar;
+        do {
             currentChar = charAt(currentPosition, header, length);
-            switch (state)
-            {
-                case CLAUSE_START:
-                    clause = new ParsedHeaderClause();
-                    clauses.add(clause);
-                    state = PARAMETER_START;
-                case PARAMETER_START:
-                    startPosition = currentPosition;
-                    state = KEY;
-                case KEY:
-                    switch (currentChar)
-                    {
-                        case ':':
-                        case '=':
-                            key = header.substring(startPosition, currentPosition).trim();
-                            startPosition = currentPosition + 1;
-                            targetMap = clause.attrs;
-                            state = currentChar == ':' ? DIRECTIVE_OR_TYPEDATTRIBUTE : ARGUMENT;
-                            break;
-                        case EOF:
-                        case ',':
-                        case ';':
-                            clause.paths.add(header.substring(startPosition, currentPosition).trim());
-                            state = currentChar == ',' ? CLAUSE_START : PARAMETER_START;
-                            break;
-                        default:
-                            break;
+            switch (state) {
+            case CLAUSE_START:
+                clause = new ParsedHeaderClause();
+                clauses.add(clause);
+                // Fall through
+            case PARAMETER_START:
+                startPosition = currentPosition;
+                state = KEY;
+                // Fall through
+            case KEY:
+                switch (currentChar) {
+                case ':':
+                case '=':
+                    key = header.substring(startPosition, currentPosition).trim();
+                    startPosition = currentPosition + 1;
+                    targetMap = clause.attrs;
+                    state = currentChar == ':' ? DIRECTIVE_OR_TYPEDATTRIBUTE : ARGUMENT;
+                    break;
+                case EOF:
+                case ',':
+                case ';':
+                    clause.paths.add(header.substring(startPosition, currentPosition).trim());
+                    state = currentChar == ',' ? CLAUSE_START : PARAMETER_START;
+                    break;
+                default:
+                    break;
+                }
+                currentPosition++;
+                break;
+            case DIRECTIVE_OR_TYPEDATTRIBUTE:
+                switch (currentChar) {
+                case '=':
+                    if (startPosition != currentPosition) {
+                        clause.types.put(key, header.substring(startPosition, currentPosition).trim());
+                    } else {
+                        targetMap = clause.dirs;
                     }
-                    currentPosition++;
+                    state = ARGUMENT;
+                    startPosition = currentPosition + 1;
                     break;
-                case DIRECTIVE_OR_TYPEDATTRIBUTE:
-                    switch(currentChar)
-                    {
-                        case '=':
-                            if (startPosition != currentPosition)
-                            {
-                                clause.types.put(key, header.substring(startPosition, currentPosition).trim());
+                default:
+                    break;
+                }
+                currentPosition++;
+                break;
+            case ARGUMENT:
+                if (currentChar == '\"') {
+                    quoted = true;
+                    currentPosition++;
+                } else {
+                    quoted = false;
+                }
+                if (!Character.isWhitespace(currentChar)) {
+                    state = VALUE;
+                } else {
+                    currentPosition++;
+                }
+                break;
+            case VALUE:
+                if (escaped) {
+                    escaped = false;
+                } else {
+                    if (currentChar == '\\') {
+                        escaped = true;
+                    } else if (quoted && currentChar == '\"') {
+                        quoted = false;
+                    } else if (!quoted) {
+                        String value;
+                        switch (currentChar) {
+                        case EOF:
+                        case ';':
+                        case ',':
+                            value = header.substring(startPosition, currentPosition).trim();
+                            if (value.startsWith("\"") && value.endsWith("\"")) {
+                                value = value.substring(1, value.length() - 1);
                             }
-                            else
-                            {
-                                targetMap = clause.dirs;
+                            if (targetMap.put(key, value) != null) {
+                                throw new IllegalArgumentException(
+                                        "Duplicate '" + key + "' in: " + header);
                             }
-                            state = ARGUMENT;
-                            startPosition = currentPosition + 1;
+                            state = currentChar == ';' ? PARAMETER_START : CLAUSE_START;
                             break;
                         default:
                             break;
-                    }
-                    currentPosition++;
-                    break;
-                case ARGUMENT:
-                    if (currentChar == '\"')
-                    {
-                        quoted = true;
-                        currentPosition++;
-                    }
-                    else
-                    {
-                        quoted = false;
-                    }
-                    if (!Character.isWhitespace(currentChar)) {
-                        state = VALUE;
-                    }
-                    else {
-                        currentPosition++;
-                    }
-                    break;
-                case VALUE:
-                    if (escaped)
-                    {
-                        escaped = false;
-                    }
-                    else
-                    {
-                        if (currentChar == '\\' )
-                        {
-                            escaped = true;
-                        }
-                        else if (quoted && currentChar == '\"')
-                        {
-                            quoted = false;
-                        }
-                        else if (!quoted)
-                        {
-                            String value = null;
-                            switch(currentChar)
-                            {
-                                case EOF:
-                                case ';':
-                                case ',':
-                                    value = header.substring(startPosition, currentPosition).trim();
-                                    if (value.startsWith("\"") && value.endsWith("\""))
-                                    {
-                                        value = value.substring(1, value.length() - 1);
-                                    }
-                                    if (targetMap.put(key, value) != null)
-                                    {
-                                        throw new IllegalArgumentException(
-                                                "Duplicate '" + key + "' in: " + header);
-                                    }
-                                    state = currentChar == ';' ? PARAMETER_START : CLAUSE_START;
-                                    break;
-                                default:
-                                    break;
-                            }
                         }
                     }
-                    currentPosition++;
-                    break;
-                default:
-                    break;
+                }
+                currentPosition++;
+                break;
+            default:
+                break;
             }
-        } while ( currentChar != EOF);
+        } while (currentChar != EOF);
 
-        if (state > PARAMETER_START)
-        {
+        if (state > PARAMETER_START) {
             throw new IllegalArgumentException("Unable to parse header: " + header);
         }
         return clauses;
     }
 
-    public static List<String> parseDelimitedString(String value, String delim)
-    {
+    public static List<String> parseDelimitedString(String value, String delim) {
         return parseDelimitedString(value, delim, true);
     }
 
@@ -1032,88 +904,62 @@ public class ResourceBuilder {
      * parser obeys quotes, so the delimiter character will be ignored if it is
      * inside of a quote. This method assumes that the quote character is not
      * included in the set of delimiter characters.
+     *
      * @param value the delimited string to parse.
      * @param delim the characters delimiting the tokens.
      * @return a list of string or an empty list if there are none.
-     **/
-    public static List<String> parseDelimitedString(String value, String delim, boolean trim)
-    {
-        if (value == null)
-        {
+     */
+    public static List<String> parseDelimitedString(String value, String delim, boolean trim) {
+        if (value == null) {
             value = "";
         }
 
-        List<String> list = new ArrayList();
+        List<String> list = new ArrayList<>();
 
-        int CHAR = 1;
-        int DELIMITER = 2;
-        int STARTQUOTE = 4;
-        int ENDQUOTE = 8;
+        StringBuilder sb = new StringBuilder();
 
-        StringBuffer sb = new StringBuffer();
-
-        int expecting = (CHAR | DELIMITER | STARTQUOTE);
+        int expecting = CHAR | DELIMITER | STARTQUOTE;
 
         boolean isEscaped = false;
-        for (int i = 0; i < value.length(); i++)
-        {
+        for (int i = 0; i < value.length(); i++) {
             char c = value.charAt(i);
 
-            boolean isDelimiter = (delim.indexOf(c) >= 0);
+            boolean isDelimiter = delim.indexOf(c) >= 0;
 
-            if (!isEscaped && (c == '\\'))
-            {
+            if (!isEscaped && c == '\\') {
                 isEscaped = true;
                 continue;
             }
 
-            if (isEscaped)
-            {
+            if (isEscaped) {
                 sb.append(c);
-            }
-            else if (isDelimiter && ((expecting & DELIMITER) > 0))
-            {
-                if (trim)
-                {
+            } else if (isDelimiter && ((expecting & DELIMITER) > 0)) {
+                if (trim) {
                     list.add(sb.toString().trim());
-                }
-                else
-                {
+                } else {
                     list.add(sb.toString());
                 }
                 sb.delete(0, sb.length());
-                expecting = (CHAR | DELIMITER | STARTQUOTE);
-            }
-            else if ((c == '"') && ((expecting & STARTQUOTE) > 0))
-            {
+                expecting = CHAR | DELIMITER | STARTQUOTE;
+            } else if ((c == '"') && (expecting & STARTQUOTE) > 0) {
                 sb.append(c);
                 expecting = CHAR | ENDQUOTE;
-            }
-            else if ((c == '"') && ((expecting & ENDQUOTE) > 0))
-            {
+            } else if ((c == '"') && (expecting & ENDQUOTE) > 0) {
                 sb.append(c);
-                expecting = (CHAR | STARTQUOTE | DELIMITER);
-            }
-            else if ((expecting & CHAR) > 0)
-            {
+                expecting = CHAR | STARTQUOTE | DELIMITER;
+            } else if ((expecting & CHAR) > 0) {
                 sb.append(c);
-            }
-            else
-            {
+            } else {
                 throw new IllegalArgumentException("Invalid delimited string: " + value);
             }
 
             isEscaped = false;
         }
 
-        if (sb.length() > 0)
-        {
-            if (trim)
-            {
+        if (sb.length() > 0) {
+            if (trim) {
                 list.add(sb.toString().trim());
-            }
-            else
-            {
+            } else {
                 list.add(sb.toString());
             }
         }
@@ -1123,9 +969,9 @@ public class ResourceBuilder {
 
 
     static class ParsedHeaderClause {
-        public final List<String> paths = new ArrayList<String>();
-        public final Map<String, String> dirs = new LinkedHashMap<String, String>();
-        public final Map<String, Object> attrs = new LinkedHashMap<String, Object>();
-        public final Map<String, String> types = new LinkedHashMap<String, String>();
+        public final List<String> paths = new ArrayList<>();
+        public final Map<String, String> dirs = new LinkedHashMap<>();
+        public final Map<String, Object> attrs = new LinkedHashMap<>();
+        public final Map<String, String> types = new LinkedHashMap<>();
     }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java
index cd48ca2..99ffb52 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceImpl.java
@@ -31,38 +31,33 @@ import org.osgi.resource.Resource;
  */
 public class ResourceImpl implements Resource {
 
-    private final List<Capability> m_caps;
-    private final List<Requirement> m_reqs;
+    private final List<Capability> caps;
+    private final List<Requirement> reqs;
 
     /**
      * CAUTION: This constructor does not ensure that the resource
      * has the required identity capability
      */
     public ResourceImpl() {
-        m_caps = new ArrayList<Capability>();
-        m_reqs = new ArrayList<Requirement>();
+        caps = new ArrayList<>();
+        reqs = new ArrayList<>();
     }
 
-    public ResourceImpl(String name, Version version) {
-        this(name, IdentityNamespace.TYPE_BUNDLE, version);
-    }
-
-    public ResourceImpl(String name, String type, Version version)
-    {
-        m_caps = new ArrayList<Capability>();
-        Map<String, String> dirs = new HashMap<String, String>();
-        Map<String, Object> attrs = new HashMap<String, Object>();
+    public ResourceImpl(String name, String type, Version version) {
+        caps = new ArrayList<>();
+        Map<String, String> dirs = new HashMap<>();
+        Map<String, Object> attrs = new HashMap<>();
         attrs.put(IdentityNamespace.IDENTITY_NAMESPACE, name);
         attrs.put(IdentityNamespace.CAPABILITY_TYPE_ATTRIBUTE, type);
         attrs.put(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE, version);
         CapabilityImpl identity = new CapabilityImpl(this, IdentityNamespace.IDENTITY_NAMESPACE, dirs, attrs);
-        m_caps.add(identity);
-        m_reqs = new ArrayList<Requirement>();
+        caps.add(identity);
+        reqs = new ArrayList<>();
     }
 
     public void addCapability(Capability capability) {
         assert capability.getResource() == this;
-        m_caps.add(capability);
+        caps.add(capability);
     }
 
     public void addCapabilities(Iterable<? extends Capability> capabilities) {
@@ -73,7 +68,7 @@ public class ResourceImpl implements Resource {
 
     public void addRequirement(Requirement requirement) {
         assert requirement.getResource() == this;
-        m_reqs.add(requirement);
+        reqs.add(requirement);
     }
 
     public void addRequirements(Iterable<? extends Requirement> requirements) {
@@ -82,16 +77,12 @@ public class ResourceImpl implements Resource {
         }
     }
 
-    public List<Capability> getCapabilities(String namespace)
-    {
-        List<Capability> result = m_caps;
-        if (namespace != null)
-        {
-            result = new ArrayList<Capability>();
-            for (Capability cap : m_caps)
-            {
-                if (cap.getNamespace().equals(namespace))
-                {
+    public List<Capability> getCapabilities(String namespace) {
+        List<Capability> result = caps;
+        if (namespace != null) {
+            result = new ArrayList<>();
+            for (Capability cap : caps) {
+                if (cap.getNamespace().equals(namespace)) {
                     result.add(cap);
                 }
             }
@@ -99,16 +90,12 @@ public class ResourceImpl implements Resource {
         return result;
     }
 
-    public List<Requirement> getRequirements(String namespace)
-    {
-        List<Requirement> result = m_reqs;
-        if (namespace != null)
-        {
-            result = new ArrayList<Requirement>();
-            for (Requirement req : m_reqs)
-            {
-                if (req.getNamespace().equals(namespace))
-                {
+    public List<Requirement> getRequirements(String namespace) {
+        List<Requirement> result = reqs;
+        if (namespace != null) {
+            result = new ArrayList<>();
+            for (Requirement req : reqs) {
+                if (req.getNamespace().equals(namespace)) {
                     result.add(req);
                 }
             }
@@ -117,8 +104,7 @@ public class ResourceImpl implements Resource {
     }
 
     @Override
-    public String toString()
-    {
+    public String toString() {
         Capability cap = getCapabilities(IdentityNamespace.IDENTITY_NAMESPACE).get(0);
         return cap.getAttributes().get(IdentityNamespace.IDENTITY_NAMESPACE) + "/"
                 + cap.getAttributes().get(IdentityNamespace.CAPABILITY_VERSION_ATTRIBUTE);

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java
index 03d4fd9..b22f9b8 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/ResourceUtils.java
@@ -32,12 +32,15 @@ import static org.osgi.framework.namespace.IdentityNamespace.IDENTITY_NAMESPACE;
 import static org.osgi.service.repository.ContentNamespace.CAPABILITY_URL_ATTRIBUTE;
 import static org.osgi.service.repository.ContentNamespace.CONTENT_NAMESPACE;
 
-public class ResourceUtils {
+public final class ResourceUtils {
 
     public static final String TYPE_SUBSYSTEM = "karaf.subsystem";
 
     public static final String TYPE_FEATURE = "karaf.feature";
 
+    private ResourceUtils() {
+    }
+
     public static String getUri(Resource resource) {
         List<Capability> caps = resource.getCapabilities(null);
         for (Capability cap : caps) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java
index ae10441..1e2a48c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/SimpleFilter.java
@@ -23,8 +23,7 @@ import java.util.Map.Entry;
 
 import org.apache.felix.utils.version.VersionRange;
 
-public class SimpleFilter
-{
+public class SimpleFilter {
     public static final int MATCH_ALL = 0;
     public static final int AND = 1;
     public static final int OR = 2;
@@ -36,94 +35,83 @@ public class SimpleFilter
     public static final int PRESENT = 8;
     public static final int APPROX = 9;
 
-    private final String m_name;
-    private final Object m_value;
-    private final int m_op;
+    private final String name;
+    private final Object value;
+    private final int op;
 
-    public SimpleFilter(String attr, Object value, int op)
-    {
-        m_name = attr;
-        m_value = value;
-        m_op = op;
+    public SimpleFilter(String name, Object value, int op) {
+        this.name = name;
+        this.value = value;
+        this.op = op;
     }
 
-    public String getName()
-    {
-        return m_name;
+    public String getName() {
+        return name;
     }
 
-    public Object getValue()
-    {
-        return m_value;
+    public Object getValue() {
+        return value;
     }
 
-    public int getOperation()
-    {
-        return m_op;
+    public int getOperation() {
+        return op;
     }
 
-    public String toString()
-    {
+    public String toString() {
         String s = null;
-        switch (m_op)
-        {
-            case AND:
-                s = "(&" + toString((List) m_value) + ")";
-                break;
-            case OR:
-                s = "(|" + toString((List) m_value) + ")";
-                break;
-            case NOT:
-                s = "(!" + toString((List) m_value) + ")";
-                break;
-            case EQ:
-                s = "(" + m_name + "=" + toEncodedString(m_value) + ")";
-                break;
-            case LTE:
-                s = "(" + m_name + "<=" + toEncodedString(m_value) + ")";
-                break;
-            case GTE:
-                s = "(" + m_name + ">=" + toEncodedString(m_value) + ")";
-                break;
-            case SUBSTRING:
-                s = "(" + m_name + "=" + unparseSubstring((List<String>) m_value) + ")";
-                break;
-            case PRESENT:
-                s = "(" + m_name + "=*)";
-                break;
-            case APPROX:
-                s = "(" + m_name + "~=" + toEncodedString(m_value) + ")";
-                break;
-            case MATCH_ALL:
-                s = "(*)";
-                break;
+        switch (op) {
+        case AND:
+            s = "(&" + toString((List) value) + ")";
+            break;
+        case OR:
+            s = "(|" + toString((List) value) + ")";
+            break;
+        case NOT:
+            s = "(!" + toString((List) value) + ")";
+            break;
+        case EQ:
+            s = "(" + name + "=" + toEncodedString(value) + ")";
+            break;
+        case LTE:
+            s = "(" + name + "<=" + toEncodedString(value) + ")";
+            break;
+        case GTE:
+            s = "(" + name + ">=" + toEncodedString(value) + ")";
+            break;
+        case SUBSTRING:
+            s = "(" + name + "=" + unparseSubstring((List<String>) value) + ")";
+            break;
+        case PRESENT:
+            s = "(" + name + "=*)";
+            break;
+        case APPROX:
+            s = "(" + name + "~=" + toEncodedString(value) + ")";
+            break;
+        case MATCH_ALL:
+            s = "(*)";
+            break;
+        default:
+            throw new IllegalStateException("Unsupported operator " + op);
         }
         return s;
     }
 
-    private static String toString(List list)
-    {
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0; i < list.size(); i++)
-        {
-            sb.append(list.get(i).toString());
+    private static String toString(List list) {
+        StringBuilder sb = new StringBuilder();
+        for (Object aList : list) {
+            sb.append(aList.toString());
         }
         return sb.toString();
     }
 
-    private static String toDecodedString(String s, int startIdx, int endIdx)
-    {
-        StringBuffer sb = new StringBuffer(endIdx - startIdx);
+    private static String toDecodedString(String s, int startIdx, int endIdx) {
+        StringBuilder sb = new StringBuilder(endIdx - startIdx);
         boolean escaped = false;
-        for (int i = 0; i < (endIdx - startIdx); i++)
-        {
+        for (int i = 0; i < (endIdx - startIdx); i++) {
             char c = s.charAt(startIdx + i);
-            if (!escaped && (c == '\\'))
-            {
+            if (!escaped && (c == '\\')) {
                 escaped = true;
-            }
-            else
-            {
+            } else {
                 escaped = false;
                 sb.append(c);
             }
@@ -132,17 +120,13 @@ public class SimpleFilter
         return sb.toString();
     }
 
-    private static String toEncodedString(Object o)
-    {
-        if (o instanceof String)
-        {
+    private static String toEncodedString(Object o) {
+        if (o instanceof String) {
             String s = (String) o;
-            StringBuffer sb = new StringBuffer();
-            for (int i = 0; i < s.length(); i++)
-            {
+            StringBuilder sb = new StringBuilder();
+            for (int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
-                if ((c == '\\') || (c == '(') || (c == ')') || (c == '*'))
-                {
+                if ((c == '\\') || (c == '(') || (c == ')') || (c == '*')) {
                     sb.append('\\');
                 }
                 sb.append(c);
@@ -154,143 +138,97 @@ public class SimpleFilter
         return o.toString();
     }
 
-    public static SimpleFilter parse(String filter)
-    {
+    public static SimpleFilter parse(String filter) {
         int idx = skipWhitespace(filter, 0);
 
-        if ((filter == null) || (filter.length() == 0) || (idx >= filter.length()))
-        {
+        if ((filter == null) || (filter.length() == 0) || (idx >= filter.length())) {
             throw new IllegalArgumentException("Null or empty filter.");
-        }
-        else if (filter.charAt(idx) != '(')
-        {
+        } else if (filter.charAt(idx) != '(') {
             throw new IllegalArgumentException("Missing opening parenthesis: " + filter);
         }
 
         SimpleFilter sf = null;
-        List stack = new ArrayList();
+        List<Object> stack = new ArrayList<>();
         boolean isEscaped = false;
-        while (idx < filter.length())
-        {
-            if (sf != null)
-            {
+        while (idx < filter.length()) {
+            if (sf != null) {
                 throw new IllegalArgumentException(
                         "Only one top-level operation allowed: " + filter);
             }
 
-            if (!isEscaped && (filter.charAt(idx) == '('))
-            {
+            if (!isEscaped && (filter.charAt(idx) == '(')) {
                 // Skip paren and following whitespace.
                 idx = skipWhitespace(filter, idx + 1);
 
-                if (filter.charAt(idx) == '&')
-                {
+                if (filter.charAt(idx) == '&') {
                     int peek = skipWhitespace(filter, idx + 1);
-                    if (filter.charAt(peek) == '(')
-                    {
+                    if (filter.charAt(peek) == '(') {
                         idx = peek - 1;
                         stack.add(0, new SimpleFilter(null, new ArrayList(), SimpleFilter.AND));
+                    } else {
+                        stack.add(0, idx);
                     }
-                    else
-                    {
-                        stack.add(0, new Integer(idx));
-                    }
-                }
-                else if (filter.charAt(idx) == '|')
-                {
+                } else if (filter.charAt(idx) == '|') {
                     int peek = skipWhitespace(filter, idx + 1);
-                    if (filter.charAt(peek) == '(')
-                    {
+                    if (filter.charAt(peek) == '(') {
                         idx = peek - 1;
                         stack.add(0, new SimpleFilter(null, new ArrayList(), SimpleFilter.OR));
+                    } else {
+                        stack.add(0, idx);
                     }
-                    else
-                    {
-                        stack.add(0, new Integer(idx));
-                    }
-                }
-                else if (filter.charAt(idx) == '!')
-                {
+                } else if (filter.charAt(idx) == '!') {
                     int peek = skipWhitespace(filter, idx + 1);
-                    if (filter.charAt(peek) == '(')
-                    {
+                    if (filter.charAt(peek) == '(') {
                         idx = peek - 1;
                         stack.add(0, new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT));
+                    } else {
+                        stack.add(0, idx);
                     }
-                    else
-                    {
-                        stack.add(0, new Integer(idx));
-                    }
-                }
-                else
-                {
-                    stack.add(0, new Integer(idx));
+                } else {
+                    stack.add(0, idx);
                 }
-            }
-            else if (!isEscaped && (filter.charAt(idx) == ')'))
-            {
+            } else if (!isEscaped && (filter.charAt(idx) == ')')) {
                 Object top = stack.remove(0);
-                if (top instanceof SimpleFilter)
-                {
-                    if (!stack.isEmpty() && (stack.get(0) instanceof SimpleFilter))
-                    {
-                        ((List) ((SimpleFilter) stack.get(0)).m_value).add(top);
-                    }
-                    else
-                    {
+                if (top instanceof SimpleFilter) {
+                    if (!stack.isEmpty() && (stack.get(0) instanceof SimpleFilter)) {
+                        ((List<Object>) ((SimpleFilter) stack.get(0)).value).add(top);
+                    } else {
                         sf = (SimpleFilter) top;
                     }
+                } else if (!stack.isEmpty() && (stack.get(0) instanceof SimpleFilter)) {
+                    ((List<Object>) ((SimpleFilter) stack.get(0)).value).add(
+                            SimpleFilter.subfilter(filter, (Integer) top, idx));
+                } else {
+                    sf = SimpleFilter.subfilter(filter, (Integer) top, idx);
                 }
-                else if (!stack.isEmpty() && (stack.get(0) instanceof SimpleFilter))
-                {
-                    ((List) ((SimpleFilter) stack.get(0)).m_value).add(
-                            SimpleFilter.subfilter(filter, ((Integer) top).intValue(), idx));
-                }
-                else
-                {
-                    sf = SimpleFilter.subfilter(filter, ((Integer) top).intValue(), idx);
-                }
-            }
-            else if (!isEscaped && (filter.charAt(idx) == '\\'))
-            {
-                isEscaped = true;
-            }
-            else
-            {
-                isEscaped = false;
+            } else {
+                isEscaped = !isEscaped && (filter.charAt(idx) == '\\');
             }
 
             idx = skipWhitespace(filter, idx + 1);
         }
 
-        if (sf == null)
-        {
+        if (sf == null) {
             throw new IllegalArgumentException("Missing closing parenthesis: " + filter);
         }
 
         return sf;
     }
 
-    private static SimpleFilter subfilter(String filter, int startIdx, int endIdx)
-    {
+    private static SimpleFilter subfilter(String filter, int startIdx, int endIdx) {
         final String opChars = "=<>~";
 
         // Determine the ending index of the attribute name.
         int attrEndIdx = startIdx;
-        for (int i = 0; i < (endIdx - startIdx); i++)
-        {
+        for (int i = 0; i < (endIdx - startIdx); i++) {
             char c = filter.charAt(startIdx + i);
-            if (opChars.indexOf(c) >= 0)
-            {
+            if (opChars.indexOf(c) >= 0) {
                 break;
-            }
-            else if (!Character.isWhitespace(c))
-            {
+            } else if (!Character.isWhitespace(c)) {
                 attrEndIdx = startIdx + i + 1;
             }
         }
-        if (attrEndIdx == startIdx)
-        {
+        if (attrEndIdx == startIdx) {
             throw new IllegalArgumentException(
                     "Missing attribute name: " + filter.substring(startIdx, endIdx));
         }
@@ -300,43 +238,39 @@ public class SimpleFilter
         startIdx = skipWhitespace(filter, attrEndIdx);
 
         // Determine the operator type.
-        int op = -1;
-        switch (filter.charAt(startIdx))
-        {
-            case '=':
-                op = EQ;
-                startIdx++;
-                break;
-            case '<':
-                if (filter.charAt(startIdx + 1) != '=')
-                {
-                    throw new IllegalArgumentException(
-                            "Unknown operator: " + filter.substring(startIdx, endIdx));
-                }
-                op = LTE;
-                startIdx += 2;
-                break;
-            case '>':
-                if (filter.charAt(startIdx + 1) != '=')
-                {
-                    throw new IllegalArgumentException(
-                            "Unknown operator: " + filter.substring(startIdx, endIdx));
-                }
-                op = GTE;
-                startIdx += 2;
-                break;
-            case '~':
-                if (filter.charAt(startIdx + 1) != '=')
-                {
-                    throw new IllegalArgumentException(
-                            "Unknown operator: " + filter.substring(startIdx, endIdx));
-                }
-                op = APPROX;
-                startIdx += 2;
-                break;
-            default:
+        int op;
+        switch (filter.charAt(startIdx)) {
+        case '=':
+            op = EQ;
+            startIdx++;
+            break;
+        case '<':
+            if (filter.charAt(startIdx + 1) != '=') {
+                throw new IllegalArgumentException(
+                        "Unknown operator: " + filter.substring(startIdx, endIdx));
+            }
+            op = LTE;
+            startIdx += 2;
+            break;
+        case '>':
+            if (filter.charAt(startIdx + 1) != '=') {
+                throw new IllegalArgumentException(
+                        "Unknown operator: " + filter.substring(startIdx, endIdx));
+            }
+            op = GTE;
+            startIdx += 2;
+            break;
+        case '~':
+            if (filter.charAt(startIdx + 1) != '=') {
                 throw new IllegalArgumentException(
                         "Unknown operator: " + filter.substring(startIdx, endIdx));
+            }
+            op = APPROX;
+            startIdx += 2;
+            break;
+        default:
+            throw new IllegalArgumentException(
+                    "Unknown operator: " + filter.substring(startIdx, endIdx));
         }
 
         // Parse value.
@@ -344,18 +278,14 @@ public class SimpleFilter
 
         // Check if the equality comparison is actually a substring
         // or present operation.
-        if (op == EQ)
-        {
+        if (op == EQ) {
             String valueStr = filter.substring(startIdx, endIdx);
             List<String> values = parseSubstring(valueStr);
             if ((values.size() == 2)
                     && (values.get(0).length() == 0)
-                    && (values.get(1).length() == 0))
-            {
+                    && (values.get(1).length() == 0)) {
                 op = PRESENT;
-            }
-            else if (values.size() > 1)
-            {
+            } else if (values.size() > 1) {
                 op = SUBSTRING;
                 value = values;
             }
@@ -364,10 +294,9 @@ public class SimpleFilter
         return new SimpleFilter(attr, value, op);
     }
 
-    public static List<String> parseSubstring(String value)
-    {
-        List<String> pieces = new ArrayList();
-        StringBuffer ss = new StringBuffer();
+    public static List<String> parseSubstring(String value) {
+        List<String> pieces = new ArrayList<>();
+        StringBuilder ss = new StringBuilder();
         // int kind = SIMPLE; // assume until proven otherwise
         boolean wasStar = false; // indicates last piece was a star
         boolean leftstar = false; // track if the initial piece is a star
@@ -377,17 +306,12 @@ public class SimpleFilter
 
         // We assume (sub)strings can contain leading and trailing blanks
         boolean escaped = false;
-        loop:   for (;;)
-        {
-            if (idx >= value.length())
-            {
-                if (wasStar)
-                {
+        for (;;) {
+            if (idx >= value.length()) {
+                if (wasStar) {
                     // insert last piece as "" to handle trailing star
                     rightstar = true;
-                }
-                else
-                {
+                } else {
                     pieces.add(ss.toString());
                     // accumulate the last piece
                     // note that in the case of
@@ -395,64 +319,50 @@ public class SimpleFilter
                     // the string "" (!=null)
                 }
                 ss.setLength(0);
-                break loop;
+                break;
             }
 
             // Read the next character and account for escapes.
             char c = value.charAt(idx++);
-            if (!escaped && (c == '*'))
-            {
+            if (!escaped && (c == '*')) {
                 // If we have successive '*' characters, then we can
                 // effectively collapse them by ignoring succeeding ones.
-                if (!wasStar)
-                {
-                    if (ss.length() > 0)
-                    {
+                if (!wasStar) {
+                    if (ss.length() > 0) {
                         pieces.add(ss.toString()); // accumulate the pieces
                         // between '*' occurrences
                     }
                     ss.setLength(0);
                     // if this is a leading star, then track it
-                    if (pieces.isEmpty())
-                    {
+                    if (pieces.isEmpty()) {
                         leftstar = true;
                     }
                     wasStar = true;
                 }
-            }
-            else if (!escaped && (c == '\\'))
-            {
+            } else if (!escaped && (c == '\\')) {
                 escaped = true;
-            }
-            else
-            {
+            } else {
                 escaped = false;
                 wasStar = false;
                 ss.append(c);
             }
         }
-        if (leftstar || rightstar || pieces.size() > 1)
-        {
+        if (leftstar || rightstar || pieces.size() > 1) {
             // insert leading and/or trailing "" to anchor ends
-            if (rightstar)
-            {
+            if (rightstar) {
                 pieces.add("");
             }
-            if (leftstar)
-            {
+            if (leftstar) {
                 pieces.add(0, "");
             }
         }
         return pieces;
     }
 
-    public static String unparseSubstring(List<String> pieces)
-    {
-        StringBuffer sb = new StringBuffer();
-        for (int i = 0; i < pieces.size(); i++)
-        {
-            if (i > 0)
-            {
+    public static String unparseSubstring(List<String> pieces) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < pieces.size(); i++) {
+            if (i > 0) {
                 sb.append("*");
             }
             sb.append(toEncodedString(pieces.get(i)));
@@ -460,8 +370,7 @@ public class SimpleFilter
         return sb.toString();
     }
 
-    public static boolean compareSubstring(List<String> pieces, String s)
-    {
+    public static boolean compareSubstring(List<String> pieces, String s) {
         // Walk the pieces to match the string
         // There are implicit stars between each piece,
         // and the first and last pieces might be "" to anchor the match.
@@ -473,8 +382,7 @@ public class SimpleFilter
 
         // Special case, if there is only one piece, then
         // we must perform an equality test.
-        if (len == 1)
-        {
+        if (len == 1) {
             return s.equals(pieces.get(0));
         }
 
@@ -483,45 +391,32 @@ public class SimpleFilter
 
         int index = 0;
 
-        loop:   for (int i = 0; i < len; i++)
-        {
+        for (int i = 0; i < len; i++) {
             String piece = pieces.get(i);
 
             // If this is the first piece, then make sure the
             // string starts with it.
-            if (i == 0)
-            {
-                if (!s.startsWith(piece))
-                {
+            if (i == 0) {
+                if (!s.startsWith(piece)) {
                     result = false;
-                    break loop;
+                    break;
                 }
             }
 
             // If this is the last piece, then make sure the
             // string ends with it.
-            if (i == (len - 1))
-            {
-                if (s.endsWith(piece) && (s.length() >= (index + piece.length())))
-                {
-                    result = true;
-                }
-                else
-                {
-                    result = false;
-                }
-                break loop;
+            if (i == (len - 1)) {
+                result = s.endsWith(piece) && (s.length() >= (index + piece.length()));
+                break;
             }
 
             // If this is neither the first or last piece, then
             // make sure the string contains it.
-            if ((i > 0) && (i < (len - 1)))
-            {
+            if ((i > 0) && (i < (len - 1))) {
                 index = s.indexOf(piece, index);
-                if (index < 0)
-                {
+                if (index < 0) {
                     result = false;
-                    break loop;
+                    break;
                 }
             }
 
@@ -532,11 +427,9 @@ public class SimpleFilter
         return result;
     }
 
-    private static int skipWhitespace(String s, int startIdx)
-    {
+    private static int skipWhitespace(String s, int startIdx) {
         int len = s.length();
-        while ((startIdx < len) && Character.isWhitespace(s.charAt(startIdx)))
-        {
+        while ((startIdx < len) && Character.isWhitespace(s.charAt(startIdx))) {
             startIdx++;
         }
         return startIdx;
@@ -549,98 +442,85 @@ public class SimpleFilter
      * in the desired order. Equality testing is assumed for all attribute types
      * other than version ranges, which are handled appropriated. If the attribute
      * map is empty, then a filter that matches anything is returned.
+     *
      * @param attrs Map of attributes to convert to a filter.
      * @return A filter corresponding to the attributes.
      */
-    public static SimpleFilter convert(Map<String, Object> attrs)
-    {
+    public static SimpleFilter convert(Map<String, Object> attrs) {
         // Rather than building a filter string to be parsed into a SimpleFilter,
         // we will just create the parsed SimpleFilter directly.
 
         List<SimpleFilter> filters = new ArrayList<SimpleFilter>();
 
-        for (Entry<String, Object> entry : attrs.entrySet())
-        {
-            if (entry.getValue() instanceof VersionRange)
-            {
+        for (Entry<String, Object> entry : attrs.entrySet()) {
+            if (entry.getValue() instanceof VersionRange) {
                 VersionRange vr = (VersionRange) entry.getValue();
-                if (!vr.isOpenFloor())
-                {
+                if (!vr.isOpenFloor()) {
                     filters.add(
                             new SimpleFilter(
                                     entry.getKey(),
                                     vr.getFloor().toString(),
-                                    SimpleFilter.GTE));
-                }
-                else
-                {
+                                    SimpleFilter.GTE)
+                    );
+                } else {
                     SimpleFilter not =
                             new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT);
-                    ((List) not.getValue()).add(
+                    ((List<Object>) not.getValue()).add(
                             new SimpleFilter(
                                     entry.getKey(),
                                     vr.getFloor().toString(),
-                                    SimpleFilter.LTE));
+                                    SimpleFilter.LTE)
+                    );
                     filters.add(not);
                 }
 
-                if (vr.getCeiling() != null)
-                {
-                    if (!vr.isOpenCeiling())
-                    {
+                if (vr.getCeiling() != null) {
+                    if (!vr.isOpenCeiling()) {
                         filters.add(
                                 new SimpleFilter(
                                         entry.getKey(),
                                         vr.getCeiling().toString(),
-                                        SimpleFilter.LTE));
-                    }
-                    else
-                    {
+                                        SimpleFilter.LTE)
+                        );
+                    } else {
                         SimpleFilter not =
                                 new SimpleFilter(null, new ArrayList(), SimpleFilter.NOT);
-                        ((List) not.getValue()).add(
+                        ((List<Object>) not.getValue()).add(
                                 new SimpleFilter(
                                         entry.getKey(),
                                         vr.getCeiling().toString(),
-                                        SimpleFilter.GTE));
+                                        SimpleFilter.GTE)
+                        );
                         filters.add(not);
                     }
                 }
-            }
-            else
-            {
+            } else {
                 List<String> values = SimpleFilter.parseSubstring(entry.getValue().toString());
-                if (values.size() > 1)
-                {
+                if (values.size() > 1) {
                     filters.add(
                             new SimpleFilter(
                                     entry.getKey(),
                                     values,
-                                    SimpleFilter.SUBSTRING));
-                }
-                else
-                {
+                                    SimpleFilter.SUBSTRING)
+                    );
+                } else {
                     filters.add(
                             new SimpleFilter(
                                     entry.getKey(),
                                     values.get(0),
-                                    SimpleFilter.EQ));
+                                    SimpleFilter.EQ)
+                    );
                 }
             }
         }
 
         SimpleFilter sf = null;
 
-        if (filters.size() == 1)
-        {
+        if (filters.size() == 1) {
             sf = filters.get(0);
-        }
-        else if (attrs.size() > 1)
-        {
+        } else if (attrs.size() > 1) {
             sf = new SimpleFilter(null, filters, SimpleFilter.AND);
-        }
-        else if (filters.isEmpty())
-        {
+        } else if (filters.isEmpty()) {
             sf = new SimpleFilter(null, null, SimpleFilter.MATCH_ALL);
         }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
index 2f4a1f3..e83268a 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/resolver/Slf4jResolverLog.java
@@ -32,18 +32,18 @@ public class Slf4jResolverLog extends org.apache.felix.resolver.Logger {
     @Override
     protected void doLog(int level, String msg, Throwable throwable) {
         switch (level) {
-            case LOG_ERROR:
-                logger.error(msg, throwable);
-                break;
-            case LOG_WARNING:
-                logger.warn(msg, throwable);
-                break;
-            case LOG_INFO:
-                logger.info(msg, throwable);
-                break;
-            case LOG_DEBUG:
-                logger.debug(msg, throwable);
-                break;
+        case LOG_ERROR:
+            logger.error(msg, throwable);
+            break;
+        case LOG_WARNING:
+            logger.warn(msg, throwable);
+            break;
+        case LOG_INFO:
+            logger.info(msg, throwable);
+            break;
+        default:
+            logger.debug(msg, throwable);
+            break;
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java
index 44e9a7c..d76acd8 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/Artifact.java
@@ -27,7 +27,7 @@ public class Artifact {
     String version;
     String extension;
     String classifier;
-    
+
     public Artifact(String coords) {
         String[] coordsAr = coords.split(":");
         if (coordsAr.length != 5) {
@@ -39,12 +39,12 @@ public class Artifact {
         this.extension = coordsAr[2];
         this.classifier = coordsAr[3];
     }
-    
+
     public Artifact(String coords, String version) {
         this(coords);
         this.version = version;
     }
-    
+
     public URI getMavenUrl(String version) {
         String uriSt = "mvn:" + this.groupId + "/" + this.artifactId + "/" + version + "/" + this.extension + "/" + this.classifier;
         try {

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
index 93827bf..81e6a3a 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/BootFeaturesInstaller.java
@@ -24,7 +24,6 @@ import java.util.HashSet;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Set;
-import java.util.TreeSet;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -37,9 +36,9 @@ import org.slf4j.LoggerFactory;
 
 public class BootFeaturesInstaller {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(BootFeaturesInstaller.class);
+    public static final String VERSION_PREFIX = "version=";
 
-    public static String VERSION_PREFIX = "version=";
+    private static final Logger LOGGER = LoggerFactory.getLogger(BootFeaturesInstaller.class);
 
     private final FeaturesServiceImpl featuresService;
     private final BundleContext bundleContext;
@@ -48,7 +47,6 @@ public class BootFeaturesInstaller {
     private final boolean asynchronous;
 
     /**
-     *
      * @param features list of boot features separated by comma. Optionally contains ;version=x.x.x to specify a specific feature version
      */
     public BootFeaturesInstaller(BundleContext bundleContext,
@@ -118,7 +116,6 @@ public class BootFeaturesInstaller {
     }
 
     /**
-     *
      * @param featureSt either feature name or <featurename>;version=<version>
      * @return feature matching the feature string
      * @throws Exception
@@ -163,7 +160,8 @@ public class BootFeaturesInstaller {
 
     private void publishBootFinished() {
         if (bundleContext != null) {
-            BootFinished bootFinished = new BootFinished() {};
+            BootFinished bootFinished = new BootFinished() {
+            };
             bundleContext.registerService(BootFinished.class, bootFinished, new Hashtable<String, String>());
         }
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/b6c5a173/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java
----------------------------------------------------------------------
diff --git a/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java b/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java
index d6bd3e1..0d1060c 100644
--- a/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java
+++ b/features/core/src/main/java/org/apache/karaf/features/internal/service/BundleComparator.java
@@ -18,10 +18,8 @@ package org.apache.karaf.features.internal.service;
 
 import java.util.Comparator;
 
-import org.apache.felix.resolver.Util;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Version;
-import org.osgi.resource.Resource;
 
 public class BundleComparator implements Comparator<Bundle> {