Changeset 12620 in josm for trunk/src/org/openstreetmap/josm/tools/HttpClient.java
- Timestamp:
- 2017-08-22T22:26:32+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r12590 r12620 111 111 112 112 if ("PUT".equals(requestMethod) || "POST".equals(requestMethod) || "DELETE".equals(requestMethod)) { 113 Main.info("{0} {1} ({2}) ...", requestMethod, url, Utils.getSizeString(requestBody.length, Locale.getDefault()));113 Logging.info("{0} {1} ({2}) ...", requestMethod, url, Utils.getSizeString(requestBody.length, Locale.getDefault())); 114 114 connection.setFixedLengthStreamingMode(requestBody.length); 115 115 connection.setDoOutput(true); … … 125 125 connection.connect(); 126 126 final boolean hasReason = reasonForRequest != null && !reasonForRequest.isEmpty(); 127 Main.info("{0} {1}{2} -> {3}{4}",127 Logging.info("{0} {1}{2} -> {3}{4}", 128 128 requestMethod, url, hasReason ? (" (" + reasonForRequest + ')') : "", 129 129 connection.getResponseCode(), … … 132 132 : "" 133 133 ); 134 if ( Main.isDebugEnabled()) {135 Main.debug("RESPONSE: " +connection.getHeaderFields());134 if (Logging.isDebugEnabled()) { 135 Logging.debug("RESPONSE: {0}", connection.getHeaderFields()); 136 136 } 137 137 if (DefaultAuthenticator.getInstance().isEnabled() && connection.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED) { … … 139 139 } 140 140 } catch (IOException e) { 141 Main.info("{0} {1} -> !!!", requestMethod, url);142 Main.warn(e);141 Logging.info("{0} {1} -> !!!", requestMethod, url); 142 Logging.warn(e); 143 143 //noinspection ThrowableResultOfMethodCallIgnored 144 144 Main.addNetworkError(url, Utils.getRootCause(e)); … … 154 154 url = new URL(url, redirectLocation); 155 155 maxRedirects--; 156 Main.info(tr("Download redirected to ''{0}''", redirectLocation));156 Logging.info(tr("Download redirected to ''{0}''", redirectLocation)); 157 157 return connect(); 158 158 } else if (maxRedirects == 0) { … … 210 210 String content = this.fetchContent(); 211 211 if (content.isEmpty()) { 212 Main.debug("Server did not return any body");212 Logging.debug("Server did not return any body"); 213 213 } else { 214 Main.debug("Response body: ");215 Main.debug(this.fetchContent());214 Logging.debug("Response body: "); 215 Logging.debug(this.fetchContent()); 216 216 } 217 217 } else { 218 Main.debug("Server returned content: {0} of length: {1}. Not printing.", contentType, this.getContentLength());218 Logging.debug("Server returned content: {0} of length: {1}. Not printing.", contentType, this.getContentLength()); 219 219 } 220 220 } … … 283 283 in = connection.getInputStream(); 284 284 } catch (IOException ioe) { 285 Main.debug(ioe);285 Logging.debug(ioe); 286 286 in = Optional.ofNullable(connection.getErrorStream()).orElseGet(() -> new ByteArrayInputStream(new byte[]{})); 287 287 } … … 291 291 if (uncompress) { 292 292 final String contentType = getContentType(); 293 Main.debug("Uncompressing input stream according to Content-Type header: {0}", contentType);293 Logging.debug("Uncompressing input stream according to Content-Type header: {0}", contentType); 294 294 compression = Compression.forContentType(contentType); 295 295 } … … 299 299 contentDisposition != null ? contentDisposition : ""); 300 300 if (matcher.find()) { 301 Main.debug("Uncompressing input stream according to Content-Disposition header: {0}", contentDisposition);301 Logging.debug("Uncompressing input stream according to Content-Disposition header: {0}", contentDisposition); 302 302 compression = Compression.byExtension(matcher.group(1)); 303 303 } … … 661 661 Thread.sleep(100); 662 662 } catch (InterruptedException ex) { 663 Main.warn("InterruptedException in " + HttpClient.class + " during cancel");663 Logging.warn("InterruptedException in " + HttpClient.class + " during cancel"); 664 664 Thread.currentThread().interrupt(); 665 665 }
Note:
See TracChangeset
for help on using the changeset viewer.