Changeset 1859 in josm


Ignore:
Timestamp:
2009-07-27T08:17:38+02:00 (15 years ago)
Author:
Gubaer
Message:

fixed #3053: missing api handler for "Internal Server Error"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmApi.java

    r1811 r1859  
    355355
    356356    private void sleepAndListen() throws OsmTransferCancelledException {
    357         // System.out.print("backing off for 10 seconds...");
     357        System.out.print(tr("Waiting 10 seconds ... "));
    358358        for(int i=0; i < 10; i++) {
    359359            if (cancel || isAuthCancelled())
     
    363363            } catch (InterruptedException ex) {}
    364364        }
     365        System.out.println(tr("OK - trying again."));
     366    }
     367
     368    /**
     369     * Replies the max. number of retries in case of 5XX errors on the server
     370     *
     371     * @return the max number of retries
     372     */
     373    protected int getMaxRetries() {
     374        int ret = Main.pref.getInteger("osm-server.max-num-retries", DEFAULT_MAX_NUM_RETRIES);
     375        return Math.max(ret,0);
    365376    }
    366377
     
    385396        StringBuffer responseBody = new StringBuffer();
    386397
    387         int retries = Main.pref.getInteger("osm-server.max-num-retries", DEFAULT_MAX_NUM_RETRIES);
    388         retries = Math.max(0,retries);
     398        int retries = getMaxRetries();
    389399
    390400        while(true) { // the retry loop
     
    423433                    if (retries-- > 0) {
    424434                        sleepAndListen();
     435                        int maxRetries = getMaxRetries();
     436                        System.out.println(tr("Starting retry {0} of {1}.", maxRetries - retries,maxRetries));
    425437                        continue;
    426438                    }
Note: See TracChangeset for help on using the changeset viewer.