@Test public void testMicroVersionParsing() { final Version version = ManifestUtils.parseImplementationVersionValue("5.13.1"); assertEquals(5, version.getMajor()); assertEquals(13, version.getMinor()); assertEquals(1, version.getMicro()); }
public static Version parseImplementationVersionValue(String rawVersion) { final StringTokenizer st = new StringTokenizer(rawVersion, ".", false); final int[] versions = new int[3]; String qualifier = null; final Pattern qualifierPattern = Pattern.compile("^(\\d+)(_|-)(.+)$"); for (int x = 0; x < versions.length; x++) { if (st.hasMoreTokens()) { final String token = st.nextToken(); final Matcher matcher = qualifierPattern.matcher(token); if (matcher.matches()) { versions[x] = Integer.parseInt(matcher.group(1)); qualifier = matcher.group(3); break; } try { versions[x] = Integer.parseInt(token); } catch (NumberFormatException e) { qualifier = token; break; } } } return new Version(versions[0], versions[1], versions[2], qualifier); }
ManifestUtils { public static Version parseImplementationVersionValue(String rawVersion) { final StringTokenizer st = new StringTokenizer(rawVersion, ".", false); final int[] versions = new int[3]; String qualifier = null; final Pattern qualifierPattern = Pattern.compile("^(\\d+)(_|-)(.+)$"); for (int x = 0; x < versions.length; x++) { if (st.hasMoreTokens()) { final String token = st.nextToken(); final Matcher matcher = qualifierPattern.matcher(token); if (matcher.matches()) { versions[x] = Integer.parseInt(matcher.group(1)); qualifier = matcher.group(3); break; } try { versions[x] = Integer.parseInt(token); } catch (NumberFormatException e) { qualifier = token; break; } } } return new Version(versions[0], versions[1], versions[2], qualifier); } }
ManifestUtils { public static Version parseImplementationVersionValue(String rawVersion) { final StringTokenizer st = new StringTokenizer(rawVersion, ".", false); final int[] versions = new int[3]; String qualifier = null; final Pattern qualifierPattern = Pattern.compile("^(\\d+)(_|-)(.+)$"); for (int x = 0; x < versions.length; x++) { if (st.hasMoreTokens()) { final String token = st.nextToken(); final Matcher matcher = qualifierPattern.matcher(token); if (matcher.matches()) { versions[x] = Integer.parseInt(matcher.group(1)); qualifier = matcher.group(3); break; } try { versions[x] = Integer.parseInt(token); } catch (NumberFormatException e) { qualifier = token; break; } } } return new Version(versions[0], versions[1], versions[2], qualifier); }  }
ManifestUtils { public static Version parseImplementationVersionValue(String rawVersion) { final StringTokenizer st = new StringTokenizer(rawVersion, ".", false); final int[] versions = new int[3]; String qualifier = null; final Pattern qualifierPattern = Pattern.compile("^(\\d+)(_|-)(.+)$"); for (int x = 0; x < versions.length; x++) { if (st.hasMoreTokens()) { final String token = st.nextToken(); final Matcher matcher = qualifierPattern.matcher(token); if (matcher.matches()) { versions[x] = Integer.parseInt(matcher.group(1)); qualifier = matcher.group(3); break; } try { versions[x] = Integer.parseInt(token); } catch (NumberFormatException e) { qualifier = token; break; } } } return new Version(versions[0], versions[1], versions[2], qualifier); }  static String getImplementationTitle(final JarFile jarFile); static String getImplementationVersion(final JarFile jarFile); static Version parseImplementationVersionValue(String rawVersion); static List<Attributes> getAllJarAttributes(JarFile jarFile); }
ManifestUtils { public static Version parseImplementationVersionValue(String rawVersion) { final StringTokenizer st = new StringTokenizer(rawVersion, ".", false); final int[] versions = new int[3]; String qualifier = null; final Pattern qualifierPattern = Pattern.compile("^(\\d+)(_|-)(.+)$"); for (int x = 0; x < versions.length; x++) { if (st.hasMoreTokens()) { final String token = st.nextToken(); final Matcher matcher = qualifierPattern.matcher(token); if (matcher.matches()) { versions[x] = Integer.parseInt(matcher.group(1)); qualifier = matcher.group(3); break; } try { versions[x] = Integer.parseInt(token); } catch (NumberFormatException e) { qualifier = token; break; } } } return new Version(versions[0], versions[1], versions[2], qualifier); }  static String getImplementationTitle(final JarFile jarFile); static String getImplementationVersion(final JarFile jarFile); static Version parseImplementationVersionValue(String rawVersion); static List<Attributes> getAllJarAttributes(JarFile jarFile);  }