- try {
- uc = u.openConnection();
- String type = uc.getContentType();
- int contentLength = uc.getContentLength();
- if (uc instanceof HttpURLConnection) {
- int response = ((HttpURLConnection) uc).getResponseCode();
- switch (response) {
- case HttpURLConnection.HTTP_FORBIDDEN:
- case HttpURLConnection.HTTP_PAYMENT_REQUIRED:
- case HttpURLConnection.HTTP_UNAUTHORIZED:
- synchronized (forbidden_lock) {
- forbidden_time = System.nanoTime();
- forbidden_set = true;
- forbidden_response = response;
+
+ int status = AltosMapTile.failed;
+ int tries = 0;
+
+ while (tries < 10 && status != AltosMapTile.fetched) {
+ try {
+ uc = u.openConnection();
+ String type = uc.getContentType();
+ int contentLength = uc.getContentLength();
+ if (uc instanceof HttpURLConnection) {
+ int response = ((HttpURLConnection) uc).getResponseCode();
+ switch (response) {
+ case HttpURLConnection.HTTP_FORBIDDEN:
+ case HttpURLConnection.HTTP_PAYMENT_REQUIRED:
+ case HttpURLConnection.HTTP_UNAUTHORIZED: