Package org.openstreetmap.josm.io
Class ChangesetClosedException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.openstreetmap.josm.io.OsmTransferException
-
- org.openstreetmap.josm.io.ChangesetClosedException
-
- All Implemented Interfaces:
java.io.Serializable
public class ChangesetClosedException extends OsmTransferException
A ChangesetClosedException is thrown if the server replies with a HTTP return code 409 (Conflict) with the error headerERROR_HEADER_PATTERN. Depending on the context the exception is thrown in we have to react differently.- if it is thrown when we try to update a changeset, the changeset was most likely closed before, either explicitly by the user or because of a timeout
- if it is thrown when we try to upload data to the changeset, the changeset was most likely closed because we reached the servers capability limit for the size of a changeset.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classChangesetClosedException.SourceIdentifies when the changeset exception occurred.
-
Field Summary
Fields Modifier and Type Field Description private longchangesetIdthe changeset idprivate java.time.InstantclosedOnthe date on which the changeset was closedstatic java.lang.StringERROR_HEADER_PATTERNthe error header pattern for in case of HTTP response 409 indicating that a changeset was closedprivate ChangesetClosedException.Sourcesourcethe source
-
Constructor Summary
Constructors Constructor Description ChangesetClosedException(long changesetId, java.time.Instant closedOn, ChangesetClosedException.Source source)Creates the exceptionChangesetClosedException(java.lang.String errorHeader)Creates the exception with the givenerrorHeaderChangesetClosedException(java.lang.String errorHeader, ChangesetClosedException.Source source)Creates the exception with the given error header and source.ChangesetClosedException(java.lang.String errorHeader, ChangesetClosedException.Source source, java.lang.Throwable cause)Creates the exception with the given error header, source and cause.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanerrorHeaderMatchesPattern(java.lang.String errorHeader)Replies true iferrorHeadermatches withERROR_HEADER_PATTERNlonggetChangesetId()Replies the id of the changeset which was closedjava.time.InstantgetClosedOn()Replies the date the changeset was closedChangesetClosedException.SourcegetSource()Replies the source where the exception was thrownprotected voidparseErrorHeader(java.lang.String errorHeader)voidsetSource(ChangesetClosedException.Source source)Sets the source where the exception was thrown-
Methods inherited from class org.openstreetmap.josm.io.OsmTransferException
getUrl, setUrl
-
-
-
-
Field Detail
-
ERROR_HEADER_PATTERN
public static final java.lang.String ERROR_HEADER_PATTERN
the error header pattern for in case of HTTP response 409 indicating that a changeset was closed- See Also:
- Constant Field Values
-
changesetId
private long changesetId
the changeset id
-
closedOn
private java.time.Instant closedOn
the date on which the changeset was closed
-
source
private ChangesetClosedException.Source source
the source
-
-
Constructor Detail
-
ChangesetClosedException
public ChangesetClosedException(java.lang.String errorHeader)
Creates the exception with the givenerrorHeader- Parameters:
errorHeader- the error header
-
ChangesetClosedException
public ChangesetClosedException(java.lang.String errorHeader, ChangesetClosedException.Source source)
Creates the exception with the given error header and source.- Parameters:
errorHeader- the error headersource- the source for the exception
-
ChangesetClosedException
public ChangesetClosedException(java.lang.String errorHeader, ChangesetClosedException.Source source, java.lang.Throwable cause)
Creates the exception with the given error header, source and cause.- Parameters:
errorHeader- the error headersource- the source for the exceptioncause- 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.- Since:
- 13207
-
ChangesetClosedException
public ChangesetClosedException(long changesetId, java.time.Instant closedOn, ChangesetClosedException.Source source)
Creates the exception- Parameters:
changesetId- the id if the closed changesetclosedOn- the date the changeset was closed onsource- the source for the exception
-
-
Method Detail
-
errorHeaderMatchesPattern
public static boolean errorHeaderMatchesPattern(java.lang.String errorHeader)
Replies true iferrorHeadermatches withERROR_HEADER_PATTERN- Parameters:
errorHeader- the error header- Returns:
- true if
errorHeadermatches withERROR_HEADER_PATTERN
-
parseErrorHeader
protected final void parseErrorHeader(java.lang.String errorHeader)
-
getChangesetId
public long getChangesetId()
Replies the id of the changeset which was closed- Returns:
- the id of the changeset which was closed
-
getClosedOn
public java.time.Instant getClosedOn()
Replies the date the changeset was closed- Returns:
- the date the changeset was closed. May be null if the date isn't known.
-
getSource
public ChangesetClosedException.Source getSource()
Replies the source where the exception was thrown- Returns:
- the source
-
setSource
public void setSource(ChangesetClosedException.Source source)
Sets the source where the exception was thrown- Parameters:
source- the source where the exception was thrown
-
-