MCPcopy Create free account
hub / github.com/TrsstProject/trsst / getManifestAttributes

Method getManifestAttributes

src/main/java/com/trsst/Common.java:708–730  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

706 }
707
708 public static Attributes getManifestAttributes() {
709 Attributes result = null;
710 Class<Common> clazz = Common.class;
711 String className = clazz.getSimpleName() + ".class";
712 URL classPath = clazz.getResource(className);
713 if (classPath == null || !classPath.toString().startsWith("jar")) {
714 // Class not from JAR
715 return null;
716 }
717 String classPathString = classPath.toString();
718 String manifestPath = classPathString.substring(0,
719 classPathString.lastIndexOf("!") + 1)
720 + "/META-INF/MANIFEST.MF";
721 try {
722 Manifest manifest = new Manifest(new URL(manifestPath).openStream());
723 result = manifest.getMainAttributes();
724 } catch (MalformedURLException e) {
725 log.error("Could not locate manifest: " + manifestPath);
726 } catch (IOException e) {
727 log.error("Could not open manifest: " + manifestPath);
728 }
729 return result;
730 }
731
732 public static Date getBuildDate() {
733 Date result = null;

Callers 3

getBuildDateMethod · 0.95
getBuildIdMethod · 0.95
getBuildStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected