Class UnparsableObjectException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.text.ParseException
org.apache.sis.io.wkt.UnparsableObjectException
All Implemented Interfaces:
Serializable, LocalizedException

public class UnparsableObjectException extends ParseException implements LocalizedException
Thrown when a Well Known Text (WKT) cannot be parsed.

Localization

This exception may contain the error message in two languages:
  • getMessage() returns the message in the default locale. In a client-server architecture, this is typically the locale on the server side.
  • getLocalizedMessage() returns the message in the locale given in argument to the WKTFormat constructor. In a client-server architecture, it is presumably the locale on the client side.
Since:
0.8
Version:
0.8
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • key

      private transient short key
      The resources key as one of the Errors.Keys constant, or 0 if none.

      This field is not serialized because key values sometimes change between different SIS versions. The deserialized value will be 0, which will cause this UnparsableObjectException to fallback on super.getMessage().

    • parameters

      private transient Object[] parameters
      The parameters for the localization message.
  • Constructor Details

    • UnparsableObjectException

      public UnparsableObjectException(String message, int errorOffset)
      Creates an exception with the specified details message.
      Parameters:
      message - the detail message in the default locale.
      errorOffset - the position where the error is found while parsing.
    • UnparsableObjectException

      UnparsableObjectException(Locale locale, short key, Object[] parameters, int errorOffset)
      Creates an exception with a message formatted from the given resource key and message parameters.
      Parameters:
      locale - the locale for getLocalizedMessage(), or null for the default.
      key - the resource key as one of the Errors.Keys constant.
      parameters - the values to be given to IndexedResourceBundle.getString(short, Object).
      errorOffset - the position where the error is found while parsing.
  • Method Details

    • getMessage

      public String getMessage()
      Returns the exception message in the default locale, typically for system administrator.
      Specified by:
      getMessage in interface LocalizedException
      Overrides:
      getMessage in class Throwable
      Returns:
      the message of this exception.
    • getLocalizedMessage

      public String getLocalizedMessage()
      Returns a localized version of the exception message, typically for final user. This is often the same message than the one returned by getMessage(), but may in some occasions be in a different language if WKTFormat has been constructed with a different locale.
      Specified by:
      getLocalizedMessage in interface LocalizedException
      Overrides:
      getLocalizedMessage in class Throwable
      Returns:
      the localized message of this exception.
    • getInternationalMessage

      public org.opengis.util.InternationalString getInternationalMessage()
      If this exception is capable to return the message in various locales, returns that message. Otherwise returns null.
      Specified by:
      getInternationalMessage in interface LocalizedException
      Returns:
      the exception message, or null if this exception cannot produce international message.
    • initCause

      public UnparsableObjectException initCause(Throwable cause)
      Initializes the cause of this throwable to the specified value.
      Overrides:
      initCause in class Throwable
      Parameters:
      cause - the cause saved for later retrieval by the Throwable.getCause() method.
      Returns:
      a reference to this UnparsableObjectException instance.