Changeset 15740 in josm
- Timestamp:
- 2020-01-20T23:18:38+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r15496 r15740 71 71 } 72 72 73 private static boolean isRunningJavaWebStart() {74 try {75 // See http://stackoverflow.com/a/16200769/225717276 return Class.forName("javax.jnlp.ServiceManager") != null;77 } catch (ClassNotFoundException e) {78 return false;79 }80 }81 82 73 /** 83 74 * Replies the report header (software and system info) … … 129 120 } 130 121 // Add WebStart package details if run from JNLP 131 if ( isRunningJavaWebStart()) {122 if (Utils.isRunningJavaWebStart()) { 132 123 String webStartDetails = platform.getWebStartPackageDetails(); 133 124 if (webStartDetails != null) { -
trunk/src/org/openstreetmap/josm/data/cache/JCSCachedTileLoaderJob.java
r15573 r15740 302 302 303 303 Logging.debug("JCS - starting HttpClient GET request for URL: {0}", getUrl()); 304 final HttpClient request = getRequest("GET" , true);304 final HttpClient request = getRequest("GET"); 305 305 306 306 if (isObjectLoadable() && … … 487 487 } 488 488 489 private HttpClient getRequest(String requestMethod , boolean noCache) throws IOException {489 private HttpClient getRequest(String requestMethod) throws IOException { 490 490 final HttpClient urlConn = HttpClient.create(getUrl(), requestMethod); 491 491 urlConn.setAccept("text/html, image/png, image/jpeg, image/gif, */*"); … … 496 496 } 497 497 498 if (force || noCache) { 499 urlConn.useCache(false); 500 } 498 final boolean noCache = force 499 // To remove when switching to Java 11 500 // Workaround for https://bugs.openjdk.java.net/browse/JDK-8146450 501 || (Utils.getJavaVersion() == 8 && Utils.isRunningJavaWebStart()); 502 urlConn.useCache(!noCache); 503 501 504 return urlConn; 502 505 } 503 506 504 507 private boolean isCacheValidUsingHead() throws IOException { 505 final HttpClient.Response urlConn = getRequest("HEAD" , false).connect();508 final HttpClient.Response urlConn = getRequest("HEAD").connect(); 506 509 long lastModified = urlConn.getLastModified(); 507 510 boolean ret = (attributes.getEtag() != null && attributes.getEtag().equals(urlConn.getHeaderField("ETag"))) || -
trunk/src/org/openstreetmap/josm/tools/Utils.java
r15719 r15740 1801 1801 1802 1802 /** 1803 * Determines whether JOSM has been started via Java Web Start. 1804 * @return true if JOSM has been started via Java Web Start 1805 * @since 15740 1806 */ 1807 public static boolean isRunningJavaWebStart() { 1808 try { 1809 // See http://stackoverflow.com/a/16200769/2257172 1810 return Class.forName("javax.jnlp.ServiceManager") != null; 1811 } catch (ClassNotFoundException e) { 1812 return false; 1813 } 1814 } 1815 1816 /** 1803 1817 * Get a function that converts an object to a singleton stream of a certain 1804 1818 * class (or null if the object cannot be cast to that class).
Note:
See TracChangeset
for help on using the changeset viewer.