You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2017/08/03 10:16:20 UTC
svn commit: r1803980 -
/sling/whiteboard/cziegeler/feature-support/src/main/java/org/apache/sling/feature/support/util/ManifestParser.java
Author: cziegeler
Date: Thu Aug 3 10:16:20 2017
New Revision: 1803980
URL: http://svn.apache.org/viewvc?rev=1803980&view=rev
Log:
Add missing return for capability
Modified:
sling/whiteboard/cziegeler/feature-support/src/main/java/org/apache/sling/feature/support/util/ManifestParser.java
Modified: sling/whiteboard/cziegeler/feature-support/src/main/java/org/apache/sling/feature/support/util/ManifestParser.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/cziegeler/feature-support/src/main/java/org/apache/sling/feature/support/util/ManifestParser.java?rev=1803980&r1=1803979&r2=1803980&view=diff
==============================================================================
--- sling/whiteboard/cziegeler/feature-support/src/main/java/org/apache/sling/feature/support/util/ManifestParser.java (original)
+++ sling/whiteboard/cziegeler/feature-support/src/main/java/org/apache/sling/feature/support/util/ManifestParser.java Thu Aug 3 10:16:20 2017
@@ -16,6 +16,15 @@
*/
package org.apache.sling.feature.support.util;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.jar.Manifest;
+
import org.apache.sling.feature.Capability;
import org.apache.sling.feature.Requirement;
import org.osgi.framework.BundleException;
@@ -26,15 +35,6 @@ import org.osgi.framework.namespace.Exec
import org.osgi.framework.namespace.IdentityNamespace;
import org.osgi.framework.wiring.BundleRevision;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.jar.Manifest;
-
public class ManifestParser
{
private static final String BUNDLE_LICENSE_HEADER = "Bundle-License"; // No constant defined by OSGi...
@@ -111,7 +111,7 @@ public class ManifestParser
if (!attachment.equalsIgnoreCase(Constants.FRAGMENT_ATTACHMENT_NEVER))
{
Map<String, Object> hostAttrs =
- new HashMap<String, Object>(bundleCap.getAttributes());
+ new HashMap<>(bundleCap.getAttributes());
Object value = hostAttrs.remove(BundleRevision.BUNDLE_NAMESPACE);
hostAttrs.put(BundleRevision.HOST_NAMESPACE, value);
Capability cap = new Capability(BundleRevision.HOST_NAMESPACE);
@@ -266,7 +266,7 @@ public class ManifestParser
List<String> tokens = parseDelimitedString(
clause.m_attrs.get(entry.getKey()).toString(), ",", false);
- List<Object> values = new ArrayList<Object>(tokens.size());
+ List<Object> values = new ArrayList<>(tokens.size());
for (String token : tokens)
{
if (listType.equals("String"))
@@ -317,7 +317,7 @@ public class ManifestParser
List<ParsedHeaderClause> clauses)
throws BundleException
{
- List<Capability> capList = new ArrayList<Capability>();
+ List<Capability> capList = new ArrayList<>();
for (ParsedHeaderClause clause : clauses)
{
for (String path : clause.m_paths)
@@ -440,6 +440,8 @@ public class ManifestParser
Capability cap = new Capability(BundleRevision.BUNDLE_NAMESPACE);
cap.getAttributes().putAll(clauses.get(0).m_attrs);
cap.getAttributes().putAll(clauses.get(0).m_dirs);
+
+ return cap;
}
return null;
@@ -447,7 +449,7 @@ public class ManifestParser
private static Capability addIdentityCapability(Manifest headerMap, Capability bundleCap)
{
- Map<String, Object> attrs = new HashMap<String, Object>();
+ Map<String, Object> attrs = new HashMap<>();
attrs.put(IdentityNamespace.IDENTITY_NAMESPACE,
bundleCap.getAttributes().get(BundleNamespace.BUNDLE_NAMESPACE));
@@ -540,7 +542,7 @@ public class ManifestParser
// 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).m_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,
@@ -557,7 +559,7 @@ public class ManifestParser
// Inject filter directive.
// TODO: OSGi R4.3 - Can we insert this on demand somehow?
Map<String, String> dirs = clauses.get(0).m_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,
@@ -582,7 +584,7 @@ public class ManifestParser
private static List<Requirement> parseBreeHeader(String header)
{
- List<String> filters = new ArrayList<String>();
+ List<String> filters = new ArrayList<>();
for (String entry : parseDelimitedString(header, ","))
{
List<String> names = parseDelimitedString(entry, "/");
@@ -737,7 +739,7 @@ public class ManifestParser
// more efficient.
// 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,
@@ -754,7 +756,7 @@ public class ManifestParser
// Inject filter directive.
// TODO: OSGi R4.3 - Can we insert this on demand somehow?
Map<String, String> dirs = clause.m_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,
@@ -791,7 +793,7 @@ public class ManifestParser
@SuppressWarnings({ "unchecked", "rawtypes" })
static List<ParsedHeaderClause> parseStandardHeader(String header)
{
- List<ParsedHeaderClause> clauses = new ArrayList<ParsedHeaderClause>();
+ List<ParsedHeaderClause> clauses = new ArrayList<>();
if (header == null)
{
return clauses;
@@ -956,7 +958,7 @@ public class ManifestParser
value = "";
}
- List<String> list = new ArrayList<String>();
+ List<String> list = new ArrayList<>();
int CHAR = 1;
int DELIMITER = 2;