Ignore:
Timestamp:
2015-12-26T23:42:00+01:00 (4 years ago)
Author:
simon04
Message:

see #12231 - Use HttpClient instead of some Utils.openHttpConnection usages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java

    r9108 r9171  
    33
    44import java.awt.HeadlessException;
    5 import java.io.BufferedReader;
    65import java.io.IOException;
    7 import java.io.InputStream;
    86import java.io.StringReader;
    97import java.net.MalformedURLException;
    108import java.net.URL;
    11 import java.net.URLConnection;
    129import java.util.ArrayList;
    1310import java.util.Collection;
     
    2724import org.openstreetmap.josm.data.imagery.ImageryInfo;
    2825import org.openstreetmap.josm.data.projection.Projections;
    29 import org.openstreetmap.josm.io.UTFInputStreamReader;
     26import org.openstreetmap.josm.tools.HttpClient;
    3027import org.openstreetmap.josm.tools.Predicate;
    3128import org.openstreetmap.josm.tools.Utils;
     
    137134
    138135        Main.info("GET " + getCapabilitiesUrl);
    139         URLConnection openConnection = Utils.openHttpConnection(getCapabilitiesUrl, false, true);
    140         StringBuilder ba = new StringBuilder();
    141 
    142         try (
    143             InputStream inputStream = openConnection.getInputStream();
    144             BufferedReader br = new BufferedReader(UTFInputStreamReader.create(inputStream))
    145         ) {
    146             String line;
    147             while ((line = br.readLine()) != null) {
    148                 ba.append(line);
    149                 ba.append('\n');
    150             }
    151         }
    152         String incomingData = ba.toString();
     136        final String incomingData = HttpClient.create(getCapabilitiesUrl).connect().fetchContent();
    153137        Main.debug("Server response to Capabilities request:");
    154138        Main.debug(incomingData);
Note: See TracChangeset for help on using the changeset viewer.