Ignore:
Timestamp:
2016-01-04T20:51:45+01:00 (8 years ago)
Author:
simon04
Message:

see #12292 - Allow to disconnect HttpClient in connecting phase

Location:
trunk/src/org/openstreetmap/josm/plugins
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginDownloadTask.java

    r9280 r9309  
    4444    private final Collection<PluginInformation> downloaded = new LinkedList<>();
    4545    private boolean canceled;
    46     private HttpClient.Response downloadConnection;
     46    private HttpClient downloadConnection;
    4747
    4848    /**
     
    124124            synchronized (this) {
    125125                downloadConnection = HttpClient.create(url)
    126                         .setAccept(PLUGIN_MIME_TYPES)
    127                         .connect();
    128             }
    129             try (InputStream in = downloadConnection.getContent()) {
     126                        .setAccept(PLUGIN_MIME_TYPES);
     127                downloadConnection.connect();
     128            }
     129            try (InputStream in = downloadConnection.getResponse().getContent()) {
    130130                Files.copy(in, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
    131131            }
  • trunk/src/org/openstreetmap/josm/plugins/ReadRemotePluginInformationTask.java

    r9296 r9309  
    5151    private Collection<String> sites;
    5252    private boolean canceled;
    53     private HttpClient.Response connection;
     53    private HttpClient connection;
    5454    private List<PluginInformation> availablePlugins;
    5555    private boolean displayErrMsg;
     
    157157
    158158            URL url = new URL(site);
    159             connection = HttpClient.create(url).useCache(false).connect();
    160             content = connection.fetchContent();
    161             if (connection.getResponseCode() != 200) {
     159            connection = HttpClient.create(url).useCache(false);
     160            final HttpClient.Response response = connection.connect();
     161            content = response.fetchContent();
     162            if (response.getResponseCode() != 200) {
    162163                throw new IOException(tr("Unsuccessful HTTP request"));
    163164            }
Note: See TracChangeset for help on using the changeset viewer.