[josm-dev] Ticket #601: Auto-retry of uploads doesn't catch all timeouts
Florian Heer
florianheerfheb at yahoo.de
Wed Aug 13 00:52:43 BST 2008
Another Hi!
I looked into #601 and found some to my mind dirty programming.
The described behaviour in the ticket is as I think a basic Problem in
the OsmServerWriter. Any occuring Exception is in the end encapsulated
in a RuntimeException, like for example this:
if (retries-- > 0)
startChangeset(retries, comment);
else
throw new RuntimeException (e.getMessage()+ " " +
e.getClass().getCanonicalName(), e);
Throwing RuntimeExceptions has of course its benefits in as much as you
don't have to declare them and can catch them at the topmost level as is
the case here. The transfer will be aborted and an error message
displayed. On stderr the Exception will be displayed nonetheless.
This happens in any persistent error state of the OsmServerWriter. Host
not found, continuing connection problems, you name it.
The attached might solve 601, as it deals with ConnectExceptions in the
same way as SocketTimeoutExceptions are handled. but I could not force
the ConnectException, so I can't test that.
I have created the marker class OsmTransferException to replace the
RuntimeException with expected problems so the program can make a
difference in the handling.
My handler on the downside is quite crappy, it just sets the status text
of the "please wait"-dialog to the error condition, makes the transfer
cancel and waits 5 seconds so the user might have a chance to read about
the problem (see method dealWithTransferException). But then the dialog
is gone and if a user starts a transfer which ends in an error condition
he will probably miss the information.
Therefore this patch is a step to a better Exception-handling, but
please, someone, make an error-dialog appear... :-)
Best regards, Florian.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: josm-patch-ticket-601.txt
URL: <http://lists.openstreetmap.org/pipermail/josm-dev/attachments/20080813/437c7efc/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: OsmTransferException.java
URL: <http://lists.openstreetmap.org/pipermail/josm-dev/attachments/20080813/437c7efc/attachment.ksh>
More information about the josm-dev
mailing list