Changeset 14121 in josm for trunk/src/org/openstreetmap/josm/Main.java
- Timestamp:
- 2018-08-11T17:51:12+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r14120 r14121 11 11 import java.util.Collection; 12 12 import java.util.Collections; 13 import java.util.EnumSet;14 import java.util.HashMap;15 13 import java.util.List; 16 14 import java.util.Map; … … 36 34 import org.openstreetmap.josm.data.projection.ProjectionRegistry; 37 35 import org.openstreetmap.josm.io.FileWatcher; 36 import org.openstreetmap.josm.io.NetworkManager; 38 37 import org.openstreetmap.josm.io.OnlineResource; 39 38 import org.openstreetmap.josm.spi.preferences.Config; … … 80 79 */ 81 80 public static final FileWatcher fileWatcher = new FileWatcher(); 82 83 private static final Map<String, Throwable> NETWORK_ERRORS = new HashMap<>();84 85 private static final Set<OnlineResource> OFFLINE_RESOURCES = EnumSet.noneOf(OnlineResource.class);86 81 87 82 /** … … 423 418 * @param t The network error 424 419 * @return The previous error associated to the given resource, if any. Can be {@code null} 420 * @deprecated Use {@link NetworkManager#addNetworkError(URL, Throwable)} 425 421 * @since 6642 426 422 */ 423 @Deprecated 427 424 public static Throwable addNetworkError(URL url, Throwable t) { 428 if (url != null && t != null) { 429 Throwable old = addNetworkError(url.toExternalForm(), t); 430 if (old != null) { 431 Logging.warn("Already here "+old); 432 } 433 return old; 434 } 435 return null; 425 return NetworkManager.addNetworkError(url, t); 436 426 } 437 427 … … 443 433 * @param t The network error 444 434 * @return The previous error associated to the given resource, if any. Can be {@code null} 435 * @deprecated Use {@link NetworkManager#addNetworkError(String, Throwable)} 445 436 * @since 6642 446 437 */ 438 @Deprecated 447 439 public static Throwable addNetworkError(String url, Throwable t) { 448 if (url != null && t != null) { 449 return NETWORK_ERRORS.put(url, t); 450 } 451 return null; 440 return NetworkManager.addNetworkError(url, t); 452 441 } 453 442 … … 455 444 * Returns the network errors that occured until now. 456 445 * @return the network errors that occured until now, indexed by URL 446 * @deprecated Use {@link NetworkManager#getNetworkErrors} 457 447 * @since 6639 458 448 */ 449 @Deprecated 459 450 public static Map<String, Throwable> getNetworkErrors() { 460 return new HashMap<>(NETWORK_ERRORS);451 return NetworkManager.getNetworkErrors(); 461 452 } 462 453 463 454 /** 464 455 * Clears the network errors cache. 456 * @deprecated Use {@link NetworkManager#clearNetworkErrors} 465 457 * @since 12011 466 458 */ 459 @Deprecated 467 460 public static void clearNetworkErrors() { 468 N ETWORK_ERRORS.clear();461 NetworkManager.clearNetworkErrors(); 469 462 } 470 463 … … 546 539 * @param r the online resource 547 540 * @return {@code true} if {@code r} is offline and should not be accessed 541 * @deprecated Use {@link NetworkManager#isOffline} 548 542 * @since 7434 549 543 */ 544 @Deprecated 550 545 public static boolean isOffline(OnlineResource r) { 551 return OFFLINE_RESOURCES.contains(r) || OFFLINE_RESOURCES.contains(OnlineResource.ALL);546 return NetworkManager.isOffline(r); 552 547 } 553 548 … … 556 551 * @param r the online resource 557 552 * @return {@code true} if {@code r} was not already offline 553 * @deprecated Use {@link NetworkManager#setOffline} 558 554 * @since 7434 559 555 */ 556 @Deprecated 560 557 public static boolean setOffline(OnlineResource r) { 561 return OFFLINE_RESOURCES.add(r);558 return NetworkManager.setOffline(r); 562 559 } 563 560 … … 566 563 * @param r the online resource 567 564 * @return {@code true} if {@code r} was offline 565 * @deprecated Use {@link NetworkManager#setOnline} 568 566 * @since 8506 569 567 */ 568 @Deprecated 570 569 public static boolean setOnline(OnlineResource r) { 571 return OFFLINE_RESOURCES.remove(r);570 return NetworkManager.setOnline(r); 572 571 } 573 572 … … 575 574 * Replies the set of online resources currently offline. 576 575 * @return the set of online resources currently offline 576 * @deprecated Use {@link NetworkManager#getOfflineResources} 577 577 * @since 7434 578 578 */ 579 @Deprecated 579 580 public static Set<OnlineResource> getOfflineResources() { 580 return EnumSet.copyOf(OFFLINE_RESOURCES);581 return NetworkManager.getOfflineResources(); 581 582 } 582 583 }
Note:
See TracChangeset
for help on using the changeset viewer.