Package org.openstreetmap.josm.io
Class OsmApiException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.openstreetmap.josm.io.OsmTransferException
org.openstreetmap.josm.io.OsmApiException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
OsmApiPrimitiveGoneException
Exception thrown when a communication error occurs when accessing the OSM API.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionOsmApiException(int responseCode, String errorHeader, String errorBody) Constructs anOsmApiExceptionwith the specified response code, error header and error bodyOsmApiException(int responseCode, String errorHeader, String errorBody, String accessedUrl) Constructs anOsmApiExceptionwith the specified response code, error header and error bodyOsmApiException(int responseCode, String errorHeader, String errorBody, String accessedUrl, String login) Constructs anOsmApiExceptionwith the specified response code, error header and error bodyOsmApiException(int responseCode, String errorHeader, String errorBody, String accessedUrl, String login, String contentType) Constructs anOsmApiExceptionwith the specified response code, error header and error bodyOsmApiException(String message) Constructs anOsmApiExceptionwith the specified detail message.OsmApiException(String message, Throwable cause) Constructs anOsmApiExceptionwith the specified detail message and cause.OsmApiException(Throwable cause) Constructs anOsmApiExceptionwith the specified cause and a detail message of(cause==null ? null : cause.toString())(which typically contains the class and detail message ofcause). -
Method Summary
Modifier and TypeMethodDescriptionprivate voidReplies the complete URL accessed when this error occurred.final StringReplies the response content-type.Replies a message suitable to be displayed in a message dialogReplies the error body.Replies the error header.getLogin()Replies the login used to connect to OSM API.intReplies the HTTP response code.final booleanisHtml()Determines if the exception hastext/htmlas content type.voidsetAccessedUrl(String url) Sets the complete URL accessed when this error occurred.final voidsetContentType(String contentType) Sets the response content-type.voidsetErrorBody(String errorBody) Sets the error body.voidsetErrorHeader(String errorHeader) Sets the error header.voidSets the login used to connect to OSM API.voidsetResponseCode(int responseCode) Sets the HTTP response code.Methods inherited from class org.openstreetmap.josm.io.OsmTransferException
getUrl, setUrlMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Field Details
-
responseCode
-
contentType
-
errorHeader
-
errorBody
-
accessedUrl
-
login
-
-
Constructor Details
-
OsmApiException
public OsmApiException(int responseCode, String errorHeader, String errorBody, String accessedUrl, String login, String contentType) Constructs anOsmApiExceptionwith the specified response code, error header and error body- Parameters:
responseCode- The HTTP response code replied by the OSM server. SeeHttpURLConnectionfor predefined HTTP response code valueserrorHeader- The error header, as transmitted in theErrorfield of the HTTP response headererrorBody- The error body, as transmitted in the HTTP response bodyaccessedUrl- The complete URL accessed when this error occurredlogin- the login used to connect to OSM API (can be null)contentType- the response content-type- Since:
- 13499
-
OsmApiException
public OsmApiException(int responseCode, String errorHeader, String errorBody, String accessedUrl, String login) Constructs anOsmApiExceptionwith the specified response code, error header and error body- Parameters:
responseCode- The HTTP response code replied by the OSM server. SeeHttpURLConnectionfor predefined HTTP response code valueserrorHeader- The error header, as transmitted in theErrorfield of the HTTP response headererrorBody- The error body, as transmitted in the HTTP response bodyaccessedUrl- The complete URL accessed when this error occurredlogin- the login used to connect to OSM API (can be null)- Since:
- 12992
-
OsmApiException
Constructs anOsmApiExceptionwith the specified response code, error header and error body- Parameters:
responseCode- The HTTP response code replied by the OSM server. SeeHttpURLConnectionfor predefined HTTP response code valueserrorHeader- The error header, as transmitted in theErrorfield of the HTTP response headererrorBody- The error body, as transmitted in the HTTP response bodyaccessedUrl- The complete URL accessed when this error occurred- Since:
- 5584
-
OsmApiException
Constructs anOsmApiExceptionwith the specified response code, error header and error body- Parameters:
responseCode- The HTTP response code replied by the OSM server. SeeHttpURLConnectionfor predefined HTTP response code valueserrorHeader- The error header, as transmitted in theErrorfield of the HTTP response headererrorBody- The error body, as transmitted in the HTTP response body
-
OsmApiException
Constructs anOsmApiExceptionwith the specified detail message. The cause is not initialized, and may subsequently be initialized by a call toThrowable.initCause(java.lang.Throwable).- Parameters:
message- The detail message (which is saved for later retrieval by thegetMessage()method)
-
OsmApiException
Constructs anOsmApiExceptionwith the specified cause and a detail message of(cause==null ? null : cause.toString())(which typically contains the class and detail message ofcause).- Parameters:
cause- the cause (which is saved for later retrieval by theThrowable.getCause()method). Anullvalue is permitted, and indicates that the cause is nonexistent or unknown.
-
OsmApiException
Constructs anOsmApiExceptionwith the specified detail message and cause.Note that the detail message associated with
causeis not automatically incorporated into this exception's detail message.- Parameters:
message- The detail message (which is saved for later retrieval by thegetMessage()method)cause- The cause (which is saved for later retrieval by theThrowable.getCause()method). A null value is permitted, and indicates that the cause is nonexistent or unknown.
-
-
Method Details
-
checkHtmlBody
-
getResponseCode
Replies the HTTP response code.- Returns:
- The HTTP response code replied by the OSM server. Refer to OSM API to see the list of response codes returned by the API for each call.
-
setResponseCode
Sets the HTTP response code.- Parameters:
responseCode- The HTTP response code replied by the OSM server. SeeHttpURLConnectionfor predefined HTTP response code values
-
getErrorHeader
Replies the error header.- Returns:
- the error header, as transmitted in the
Errorfield of the HTTP response header
-
setErrorHeader
Sets the error header.- Parameters:
errorHeader- the error header, as transmitted in theErrorfield of the HTTP response header
-
getErrorBody
Replies the error body.- Returns:
- The error body, as transmitted in the HTTP response body
-
setErrorBody
Sets the error body.- Parameters:
errorBody- The error body, as transmitted in the HTTP response body
-
getMessage
- Overrides:
getMessagein classThrowable
-
getDisplayMessage
Replies a message suitable to be displayed in a message dialog- Returns:
- a message which is suitable to be displayed in a message dialog
-
setAccessedUrl
Sets the complete URL accessed when this error occurred. This is distinct from the one set withOsmTransferException.setUrl(java.lang.String), which is generally only the base URL of the server.- Parameters:
url- the complete URL accessed when this error occurred.
-
getAccessedUrl
Replies the complete URL accessed when this error occurred. This is distinct from the one returned byOsmTransferException.getUrl(), which is generally only the base URL of the server.- Returns:
- the complete URL accessed when this error occurred.
-
setLogin
Sets the login used to connect to OSM API.- Parameters:
login- the login used to connect to OSM API- Since:
- 12992
-
getLogin
Replies the login used to connect to OSM API.- Returns:
- the login used to connect to OSM API, or
null - Since:
- 12992
-
setContentType
Sets the response content-type.- Parameters:
contentType- the response content-type.- Since:
- 13499
-
getContentType
Replies the response content-type.- Returns:
- the response content-type
- Since:
- 13499
-
isHtml
Determines if the exception hastext/htmlas content type.- Returns:
trueif the exception hastext/htmlas content type.- Since:
- 14810
-