Module org.jnetpcap

Class PcapVersionException

All Implemented Interfaces:
Serializable

public final class PcapVersionException extends PcapException
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.

For detailed specification please see http://semver.org
Author:
Sly Technologies, repos@slytechs.com
See Also:
  • Method Details

    • compareVersions

      public static boolean compareVersions(String v1, String v2)
      Compare 2 versions. If v1 is less than v2 then versions are incompatible and false is returned. Only the major.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 version
      v2 - the application version
      Returns:
      true, if runtime version is compatible with application version, otherwise false when incompatible
    • compareVersions

      public static boolean compareVersions(String v1, String v2, int limit)
      Compare 2 versions. If v1 is less than v2 then versions are incompatible and false is returned. Only the major.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. For major 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 version
      v2 - the application version
      limit - 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

      public static boolean equals(String v1, String v2)
      Equals.
      Parameters:
      v1 - the v 1
      v2 - the v 2
      Returns:
      true, if successful
    • throwIfVersionMismatch

      public static void throwIfVersionMismatch(String runtimeVersion, String applicationVersion) throws PcapVersionException
      Throw if version mismatch.
      Parameters:
      runtimeVersion - the runtime version
      applicationVersion - 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 version
      applicationVersion - the application version
      limit - the limit
      Throws:
      PcapVersionException - the pcap version exception