public class DataStoreException extends Exception implements LocalizedException
DataStore can not complete a read or write operation.
getMessage() and getLocalizedMessage() methods return the same message,
but sometime in different languages. The general policy is that getMessage() returns
the message in the JVM default locale while getLocalizedMessage()
returns the message in the locale specified by the last call to DataStore.setLocale(Locale).
In a client-server architecture, the former is typically the locale of the system administrator
while the later is presumably the locale of the client connected to the server.
However this policy is applied on a best-effort basis only.Defined in the sis-storage module
| Constructor and Description |
|---|
DataStoreException()
Creates an exception with no cause and no details message.
|
DataStoreException(Locale locale,
String format,
String filename,
Object store)
Creates a localized exception with a message saying that the given store can not be processed.
|
DataStoreException(String message)
Creates an exception with the specified details message.
|
DataStoreException(String message,
Throwable cause)
Creates an exception with the specified details message and cause.
|
DataStoreException(Throwable cause)
Creates an exception with the specified cause and no details message.
|
| Modifier and Type | Method and Description |
|---|---|
InternationalString |
getInternationalMessage()
If this exception is capable to return the message in various locales, returns that message.
|
String |
getLocalizedMessage()
Returns a localized version of the exception message, typically for final user.
|
String |
getMessage()
Returns the exception message in the default locale, typically for system administrator.
|
DataStoreException |
initCause(Throwable cause)
Initializes the cause of this throwable to the specified value.
|
addSuppressed, fillInStackTrace, getCause, getStackTrace, getSuppressed, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic DataStoreException()
public DataStoreException(String message)
message - the detail message in the default locale.public DataStoreException(Throwable cause)
cause - the cause for this exception.public DataStoreException(String message, Throwable cause)
message - the detail message in the default locale.cause - the cause for this exception.public DataStoreException(Locale locale, String format, String filename, Object store)
store
argument if possible, for example by invoking the LineNumberReader.getLineNumber()
or XMLStreamReader.getLocation() method.
If the given store argument is not one of the recognized types, then it is ignored.locale - the locale of the message to be returned by getLocalizedMessage(), or null.format - short name or abbreviation of the data format (e.g. "CSV", "GML", "WKT", etc).filename - name of the file or data store where the error occurred.store - the input or output object from which to get the current position, or null if none.
This can be a LineNumberReader or XMLStreamReader
for example.public String getMessage()
getMessage in interface LocalizedExceptiongetMessage in class Throwablepublic String getLocalizedMessage()
getMessage(),
but may in some occasions be different if DataStore.setLocale(Locale)
has been invoked with a different locale.
getMessage() versus getLocalizedMessage()getMessage() and getLocalizedMessage() are not equivalent, the Apache SIS policy
is that getMessage() returns the message in the default locale
while getLocalizedMessage() returns the message in a locale that depends on the context in which
the exception has been thrown.
In a client-server architecture, the former is often the locale on the server side while the later
is the locale on the client side if that information has been provided to the DataStore.getLocalizedMessage in interface LocalizedExceptiongetLocalizedMessage in class ThrowableDataStore.setLocale(Locale)public InternationalString getInternationalMessage()
null.getInternationalMessage in interface LocalizedExceptionnull if this exception can not produce international message.public DataStoreException initCause(Throwable cause)
initCause in class Throwablecause - the cause saved for later retrieval by the Throwable.getCause() method.DataStoreException instance.Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.