Class DependencyVersionUtil
java.lang.Object
org.owasp.dependencycheck.utils.DependencyVersionUtil
A utility class to extract version numbers from file names (or other strings containing version numbers.
- Author:
- Jeremy Long
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringparsePreVersion(String text) A utility class to extract the part before version numbers from file names (or other strings containing version numbers.static DependencyVersionparseVersion(String text) A utility class to extract version numbers from file names (or other strings containing version numbers.static DependencyVersionparseVersion(String text, boolean firstMatchOnly) A utility class to extract version numbers from file names (or other strings containing version numbers.
-
Method Details
-
parseVersion
A utility class to extract version numbers from file names (or other strings containing version numbers.
Example: Give the file name: library-name-1.4.1r2-release.jar This function would return: 1.4.1.r2
- Parameters:
text- the text being analyzed- Returns:
- a DependencyVersion containing the version
-
parseVersion
A utility class to extract version numbers from file names (or other strings containing version numbers.
Example: Give the file name: library-name-1.4.1r2-release.jar This function would return: 1.4.1.r2
- Parameters:
text- the text being analyzedfirstMatchOnly- iffalseand more then one version string is found in the given text, null will be returned. Otherwise, the first version found will be returned.- Returns:
- a DependencyVersion containing the version
-
parsePreVersion
A utility class to extract the part before version numbers from file names (or other strings containing version numbers. In most cases, this part represents a more accurate name than the full file name.
Example: Give the file name: library-name-1.4.1r2-release.jar This function would return: library-name
- Parameters:
text- the text being analyzed- Returns:
- the part before the version numbers if any, otherwise return the text itself.
-