Changeset 11381 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2016-12-12T02:28:14+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/HttpClient.java
r11288 r11381 209 209 ) { 210 210 String content = this.fetchContent(); 211 if (content == null || content.isEmpty()) {211 if (content.isEmpty()) { 212 212 Main.debug("Server did not return any body"); 213 213 } else { … … 289 289 } 290 290 } 291 if (in != null) { 292 in = new ProgressInputStream(in, getContentLength(), monitor); 293 in = "gzip".equalsIgnoreCase(getContentEncoding()) ? new GZIPInputStream(in) : in; 294 Compression compression = Compression.NONE; 295 if (uncompress) { 296 final String contentType = getContentType(); 297 Main.debug("Uncompressing input stream according to Content-Type header: {0}", contentType); 298 compression = Compression.forContentType(contentType); 299 } 300 if (uncompressAccordingToContentDisposition && Compression.NONE.equals(compression)) { 301 final String contentDisposition = getHeaderField("Content-Disposition"); 302 final Matcher matcher = Pattern.compile("filename=\"([^\"]+)\"").matcher( 303 contentDisposition != null ? contentDisposition : ""); 304 if (matcher.find()) { 305 Main.debug("Uncompressing input stream according to Content-Disposition header: {0}", contentDisposition); 306 compression = Compression.byExtension(matcher.group(1)); 307 } 308 } 309 in = compression.getUncompressedInputStream(in); 310 } 291 in = new ProgressInputStream(in, getContentLength(), monitor); 292 in = "gzip".equalsIgnoreCase(getContentEncoding()) ? new GZIPInputStream(in) : in; 293 Compression compression = Compression.NONE; 294 if (uncompress) { 295 final String contentType = getContentType(); 296 Main.debug("Uncompressing input stream according to Content-Type header: {0}", contentType); 297 compression = Compression.forContentType(contentType); 298 } 299 if (uncompressAccordingToContentDisposition && Compression.NONE.equals(compression)) { 300 final String contentDisposition = getHeaderField("Content-Disposition"); 301 final Matcher matcher = Pattern.compile("filename=\"([^\"]+)\"").matcher( 302 contentDisposition != null ? contentDisposition : ""); 303 if (matcher.find()) { 304 Main.debug("Uncompressing input stream according to Content-Disposition header: {0}", contentDisposition); 305 compression = Compression.byExtension(matcher.group(1)); 306 } 307 } 308 in = compression.getUncompressedInputStream(in); 311 309 return in; 312 310 } -
trunk/src/org/openstreetmap/josm/tools/WindowGeometry.java
r10627 r11381 204 204 protected final void initFromPreferences(String preferenceKey) throws WindowGeometryException { 205 205 String value = Main.pref.get(preferenceKey); 206 if (value == null || value.isEmpty())206 if (value.isEmpty()) 207 207 throw new WindowGeometryException( 208 208 tr("Preference with key ''{0}'' does not exist. Cannot restore window geometry from preferences.", preferenceKey));
Note:
See TracChangeset
for help on using the changeset viewer.