IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/io/OsmApi.java b/src/org/openstreetmap/josm/io/OsmApi.java
|
a
|
b
|
|
| 247 | 247 | public void initialize(ProgressMonitor monitor, boolean fastFail) throws OsmTransferCanceledException, OsmApiInitializationException { |
| 248 | 248 | if (initialized) |
| 249 | 249 | return; |
| 250 | | cancel = false; |
| 251 | 250 | try { |
| 252 | 251 | CapabilitiesCache cache = new CapabilitiesCache(monitor, fastFail); |
| 253 | 252 | try { |
| … |
… |
|
| 617 | 616 | |
| 618 | 617 | private void sleepAndListen(int retry, ProgressMonitor monitor) throws OsmTransferCanceledException { |
| 619 | 618 | Logging.info(tr("Waiting 10 seconds ... ")); |
| | 619 | if (monitor != null) { |
| | 620 | monitor.addCancelListener(this::cancel); |
| | 621 | } |
| | 622 | |
| 620 | 623 | for (int i = 0; i < 10; i++) { |
| 621 | 624 | if (monitor != null) { |
| 622 | 625 | monitor.setCustomText(tr("Starting retry {0} of {1} in {2} seconds ...", getMaxRetries() - retry, getMaxRetries(), 10-i)); |
| 623 | | } |
| 624 | | if (cancel) |
| 625 | | throw new OsmTransferCanceledException("Operation canceled" + (i > 0 ? " in retry #"+i : "")); |
| | 626 | if (monitor.isCanceled()) { |
| | 627 | throw new OsmTransferCanceledException("Operation canceled" + (i > 0 ? " in retry #"+i : "")); |
| | 628 | } |
| | 629 | } |
| 626 | 630 | try { |
| 627 | 631 | Thread.sleep(1000); |
| 628 | 632 | } catch (InterruptedException ex) { |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/io/OsmConnection.java b/src/org/openstreetmap/josm/io/OsmConnection.java
|
a
|
b
|
|
| 48 | 48 | |
| 49 | 49 | private static final String BASIC_AUTH = "Basic "; |
| 50 | 50 | |
| 51 | | protected boolean cancel; |
| 52 | 51 | protected HttpClient activeConnection; |
| 53 | 52 | protected OAuthParameters oauthParameters; |
| 54 | 53 | protected IOAuthParameters oAuth20Parameters; |
| … |
… |
|
| 84 | 83 | * Cancels the connection. |
| 85 | 84 | */ |
| 86 | 85 | public void cancel() { |
| 87 | | cancel = true; |
| 88 | 86 | synchronized (this) { |
| 89 | 87 | if (activeConnection != null) { |
| 90 | 88 | activeConnection.disconnect(); |
| … |
… |
|
| 132 | 130 | } catch (CredentialsAgentException e) { |
| 133 | 131 | throw new OsmTransferException(e); |
| 134 | 132 | } |
| 135 | | if (response != null) { |
| 136 | | if (response.isCanceled()) { |
| 137 | | cancel = true; |
| 138 | | } else { |
| 139 | | String username = response.getUsername() == null ? "" : response.getUsername(); |
| 140 | | String password = response.getPassword() == null ? "" : String.valueOf(response.getPassword()); |
| 141 | | String token = username + ':' + password; |
| 142 | | con.setHeader("Authorization", BASIC_AUTH + Base64.getEncoder().encodeToString(token.getBytes(StandardCharsets.UTF_8))); |
| 143 | | } |
| | 133 | if (response != null && !response.isCanceled()) { |
| | 134 | String username = response.getUsername() == null ? "" : response.getUsername(); |
| | 135 | String password = response.getPassword() == null ? "" : String.valueOf(response.getPassword()); |
| | 136 | String token = username + ':' + password; |
| | 137 | con.setHeader("Authorization", BASIC_AUTH + Base64.getEncoder().encodeToString(token.getBytes(StandardCharsets.UTF_8))); |
| 144 | 138 | } |
| 145 | 139 | } |
| 146 | 140 | |
| … |
… |
|
| 292 | 286 | throw new OsmTransferException(msg); |
| 293 | 287 | } |
| 294 | 288 | } |
| 295 | | |
| 296 | | /** |
| 297 | | * Replies true if this connection is canceled |
| 298 | | * |
| 299 | | * @return true if this connection is canceled |
| 300 | | */ |
| 301 | | public boolean isCanceled() { |
| 302 | | return cancel; |
| 303 | | } |
| 304 | 289 | } |