Changeset 10756 in josm


Ignore:
Timestamp:
2016-08-07T16:55:48+02:00 (4 years ago)
Author:
Don-vip
Message:

add robustness to DomainValidatorTestIT

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/validation/routines/DomainValidatorTestIT.java

    r10222 r10756  
    3030import java.lang.reflect.Field;
    3131import java.lang.reflect.Modifier;
     32import java.net.ConnectException;
    3233import java.net.HttpURLConnection;
    3334import java.net.IDN;
     
    4748
    4849import org.junit.Test;
     50import org.openstreetmap.josm.Main;
    4951
    5052import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     
    7880        DomainValidator dv = DomainValidator.getInstance();
    7981        File txtFile = new File(System.getProperty("java.io.tmpdir"), "tlds-alpha-by-domain.txt");
    80         long timestamp = download(txtFile, "http://data.iana.org/TLD/tlds-alpha-by-domain.txt", 0L);
     82        long timestamp;
     83        try {
     84            timestamp = download(txtFile, "http://data.iana.org/TLD/tlds-alpha-by-domain.txt", 0L);
     85        } catch (ConnectException e) {
     86            Main.error(e);
     87            // Try again one more time in case of random network issue
     88            timestamp = download(txtFile, "http://data.iana.org/TLD/tlds-alpha-by-domain.txt", 0L);
     89        }
    8190        final File htmlFile = new File(System.getProperty("java.io.tmpdir"), "tlds-alpha-by-domain.html");
    8291        // N.B. sometimes the html file may be updated a day or so after the txt file
Note: See TracChangeset for help on using the changeset viewer.