class ManifestUtils {
public static Manifest getManifest(Archive<?> archive, boolean create) {
Manifest manifest = null;
try {
Node node = archive.get(JarFile.MANIFEST_NAME);
if (node == null) {
manifest = new Manifest();
Attributes attributes = manifest.getMainAttributes();
attributes.putValue(Attributes.Name.MANIFEST_VERSION.toString(), "1.0");
} else if (create) {
manifest = new Manifest(node.getAsset().openStream());
}
return manifest;
} catch (Exception ex) {
throw new IllegalStateException("Cannot obtain manifest", ex);
}