Package ghidra.program.model.lang

# Class LanguageVersionException

java.lang.Object
java.lang.Throwable
java.lang.Exception
ghidra.util.exception.UsrException
ghidra.util.exception.VersionException
ghidra.program.model.lang.LanguageVersionException

All Implemented Interfaces:
  `Serializable`

public class LanguageVersionException extends VersionException

See Also:
  - Serialized Form

- ## Field Summary

  ### Fields inherited from class ghidra.util.exception.VersionException

  `NEWER_VERSION, OLDER_VERSION, UNKNOWN_VERSION`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `LanguageVersionException(Language oldLanguage, LanguageTranslator languageTranslator)`
  Construct a major upgradeable language version exception
  `LanguageVersionException(String msg, boolean upgradable)`
  Construct a language version exception

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static LanguageVersionException`
  `check(Language language, int languageVersion, int languageMinorVersion)`
  Check language against required version information.
  `static LanguageVersionException`
  `checkForLanguageChange(LanguageNotFoundException e, LanguageID languageID, int languageVersion)`
  Determine if a missing language resulting in a `LanguageNotFoundException` can be upgraded to a replacement language via a language translation.
  `LanguageTranslator`
  `getLanguageTranslator()`
  Old language upgrade translator if language translation required
  `Language`
  `getOldLanguage()`
  Old language stub if language translation required

  ### Methods inherited from class ghidra.util.exception.VersionException

  `combine, getDetailMessage, getVersionIndicator, isUpgradable, setDetailMessage`

  ### Methods inherited from class java.lang.Throwable

  `addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### LanguageVersionException

    public LanguageVersionException(String msg, boolean upgradable)
    Construct a language version exception
    Parameters:
      `msg` - condition detail
      `upgradable` - true indicates that an upgrade is possible.

  - ### LanguageVersionException

    public LanguageVersionException(Language oldLanguage, LanguageTranslator languageTranslator)
    Construct a major upgradeable language version exception
    Parameters:
      `oldLanguage` - old language stub
      `languageTranslator` - language transalator

- ## Method Details

  - ### getOldLanguage

    public Language getOldLanguage()
    Old language stub if language translation required
    Returns:
      Old language stub or null

  - ### getLanguageTranslator

    public LanguageTranslator getLanguageTranslator()
    Old language upgrade translator if language translation required
    Returns:
      language upgrade translator or null

  - ### check

    public static LanguageVersionException check(Language language, int languageVersion, int languageMinorVersion) throws LanguageNotFoundException
    Check language against required version information. If not a match or upgradeable a `LanguageNotFoundException` will be thrown. If an upgradeable `LanguageVersionException` is returned, a major version change will also include the appropriate Old-Language stub and `LanguageTranslator` required to facilitate a language upgrade.
    Parameters:
      `language` - language corresponding to desired language ID
      `languageVersion` - required major language version
      `languageMinorVersion` - required minor language version. A negative minor version will be ignored.
    Returns:
      null if language matches, otherwise an upgradeable `LanguageVersionException`.
    Throws:
      `LanguageNotFoundException` - if language is a mismatch and is not upgradeable.

  - ### checkForLanguageChange

    public static LanguageVersionException checkForLanguageChange(LanguageNotFoundException e, LanguageID languageID, int languageVersion) throws LanguageNotFoundException
    Determine if a missing language resulting in a `LanguageNotFoundException` can be upgraded to a replacement language via a language translation.
    Parameters:
      `e` - original `LanguageNotFoundException`
      `languageID` - language ID of original language requested
      `languageVersion` - original language major version
    Returns:
      upgradeable `LanguageVersionException`
    Throws:
      `LanguageNotFoundException` - original exception if a language transaltion is not available