public final class ExceptionUtil extends java.lang.Object
Modifier | Constructor and Description |
---|---|
private |
ExceptionUtil() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
explainBadRequest(OsmApiException e)
Explains a
OsmApiException which was thrown because of a bad request. |
static java.lang.String |
explainBandwidthLimitExceeded(OsmApiException e)
Explains a
OsmApiException which was thrown because of
bandwidth limit exceeded (HTTP error 509) |
static java.lang.String |
explainChangesetClosedException(ChangesetClosedException e)
Explains an exception thrown during upload because the changeset which data is
uploaded to is already closed.
|
static java.lang.String |
explainClientTimeout(OsmApiException e)
Explains an OSM API exception because of a client timeout (HTTP 408).
|
static java.lang.String |
explainConflict(OsmApiException e)
Explains an error due to a 409 conflict
|
static java.lang.String |
explainException(java.lang.Exception e)
Explains an
Exception to the user. |
static java.lang.String |
explainFailedAuthorisation(OsmApiException e)
Explains a
OsmApiException which was thrown because accessing a protected
resource was forbidden (HTTP 403), without OAuth authentication. |
static java.lang.String |
explainFailedBasicAuthentication(OsmApiException e)
Explains a
OsmApiException which was thrown because the authentication at
the OSM server failed, with basic authentication. |
static java.lang.String |
explainFailedOAuthAuthentication(OsmApiException e)
Explains a
OsmApiException which was thrown because the authentication at
the OSM server failed, with OAuth authentication. |
static java.lang.String |
explainFailedOAuthAuthorisation(OsmApiException e)
Explains a
OsmApiException which was thrown because accessing a protected
resource was forbidden (HTTP 403), with OAuth authentication. |
static java.lang.String |
explainGeneric(java.lang.Exception e)
Explains an exception with a generic message dialog
|
static java.lang.String |
explainGenericOsmApiException(OsmApiException e)
Replies a generic error message for an OSM API exception
|
static java.lang.String |
explainGoneForUnknownPrimitive(OsmApiException e)
explains the case of an error due to a delete request on an already deleted
OsmPrimitive , i.e. |
static java.lang.String |
explainInternalServerError(OsmTransferException e)
Explains a
OsmApiException which was thrown because of an internal server
error in the OSM API server. |
static java.lang.String |
explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e)
Explains a
OsmApiException which was thrown because accessing a protected
resource was forbidden. |
static java.lang.String |
explainNestedIllegalDataException(OsmTransferException e)
Explains a
IllegalDataException which has caused an OsmTransferException . |
static java.lang.String |
explainNestedIOException(OsmTransferException e)
Explains a
IOException which has caused an OsmTransferException . |
static java.lang.String |
explainNestedSocketException(OsmTransferException e)
Explains a
SocketException which has caused an OsmTransferException . |
static java.lang.String |
explainNestedUnknownHostException(OsmTransferException e)
Explains a
UnknownHostException which has caused an OsmTransferException . |
static java.lang.String |
explainNotFound(OsmApiException e)
Explains a
OsmApiException which was thrown because a resource wasn't found. |
static java.lang.String |
explainOfflineAccessException(OsmTransferException e)
Explains a
OfflineAccessException which has caused an OsmTransferException . |
static java.lang.String |
explainOsmApiInitializationException(OsmApiInitializationException e)
Explains an exception caught during OSM API initialization.
|
static java.lang.String |
explainOsmTransferException(OsmTransferException e)
Explains an
OsmTransferException to the user. |
static java.lang.String |
explainPreconditionFailed(OsmApiException e)
Explains an upload error due to a violated precondition, i.e.
|
static java.lang.String |
explainSecurityException(OsmTransferException e)
Explains a
SecurityException which has caused an OsmTransferException . |
static <T> T |
getNestedException(java.lang.Exception e,
java.lang.Class<T> nestedClass)
Replies the first nested exception of type
nestedClass (including
the root exception e ) or null, if no such exception is found. |
(package private) static java.lang.String |
getUrlFromException(OsmApiException e) |
static Pair<OsmPrimitive,java.util.Collection<OsmPrimitive>> |
parsePreconditionFailed(java.lang.String msg)
Parses a precondition failure response from the server and attempts to get more information about it
|
private ExceptionUtil()
public static java.lang.String explainOsmApiInitializationException(OsmApiInitializationException e)
e
- the exceptionpublic static java.lang.String explainMissingOAuthAccessTokenException(MissingOAuthAccessTokenException e)
OsmApiException
which was thrown because accessing a protected
resource was forbidden.e
- the exceptionpublic static Pair<OsmPrimitive,java.util.Collection<OsmPrimitive>> parsePreconditionFailed(java.lang.String msg)
msg
- The message from the serverpublic static java.lang.String explainPreconditionFailed(OsmApiException e)
e
- the exceptionpublic static java.lang.String explainFailedBasicAuthentication(OsmApiException e)
OsmApiException
which was thrown because the authentication at
the OSM server failed, with basic authentication.e
- the exceptionpublic static java.lang.String explainFailedOAuthAuthentication(OsmApiException e)
OsmApiException
which was thrown because the authentication at
the OSM server failed, with OAuth authentication.e
- the exceptionpublic static java.lang.String explainFailedAuthorisation(OsmApiException e)
OsmApiException
which was thrown because accessing a protected
resource was forbidden (HTTP 403), without OAuth authentication.e
- the exceptionpublic static java.lang.String explainFailedOAuthAuthorisation(OsmApiException e)
OsmApiException
which was thrown because accessing a protected
resource was forbidden (HTTP 403), with OAuth authentication.e
- the exceptionpublic static java.lang.String explainClientTimeout(OsmApiException e)
e
- the exceptionpublic static java.lang.String explainGenericOsmApiException(OsmApiException e)
e
- the exceptionpublic static java.lang.String explainConflict(OsmApiException e)
e
- the exceptionpublic static java.lang.String explainChangesetClosedException(ChangesetClosedException e)
e
- the exceptionpublic static java.lang.String explainGeneric(java.lang.Exception e)
e
- the exceptionpublic static java.lang.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 java.lang.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 java.lang.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 java.lang.String explainNestedIllegalDataException(OsmTransferException e)
IllegalDataException
which has caused an OsmTransferException
.
This is most likely happening when JOSM tries to load data in an unsupported format.e
- the exceptionpublic static java.lang.String explainOfflineAccessException(OsmTransferException e)
OfflineAccessException
which has caused an OsmTransferException
.
This is most likely happening when JOSM tries to access OSM API or JOSM website while in offline mode.e
- the exceptionpublic static java.lang.String explainInternalServerError(OsmTransferException e)
OsmApiException
which was thrown because of an internal server
error in the OSM API server.e
- the exceptionpublic static java.lang.String explainBadRequest(OsmApiException e)
OsmApiException
which was thrown because of a bad request.e
- the exceptionpublic static java.lang.String explainBandwidthLimitExceeded(OsmApiException e)
OsmApiException
which was thrown because of
bandwidth limit exceeded (HTTP error 509)e
- the exceptionpublic static java.lang.String explainNotFound(OsmApiException e)
OsmApiException
which was thrown because a resource wasn't found.e
- the exceptionpublic static java.lang.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 exceptionpublic static <T> T getNestedException(java.lang.Exception e, java.lang.Class<T> nestedClass)
nestedClass
(including
the root exception e
) or null, if no such exception is found.T
- nested exception typee
- the root exceptionnestedClass
- the type of the nested exceptionnestedClass
(including
the root exception e
) or null, if no such exception is found.public static java.lang.String explainOsmTransferException(OsmTransferException e)
OsmTransferException
to the user.e
- the OsmTransferException
public static java.lang.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 java.lang.String explainException(java.lang.Exception e)
Exception
to the user.e
- the Exception
static java.lang.String getUrlFromException(OsmApiException e)