@Test public void getVersionStreamNoVersion() { InputStream is = IOUtils.toInputStream("Implementation-Versionz: build57\n", StandardCharsets.UTF_8); assertNull(Version.valueFromStream(is, "Implementation-Version")); }
static String valueFromStream(InputStream resourceAsStream, String attributeName) { String version = null; if (resourceAsStream != null) { try { Manifest manifest = new Manifest(resourceAsStream); Attributes attributes = manifest.getMainAttributes(); version = attributes.getValue(attributeName); } catch (IOException e) { } } return version; }
Version { static String valueFromStream(InputStream resourceAsStream, String attributeName) { String version = null; if (resourceAsStream != null) { try { Manifest manifest = new Manifest(resourceAsStream); Attributes attributes = manifest.getMainAttributes(); version = attributes.getValue(attributeName); } catch (IOException e) { } } return version; } }
Version { static String valueFromStream(InputStream resourceAsStream, String attributeName) { String version = null; if (resourceAsStream != null) { try { Manifest manifest = new Manifest(resourceAsStream); Attributes attributes = manifest.getMainAttributes(); version = attributes.getValue(attributeName); } catch (IOException e) { } } return version; }  }
Version { static String valueFromStream(InputStream resourceAsStream, String attributeName) { String version = null; if (resourceAsStream != null) { try { Manifest manifest = new Manifest(resourceAsStream); Attributes attributes = manifest.getMainAttributes(); version = attributes.getValue(attributeName); } catch (IOException e) { } } return version; }  static String getVersion(); static String getVersionInfo(Class mainClass); }
Version { static String valueFromStream(InputStream resourceAsStream, String attributeName) { String version = null; if (resourceAsStream != null) { try { Manifest manifest = new Manifest(resourceAsStream); Attributes attributes = manifest.getMainAttributes(); version = attributes.getValue(attributeName); } catch (IOException e) { } } return version; }  static String getVersion(); static String getVersionInfo(Class mainClass);  }