java.lang.Object
java.lang.Throwable
java.lang.Exception
org.jnetpcap.PcapException
org.jnetpcap.util.PcapVersionException
- All Implemented Interfaces:
Serializable
Indicates that installed runtime version of jNetPcap library is incompatible
with the client application version of jNetPcap being used.
Another words, the client application was compiled with a newer version of
jNetPcap library and is incompatible with the installed version on the system
running the client application. The version components major.minor
are used to determine the compatibility of jNetPcap library runtimes. All
other components are assumed to be backward compatible, as long as
major.minor
components match.
Example:
1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.
- Author:
- Sly Technologies, repos@slytechs.com
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
compareVersions
(String v1, String v2) Compare 2 versions.static boolean
compareVersions
(String v1, String v2, int limit) Compare 2 versions.static boolean
Equals.static void
throwIfVersionMismatch
(String runtimeVersion, String applicationVersion) Throw if version mismatch.static void
throwIfVersionMismatch
(String runtimeVersion, String applicationVersion, int limit) Throw if version mismatch.Methods inherited from class org.jnetpcap.PcapException
getCode, throwIfNotOk, throwIfNotOk, throwIfNotOk
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
compareVersions
Compare 2 versions. If v1 is less than v2 then versions are incompatible and false is returned. Only themajor.minor
components are checked for compatibility. Any other components are ignored and assumed to be backward compatible with the installed runtime version.- Parameters:
v1
- the installed runtime versionv2
- the application version- Returns:
- true, if runtime version is compatible with application version, otherwise false when incompatible
-
compareVersions
Compare 2 versions. If v1 is less than v2 then versions are incompatible and false is returned. Only themajor.minor
specified by limit 2, components are checked for compatibility. Any other components are ignored and assumed to be backward compatible with the installed runtime version. Formajor
only component check, specify limit of 1.For detailed information see https://semver.org - Semantic Versioning Specification used by jNetPcap
- Parameters:
v1
- the installed runtime versionv2
- the application versionlimit
- Number of version components to check up to a maximum of 3. Use 2 for major.minor or 1 for major only. Any number greater than 3 major.minor.patch will throw a IllegalArgumentException exception due to parsing errors of components which not ment to be parsed and compared. A value of 3 major.minor.patch may provide a check against a specific bug fix.- Returns:
- true, if runtime version is compatible with application version, otherwise false when incompatible
-
equals
-
throwIfVersionMismatch
public static void throwIfVersionMismatch(String runtimeVersion, String applicationVersion) throws PcapVersionException Throw if version mismatch.- Parameters:
runtimeVersion
- the runtime versionapplicationVersion
- the application version- Throws:
PcapVersionException
- the pcap version exception
-
throwIfVersionMismatch
public static void throwIfVersionMismatch(String runtimeVersion, String applicationVersion, int limit) throws PcapVersionException Throw if version mismatch.- Parameters:
runtimeVersion
- the runtime versionapplicationVersion
- the application versionlimit
- the limit- Throws:
PcapVersionException
- the pcap version exception
-