Interface LocalizedException

All Known Implementing Classes:
Can­Not­Probe­Exception, Concurrent­Read­Exception, Concurrent­Write­Exception, Data­Store­Closed­Exception, Data­Store­Content­Exception, Data­Store­Exception, Data­Store­Referencing­Exception, Forward­Only­Storage­Exception, Illegal­Feature­Type­Exception, Illegal­Name­Exception, Illegal­Open­Parameter­Exception, Incompatible­Resource­Exception, Internal­Data­Store­Exception, No­Such­Data­Exception, Read­Only­Storage­Exception, Resource­Already­Exists­Exception, Unparsable­Object­Exception, Unsupported­Encoding­Exception, Unsupported­Query­Exception, Unsupported­Storage­Exception

public interface LocalizedException
An exception which can produce an error message in the client locale. Exceptions implementing this interface apply the following policy:
  • get­Message() returns the message in the default locale. In a client-server architecture, this is often the locale on the server side.
  • get­Localized­Message() returns the message in a locale that depends on the context in which the exception has been thrown. This is often the locale used by a Format or Data­Store instance, and can be presumed to be the locale on the client side.
  • get­International­Message() may return the message in arbitrary locale (optional operation). This method is specific to Apache SIS.

Example

If an error occurred while a Japanese client connected to an European server, the localized message may be sent to the client in Japanese language while the same error may be logged on the server side in the French language. This allows system administrator to analyze the issue without the need to understand client's language. The above policy is applied on a best-effort basis only. For example, exceptions that do not implement Localized­Exception may use any locale (not necessarily the default one), and Localized­Exception used as wrappers around other exception usually lost their localization capability.
Since:
0.8
See Also:
  • Method Details

    • getMessage

      String getMessage()
      Returns the message in the default locale. In a client-server architecture, this is usually the locale on the server side. This is the recommended language for logging messages to be read by system administrators.
      Returns:
      the exception message in the JVM default locale.
    • getLocalizedMessage

      String getLocalizedMessage()
      Returns the message in the locale that depends on the context in which this exception has been thrown. For example, it may be the local of a client application connected to a distant server. This is the recommended language to show in widgets.
      Returns:
      the exception message in the locale of a service configured for a particular client.
    • getInternationalMessage

      InternationalString getInternationalMessage()
      If this exception is capable to return the message in various locales, returns that message. Otherwise returns null.
      Returns:
      the exception message, or null if this exception cannot produce international message.