Can now read a MANIFEST from the file system. e.g. from an exploded share.war

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42833 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gethin James
2012-10-19 08:53:58 +00:00
parent 249b2cfe57
commit dfd8344895
2 changed files with 9 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ public class WarHelperImpl implements WarHelper
{
public static final String VERSION_PROPERTIES = "/WEB-INF/classes/alfresco/version.properties";
public static final String MANIFEST_FILE = "/META-INF/MANIFEST.MF";
//see http://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Main%20Attributes
public static final String MANIFEST_SPECIFICATION_TITLE = "Specification-Title";
@@ -110,8 +111,8 @@ public class WarHelperImpl implements WarHelper
protected String findManifestArtibute(TFile war, String attributeName) throws ModuleManagementToolException {
try
{
JarFile warAsJar = new JarFile(war);
Manifest manifest = warAsJar.getManifest();
InputStream is = new TFileInputStream(war+MANIFEST_FILE);
Manifest manifest = new Manifest(is);
Attributes attribs = manifest.getMainAttributes();
return attribs.getValue(attributeName);
}