jsedding / osgi-ds-metatype-diff

Tool to show the difference in Declarative Services and MetaType metadata of two OSGi bundles
4 stars 3 forks source link

NPE in case MANIFEST-MF does not contain a Service-Component header #14

Closed kwin closed 5 years ago

kwin commented 5 years ago

The following NPE is thrown in that case

Exception in thread "main" java.lang.NullPointerException
    at net.distilledcode.tools.osgi.DeclarativeServices.readComponentMetadata(DeclarativeServices.java:38)
    at net.distilledcode.tools.osgi.MetadataDiff$BundleMetadata.<init>(MetadataDiff.java:72)
    at net.distilledcode.tools.osgi.MetadataDiff.diff(MetadataDiff.java:36)
    at net.distilledcode.tools.osgi.MetadataDiff.main(MetadataDiff.java:32)

This is due to the missing null check of variable serviceComponents before line https://github.com/jsedding/osgi-ds-metatype-diff/blob/6d99007a4e1046c2fb771d0ae2dfa603728479af/src/main/java/net/distilledcode/tools/osgi/DeclarativeServices.java#L38.