public final class ExceptionUtil extends Object
| Modifier | Constructor and Description |
|---|---|
private |
ExceptionUtil() |
| Modifier and Type | Method and Description |
|---|---|
static String |
escapeReservedCharactersHTML(String s)
Replaces some HTML reserved characters (<, > and &) by their equivalent entity (<, > and &);
|
static String |
explainBadRequest(OsmApiException e)
Explains a
OsmApiException which was thrown because of a bad
request |
static String |
explainBandwidthLimitExceeded(OsmApiException e)
Explains a
OsmApiException which was thrown because of
bandwidth limit exceeded (HTTP error 509) |
static String |
explainChangesetClosedException(ChangesetClosedException e)
Explains an exception thrown during upload because the changeset which data is
uploaded to is already closed.
|
static String |
explainClientTimeout(OsmApiException e)
Explains an OSM API exception because of a client timeout (HTTP 408).
|
static String |
explainConflict(OsmApiException e)
Explains an error due to a 409 conflict
|
static String |
explainException(Exception e)
Explains an
Exception to the user. |
static String |
explainFailedAuthorisation(OsmApiException e) |
static String |
explainFailedBasicAuthentication(OsmApiException e) |
static String |
explainFailedOAuthAuthentication(OsmApiException e) |
static String |
explainFailedOAuthAuthorisation(OsmApiException e) |
static String |
explainGeneric(Exception e)
Explains an exception with a generic message dialog
|
static String |
explainGenericOsmApiException(OsmApiException e)
Replies a generic error message for an OSM API exception
|
static String |
explainGoneForUnknownPrimitive(OsmApiException e)
explains the case of an error due to a delete request on an already deleted
OsmPrimitive, i.e. a HTTP response code 410, where we don't know which
OsmPrimitive is causing the error. |
static String |
explainInternalServerError(OsmTransferException e)
Explains a
OsmApiException which was thrown because of an internal server
error in the OSM API server.. |
static String |
explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e)
Creates the error message
|
static String |
explainNestedIllegalDataException(OsmTransferException e)
Explains a
IllegalDataException which has caused an OsmTransferException. |
static String |
explainNestedIOException(OsmTransferException e)
Explains a
IOException which has caused an OsmTransferException. |
static String |
explainNestedSocketException(OsmTransferException e)
Explains a
SocketException which has caused an OsmTransferException. |
static String |
explainNestedUnknownHostException(OsmTransferException e)
Explains a
UnknownHostException which has caused an OsmTransferException. |
static String |
explainNotFound(OsmApiException e)
Explains a
OsmApiException which was thrown because a resource wasn't found. |
static String |
explainOsmApiInitializationException(OsmApiInitializationException e)
handles an exception caught during OSM API initialization
|
static String |
explainOsmTransferException(OsmTransferException e)
Explains an
OsmTransferException to the user. |
static String |
explainPreconditionFailed(OsmApiException e)
Explains an upload error due to a violated precondition, i.e. a HTTP return code 412
|
static String |
explainSecurityException(OsmTransferException e)
Explains a
SecurityException which has caused an OsmTransferException. |
protected static <T> T |
getNestedException(Exception e,
Class<T> nestedClass)
Replies the first nested exception of type
nestedClass (including
the root exception e) or null, if no such exception is found. |
static Pair<OsmPrimitive,Collection<OsmPrimitive>> |
parsePreconditionFailed(String msg) |
private ExceptionUtil()
public static String explainOsmApiInitializationException(OsmApiInitializationException e)
e - the exceptionpublic static String explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e)
e - the exceptionpublic static Pair<OsmPrimitive,Collection<OsmPrimitive>> parsePreconditionFailed(String msg)
public static String explainPreconditionFailed(OsmApiException e)
e - the exceptionpublic static String explainFailedBasicAuthentication(OsmApiException e)
public static String explainFailedOAuthAuthentication(OsmApiException e)
public static String explainFailedAuthorisation(OsmApiException e)
public static String explainFailedOAuthAuthorisation(OsmApiException e)
public static String explainClientTimeout(OsmApiException e)
e - the exceptionpublic static String explainGenericOsmApiException(OsmApiException e)
e - the exceptionpublic static String explainConflict(OsmApiException e)
e - the exceptionpublic static String explainChangesetClosedException(ChangesetClosedException e)
e - the exceptionpublic static String explainGeneric(Exception e)
e - the exceptionpublic static String explainSecurityException(OsmTransferException e)
SecurityException which has caused an OsmTransferException.
This is most likely happening when user tries to access the OSM API from within an
applet which wasn't loaded from the API server.e - the exceptionpublic static String explainNestedSocketException(OsmTransferException e)
SocketException which has caused an OsmTransferException.
This is most likely because there's not connection to the Internet or because
the remote server is not reachable.e - the exceptionpublic static String explainNestedIOException(OsmTransferException e)
IOException which has caused an OsmTransferException.
This is most likely happening when the communication with the remote server is
interrupted for any reason.e - the exceptionpublic static String explainNestedIllegalDataException(OsmTransferException e)
IllegalDataException which has caused an OsmTransferException.
This is most likely happening when JOSM tries to load data in in an unsupported format.e - the exceptionpublic static String explainInternalServerError(OsmTransferException e)
OsmApiException which was thrown because of an internal server
error in the OSM API server..e - the exceptionpublic static String explainBadRequest(OsmApiException e)
OsmApiException which was thrown because of a bad
requeste - the exceptionpublic static String explainBandwidthLimitExceeded(OsmApiException e)
OsmApiException which was thrown because of
bandwidth limit exceeded (HTTP error 509)e - the exceptionpublic static String explainNotFound(OsmApiException e)
OsmApiException which was thrown because a resource wasn't found.e - the exceptionpublic static String explainNestedUnknownHostException(OsmTransferException e)
UnknownHostException which has caused an OsmTransferException.
This is most likely happening when there is an error in the API URL or when
local DNS services are not working.e - the exceptionprotected static <T> T getNestedException(Exception e, Class<T> nestedClass)
nestedClass (including
the root exception e) or null, if no such exception is found.T - e - the root exceptionnestedClass - the type of the nested exceptionnestedClass (including
the root exception e) or null, if no such exception is found.public static String explainOsmTransferException(OsmTransferException e)
OsmTransferException to the user.e - the OsmTransferExceptionpublic static String explainGoneForUnknownPrimitive(OsmApiException e)
OsmPrimitive, i.e. a HTTP response code 410, where we don't know which
OsmPrimitive is causing the error.e - the exceptionpublic static String explainException(Exception e)
Exception to the user.e - the Exceptionpublic static String escapeReservedCharactersHTML(String s)
s - The unescaped string