Class VersionFinder
java.lang.Object
nonapi.io.github.classgraph.utils.VersionFinder
Finds the version number of ClassGraph, and the version of the JDK.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The operating system type. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final boolean
Java is EA release -- true for "11-ea", etc.static final int
Java major version -- 7 for "1.7", 8 for "1.8.0_244", 9 for "9", 11 for "11-ea", etc.static final int
Java minor version -- 0 for "11.0.4"static final int
Java minor version -- 4 for "11.0.4"static final String
Java version string.private static final String
The Maven artifact for ClassGraph.private static final String
The Maven package for ClassGraph.static final VersionFinder.OperatingSystem
The operating system type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getProperty
(String propName) Get a system property (returning null if a SecurityException was thrown).static String
getProperty
(String propName, String defaultVal) Get a system property (returning null if a SecurityException was thrown).private static DocumentBuilderFactory
Helper method to provide a XXE secured DocumentBuilder Factory.private static XPathFactory
Helper method to provide a XXE secured XPathFactory Factory.static String
Get the version number of ClassGraph.
-
Field Details
-
MAVEN_PACKAGE
The Maven package for ClassGraph.- See Also:
-
MAVEN_ARTIFACT
The Maven artifact for ClassGraph.- See Also:
-
OS
The operating system type. -
JAVA_VERSION
Java version string. -
JAVA_MAJOR_VERSION
public static final int JAVA_MAJOR_VERSIONJava major version -- 7 for "1.7", 8 for "1.8.0_244", 9 for "9", 11 for "11-ea", etc. -
JAVA_MINOR_VERSION
public static final int JAVA_MINOR_VERSIONJava minor version -- 0 for "11.0.4" -
JAVA_SUB_VERSION
public static final int JAVA_SUB_VERSIONJava minor version -- 4 for "11.0.4" -
JAVA_IS_EA_VERSION
public static final boolean JAVA_IS_EA_VERSIONJava is EA release -- true for "11-ea", etc.
-
-
Constructor Details
-
VersionFinder
private VersionFinder()Constructor.
-
-
Method Details
-
getProperty
Get a system property (returning null if a SecurityException was thrown).- Parameters:
propName
- the property name- Returns:
- the property value
-
getProperty
Get a system property (returning null if a SecurityException was thrown).- Parameters:
propName
- the property namedefaultVal
- the default value for the property- Returns:
- the property value, or the default if the property is not defined.
-
getVersion
Get the version number of ClassGraph.- Returns:
- the version number of ClassGraph.
-
getSecureDocumentBuilderFactory
private static DocumentBuilderFactory getSecureDocumentBuilderFactory() throws ParserConfigurationExceptionHelper method to provide a XXE secured DocumentBuilder Factory. reference - https://gist.github.com/AlainODea/1779a7c6a26a5c135280bc9b3b71868f reference - https://rules.sonarsource.com/java/tag/owasp/RSPEC-2755- Returns:
- DocumentBuilderFactory
- Throws:
ParserConfigurationException
-
getSecureXPathFactory
Helper method to provide a XXE secured XPathFactory Factory. reference - https://rules.sonarsource.com/java/tag/owasp/RSPEC-2755- Returns:
- XPathFactory
- Throws:
XPathFactoryConfigurationException
-