diff options
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java')
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java index 846681b2e..e1f1352de 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/builders/OSGiManifestBuilderFactory.java @@ -957,10 +957,16 @@ public final class OSGiManifestBuilderFactory { } Collections.sort(nativeClauses); - Map<String, Object> attributes = new HashMap<String, Object>(2); int numNativePaths = nativeClauses.size(); + if (numNativePaths == 0) { + String msg = "No native code clauses found in the value of " + Constants.BUNDLE_NATIVECODE + ": " + manifest.get(Constants.BUNDLE_NATIVECODE); //$NON-NLS-1$//$NON-NLS-2$ + throw new BundleException(msg, BundleException.MANIFEST_ERROR); + } StringBuilder allNativeFilters = new StringBuilder(); - allNativeFilters.append("(|"); //$NON-NLS-1$ + if (numNativePaths > 1) { + allNativeFilters.append("(|"); //$NON-NLS-1$ + } + Map<String, Object> attributes = new HashMap<String, Object>(2); for (int i = 0; i < numNativePaths; i++) { NativeClause nativeClause = nativeClauses.get(i); if (numNativePaths == 1) { @@ -970,7 +976,9 @@ public final class OSGiManifestBuilderFactory { } allNativeFilters.append(nativeClauses.get(i).filter); } - allNativeFilters.append(')'); + if (numNativePaths > 1) { + allNativeFilters.append(')'); + } Map<String, String> directives = new HashMap<String, String>(2); directives.put(NativeNamespace.REQUIREMENT_FILTER_DIRECTIVE, allNativeFilters.toString()); |