Package org.openstreetmap.josm.tools
Class ExceptionUtil
java.lang.Object
org.openstreetmap.josm.tools.ExceptionUtil
Utilities for exception handling.
- Since:
- 2097
-
Field Summary
FieldsModifier and TypeFieldDescriptionError messages sent by the OSM API when a user has been blocked/suspended. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringExplains aOsmApiExceptionwhich was thrown because of a bad request.static StringExplains aOsmApiExceptionwhich was thrown because of bandwidth limit exceeded (HTTP error 509)static StringExplains an exception thrown during upload because the changeset which data is uploaded to is already closed.static StringExplains an OSM API exception because of a client timeout (HTTP 408).static StringExplains an error due to a 409 conflictstatic StringExplains anExceptionto the user.static StringExplains aOsmApiExceptionwhich was thrown because accessing a protected resource was forbidden (HTTP 403), without OAuth authentication.static StringExplains aOsmApiExceptionwhich was thrown because the authentication at the OSM server failed, with basic authentication.static StringExplains aOsmApiExceptionwhich was thrown because the authentication at the OSM server failed, with OAuth authentication.static StringExplains aOsmApiExceptionwhich was thrown because accessing a protected resource was forbidden (HTTP 403), with OAuth authentication.static StringExplains an exception with a generic message dialogstatic StringReplies a generic error message for an OSM API exceptionstatic Stringexplains the case of an error due to a delete request on an already deletedOsmPrimitive, i.e.static StringExplains aOsmApiExceptionwhich was thrown because of an internal server error in the OSM API server.static StringExplains aOsmApiExceptionwhich was thrown because accessing a protected resource was forbidden.static StringExplains aIllegalDataExceptionwhich has caused anOsmTransferException.static StringExplains aIOExceptionwhich has caused anOsmTransferException.static StringExplains aSocketExceptionwhich has caused anOsmTransferException.static StringExplains aUnknownHostExceptionwhich has caused anOsmTransferException.static StringExplains aOsmApiExceptionwhich was thrown because a resource wasn't found.static StringExplains aOfflineAccessExceptionwhich has caused anOsmTransferException.static StringExplains an exception caught during OSM API initialization.static StringExplains anOsmTransferExceptionto the user.static StringExplains an upload error due to a violated precondition, i.e.static StringExplains aSecurityExceptionwhich has caused anOsmTransferException.private static StringformatClosedOn(Instant closedOn) static <T> TgetNestedException(Exception e, Class<T> nestedClass) Replies the first nested exception of typenestedClass(including the root exceptione) or null, if no such exception is found.(package private) static Stringstatic booleanDetermines if the OSM API exception has been thrown because user has been blocked or suspended.static Pair<OsmPrimitive,Collection<OsmPrimitive>> Parses a precondition failure response from the server and attempts to get more information about it
-
Field Details
-
OSM_API_BLOCK_MESSAGES
Error messages sent by the OSM API when a user has been blocked/suspended.
-
-
Constructor Details
-
ExceptionUtil
private ExceptionUtil()
-
-
Method Details
-
explainOsmApiInitializationException
Explains an exception caught during OSM API initialization.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainMissingOAuthAccessTokenException
Explains aOsmApiExceptionwhich was thrown because accessing a protected resource was forbidden.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
parsePreconditionFailed
Parses a precondition failure response from the server and attempts to get more information about it- Parameters:
msg- The message from the server- Returns:
- The OSM primitive that caused the problem and a collection of primitives that e.g. refer to it
-
explainPreconditionFailed
Explains an upload error due to a violated precondition, i.e. a HTTP return code 412- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainFailedBasicAuthentication
Explains aOsmApiExceptionwhich was thrown because the authentication at the OSM server failed, with basic authentication.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainFailedOAuthAuthentication
Explains aOsmApiExceptionwhich was thrown because the authentication at the OSM server failed, with OAuth authentication.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainFailedAuthorisation
Explains aOsmApiExceptionwhich was thrown because accessing a protected resource was forbidden (HTTP 403), without OAuth authentication.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainFailedOAuthAuthorisation
Explains aOsmApiExceptionwhich was thrown because accessing a protected resource was forbidden (HTTP 403), with OAuth authentication.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainClientTimeout
Explains an OSM API exception because of a client timeout (HTTP 408).- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainGenericOsmApiException
Replies a generic error message for an OSM API exception- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainConflict
Explains an error due to a 409 conflict- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainChangesetClosedException
Explains an exception thrown during upload because the changeset which data is uploaded to is already closed.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
formatClosedOn
-
explainGeneric
Explains an exception with a generic message dialog- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainSecurityException
Explains aSecurityExceptionwhich has caused anOsmTransferException. 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.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainNestedSocketException
Explains aSocketExceptionwhich has caused anOsmTransferException. This is most likely because there's not connection to the Internet or because the remote server is not reachable.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainNestedIOException
Explains aIOExceptionwhich has caused anOsmTransferException. This is most likely happening when the communication with the remote server is interrupted for any reason.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainNestedIllegalDataException
Explains aIllegalDataExceptionwhich has caused anOsmTransferException. This is most likely happening when JOSM tries to load data in an unsupported format.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainOfflineAccessException
Explains aOfflineAccessExceptionwhich has caused anOsmTransferException. This is most likely happening when JOSM tries to access OSM API or JOSM website while in offline mode.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
- Since:
- 7434
-
explainInternalServerError
Explains aOsmApiExceptionwhich was thrown because of an internal server error in the OSM API server.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainBadRequest
Explains aOsmApiExceptionwhich was thrown because of a bad request.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainBandwidthLimitExceeded
Explains aOsmApiExceptionwhich was thrown because of bandwidth limit exceeded (HTTP error 509)- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainNotFound
Explains aOsmApiExceptionwhich was thrown because a resource wasn't found.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainNestedUnknownHostException
Explains aUnknownHostExceptionwhich has caused anOsmTransferException. This is most likely happening when there is an error in the API URL or when local DNS services are not working.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
getNestedException
Replies the first nested exception of typenestedClass(including the root exceptione) or null, if no such exception is found.- Type Parameters:
T- nested exception type- Parameters:
e- the root exceptionnestedClass- the type of the nested exception- Returns:
- the first nested exception of type
nestedClass(including the root exceptione) or null, if no such exception is found. - Since:
- 8470
-
explainOsmTransferException
Explains anOsmTransferExceptionto the user.- Parameters:
e- theOsmTransferException- Returns:
- The HTML formatted error message to display
-
explainGoneForUnknownPrimitive
explains the case of an error due to a delete request on an already deletedOsmPrimitive, i.e. a HTTP response code 410, where we don't know whichOsmPrimitiveis causing the error.- Parameters:
e- the exception- Returns:
- The HTML formatted error message to display
-
explainException
Explains anExceptionto the user.- Parameters:
e- theException- Returns:
- The HTML formatted error message to display
-
isUserBlocked
Determines if the OSM API exception has been thrown because user has been blocked or suspended.- Parameters:
e- OSM API exception- Returns:
trueif the OSM API exception has been thrown because user has been blocked or suspended- Since:
- 15084
-
getUrlFromException
-