Cleans up the version to be OSGi compliant.

@param version a Maven version
@return the OSGi version computed from the given Maven version.
171919
public static String cleanupVersion(String version) {
        StringBuilder result = new StringBuilder();
        Matcher m = FUZZY_VERSION.matcher(version);
        if (m.matches()) {
            String major = m.group(1);
            String minor = m.group(3);
            String micro = m.group(5);
            String qualifier = m.group(7);

            if (major != null) {
                result.append(major);
                if (minor != null) {
                    result.append(".");
                    result.append(minor);
                    if (micro != null) {
                        result.append(".");
                        result.append(micro);
                        if (qualifier != null) {
                            result.append(".");
                            cleanupModifier(result, qualifier);
                        }
                    } else if (qualifier != null) {
                        result.append(".0.");
                        cleanupModifier(result, qualifier);
                    } else {
                        result.append(".0");
                    }
                } else if (qualifier != null) {
                    result.append(".0.0.");
                    cleanupModifier(result, qualifier);
                } else {
                    result.append(".0.0");
                }
            }
        } else {
            result.append("0.0.0.");
            cleanupModifier(result, version);
        }
        return result.toString();
    }
311329
public Versioned<E> getVersionedById(int id) {
        Versioned<VListNode<E>> listNode = getListNode(id);
        if(listNode == null)
            throw new IndexOutOfBoundsException();
        return new Versioned<E>(listNode.getValue().getValue(), listNode.getVersion());
    }
1193701
public String featureVersion(final String featureName) {
        String version = toString();
        if (featureName != null) {
            version = getReleaseVersionString() + "-" + featureName
                    + (isSnapshot() ? "-" + Artifact.SNAPSHOT_VERSION : "");
        }
        return version;
    }
319536
public static String jarVersion(JarFile jar) throws IOException {
		String version = jar.getManifest().getMainAttributes().getValue(Attributes.Name.IMPLEMENTATION_VERSION);
		
		if(version == null) {
			version = String.format("%d", System.currentTimeMillis());
		}
		return version;
	}
57981
protected static function cleanExtraVersion($version)
    {
        $pos = strpos($version, '-');

        if (false !== $pos) {
            $version = substr($version, 0, $pos);
        }

        return $version;
    }
112280
public boolean isLessOrEqual(String version) {
        JenkinsVersion create = create(version);
        return this.cv.compareTo(create.cv) <= 0;
    }
37317
public static int getVersion(String version) {

        int ver = Integer.parseInt(version);
        return Math.abs(ver);
    }
225276
public boolean isModifiedOnVersion(String version) {
		if( this.modificationHistory.isModifiedOnVersion(version)
				|| this.outParameter.isModifiedOnVersion(version) ) {
			return true;
		}
		for(APIParameter inParameter : inParameters) {
			if(inParameter.isModifiedOnVersion(version)) {
				return true;
			}
		}
		return false;
	}
768529
@Override
    public WebAppDescriptor version(final String version) {
        if (version == null || version.length() == 0) {
            throw new IllegalArgumentException("Version must be specified");
        }
        model.attribute("xsi:schemaLocation",
            "http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_" + version.replace(".", "_")
                + ".xsd");
        model.attribute("version", version);
        return this;
    }
485169
public static Artifact withVersion(Version v)
    {
        Artifact artifact = new Artifact();
        artifact.version = v;
        return artifact;
    }
1057354
public static String getVersion() {
        String version = null;

        // try to load from maven properties first
        try {
            Properties p = new Properties();
            InputStream is = VersionHelper.class.getResourceAsStream("/META-INF/maven/io.redlink/redlink-sdk-java/pom.properties");
            if (is != null) {
                p.load(is);
                version = p.getProperty("version", "");
            }
        } catch (Exception e) {
            // ignore
        }

        // fallback to using Java API
        if (version == null) {
            Package aPackage = VersionHelper.class.getPackage();
            if (aPackage != null) {
                version = aPackage.getImplementationVersion();
                if (version == null) {
                    version = aPackage.getSpecificationVersion();
                }
            }
        }

        // fallback to read pom.xml on testing
        if (version == null) {
            final MavenXpp3Reader reader = new MavenXpp3Reader();
            try {
                Model model = reader.read(new FileReader(new File("pom.xml")));
                version = model.getVersion();
            } catch (IOException | XmlPullParserException e) {
                // ignore
            }
        }

        return version;
    }
804037
public MessageProtocol withVersion(String version) {
        return new MessageProtocol(contentType, charset, Optional.ofNullable(version));
    }
296116
public synchronized @Nonnull String version() throws IOException {
    if (this.version == null) {
      Process p = runFunc.run(ImmutableList.of(path, "-version"));
      try {
        BufferedReader r = wrapInReader(p);
        this.version = r.readLine();
        CharStreams.copy(r, CharStreams.nullWriter()); // Throw away rest of the output

        throwOnError(p);
      } finally {
        p.destroy();
      }
    }
    return version;
  }
927391
public static VersionNumber parseVersion(@Nonnull final String version) {
		return VersionParser.parseVersion(Check.notNull(version, "version"));
	}
842575
protected static String formatApiVersion(String version) {
        if (StringUtils.isBlank(version)) {
            return VERSION;
        } else {
            final Matcher matcher = VERSION_PATTERN.matcher(version);
            if (matcher.matches()) {
                return String.format("%s.%s", matcher.group(1), matcher.group(2));
            } else {
                return VERSION;
            }
        }
    }
227409
String processVersion(String version) {
    if (version == null || version.trim().isEmpty() || version.equals(APPENGINE_CONFIG)) {
      throw new IllegalArgumentException(VERSION_ERROR);
    } else if (version.equals(GCLOUD_CONFIG)) {
      return null;
    }
    return version;
  }
422240
public static Version toVersion(String version, final Version defaultValue) {
	// remove extension if there is any
	final int rIndex = version.lastIndexOf(".lco");
	if (rIndex != -1) version = version.substring(0, rIndex);

	try {
	    return Version.parseVersion(version);
	}
	catch (final IllegalArgumentException iae) {
	    return defaultValue;
	}
    }