()
| 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; |
no outgoing calls
no test coverage detected