File tree Expand file tree Collapse file tree
de.tototec.osgi.setupbuilder/src/main/scala/de/tototec/osgi/setupbuilder Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package de .tototec .osgi .setupbuilder
22
3+ import java .io .BufferedInputStream
34import java .io .File
4- import java .util .jar .Manifest
5- import java .util .jar .JarFile
6- import java .util .jar .Attributes
75import java .io .FileInputStream
8- import java .io .BufferedInputStream
6+ import java .util .jar .Attributes
7+ import java .util .jar .JarException
98import java .util .jar .JarInputStream
9+ import java .util .jar .Manifest
1010
1111/**
1212 * Configuration for an OSGi setup.
@@ -45,10 +45,11 @@ class Bundle(val file: File) {
4545 val manifest : Manifest = {
4646 val stream = new JarInputStream (new BufferedInputStream (new FileInputStream (file)))
4747 try {
48- stream.getManifest()
49- } finally {
50- stream.close()
51- }
48+ stream.getManifest() match {
49+ case null => throw new JarException (s """ The supposed bundle file " ${file}" does not contain a manifest (META-INF/MANIFEST.MF). """ )
50+ case m => m
51+ }
52+ } finally stream.close()
5253 }
5354
5455 implicit class RichAttributes (attributes : Attributes ) {
You can’t perform that action at this time.
0 commit comments