summaryrefslogtreecommitdiffstats
path: root/bundle-plugin/src
diff options
context:
space:
mode:
Diffstat (limited to 'bundle-plugin/src')
-rw-r--r--bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java b/bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java
index 2b5941cc5aa..fe3d149a308 100644
--- a/bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java
+++ b/bundle-plugin/src/main/java/com/yahoo/container/plugin/bundle/AnalyzeBundle.java
@@ -34,20 +34,26 @@ public class AnalyzeBundle {
}
static List<Export> exportedPackages(File jarFile) {
+ var manifest = getOsgiManifest(jarFile);
+ if (manifest == null) return Collections.emptyList();
try {
- Optional<Manifest> jarManifest = JarFiles.getManifest(jarFile);
- if (jarManifest.isPresent()) {
- Manifest manifest = jarManifest.get();
- if (isOsgiManifest(manifest)) {
- return parseExports(manifest);
- }
- }
- return Collections.emptyList();
+ return parseExports(manifest);
} catch (Exception e) {
throw new RuntimeException(String.format("Invalid manifest in bundle '%s'", jarFile.getPath()), e);
}
}
+ private static Manifest getOsgiManifest(File jarFile) {
+ Optional<Manifest> jarManifest = JarFiles.getManifest(jarFile);
+ if (jarManifest.isPresent()) {
+ Manifest manifest = jarManifest.get();
+ if (isOsgiManifest(manifest)) {
+ return manifest;
+ }
+ }
+ return null;
+ }
+
public static Optional<String> bundleSymbolicName(File jarFile) {
return JarFiles.getManifest(jarFile).flatMap(AnalyzeBundle::getBundleSymbolicName);
}