Changeset 11553 in josm for trunk/src/org/openstreetmap/josm/tools/HttpClient.java
- Timestamp:
- 2017-02-12T16:32:18+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r11535 r11553 19 19 import java.util.Map; 20 20 import java.util.Map.Entry; 21 import java.util.Optional; 21 22 import java.util.Scanner; 22 23 import java.util.TreeMap; … … 148 149 if (redirectLocation == null) { 149 150 /* I18n: argument is HTTP response code */ 150 String msg = tr("Unexpected response from HTTP server. Got {0} response without ''Location'' header." + 151 " Can''t redirect. Aborting.", connection.getResponseCode()); 152 throw new IOException(msg); 151 throw new IOException(tr("Unexpected response from HTTP server. Got {0} response without ''Location'' header." + 152 " Can''t redirect. Aborting.", connection.getResponseCode())); 153 153 } else if (maxRedirects > 0) { 154 154 url = new URL(url, redirectLocation); … … 284 284 } catch (IOException ioe) { 285 285 Main.debug(ioe); 286 in = connection.getErrorStream(); 287 if (in == null) { 288 in = new ByteArrayInputStream(new byte[]{}); 289 } 286 in = Optional.ofNullable(connection.getErrorStream()).orElseGet(() -> new ByteArrayInputStream(new byte[]{})); 290 287 } 291 288 in = new ProgressInputStream(in, getContentLength(), monitor);
Note:
See TracChangeset
for help on using the changeset viewer.