org.openstreetmap.josm.io
Class ChangesetClosedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by org.openstreetmap.josm.io.OsmTransferException
              extended by 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 header ERROR_HEADER_PATTERN. Depending on the context the exception is thrown in we have to react differently.

See Also:
Serialized Form

Nested Class Summary
static class ChangesetClosedException.Source
           
 
Field Summary
private  long changesetId
          the changeset id
private  java.util.Date closedOn
          the date on which the changeset was closed
static java.lang.String ERROR_HEADER_PATTERN
          the error header pattern for in case of HTTP response 409 indicating that a changeset was closed
private  ChangesetClosedException.Source source
          the source
 
Constructor Summary
ChangesetClosedException(long changesetId, java.util.Date closedOn, ChangesetClosedException.Source source)
          Creates the exception
ChangesetClosedException(java.lang.String errorHeader)
          Creates the exception with the given errorHeader
ChangesetClosedException(java.lang.String errorHeader, ChangesetClosedException.Source source)
          Creates the exception with the given error header and the given source.
 
Method Summary
static boolean errorHeaderMatchesPattern(java.lang.String errorHeader)
          Replies true if errorHeader matches with ERROR_HEADER_PATTERN
 long getChangesetId()
          Replies the id of the changeset which was closed
 java.util.Date getClosedOn()
          Replies the date the changeset was closed
 ChangesetClosedException.Source getSource()
          Replies the source where the exception was thrown
protected  void parseErrorHeader(java.lang.String errorHeader)
           
 void setSource(ChangesetClosedException.Source source)
           
 
Methods inherited from class org.openstreetmap.josm.io.OsmTransferException
getUrl, setUrl
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

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.util.Date 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 given errorHeader

Parameters:
errorHeader - the error header

ChangesetClosedException

public ChangesetClosedException(java.lang.String errorHeader,
                                ChangesetClosedException.Source source)
Creates the exception with the given error header and the given source.

Parameters:
errorHeader - the error header
source - the source for the exception

ChangesetClosedException

public ChangesetClosedException(long changesetId,
                                java.util.Date closedOn,
                                ChangesetClosedException.Source source)
Creates the exception

Parameters:
changesetId - the id if the closed changeset
closedOn - the date the changeset was closed on
source - the source for the exception
Method Detail

errorHeaderMatchesPattern

public static boolean errorHeaderMatchesPattern(java.lang.String errorHeader)
Replies true if errorHeader matches with ERROR_HEADER_PATTERN

Parameters:
errorHeader - the error header
Returns:
true if errorHeader matches with ERROR_HEADER_PATTERN

parseErrorHeader

protected 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.util.Date 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)


JOSM