Changeset 13260 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2017-12-29T16:18:37+01:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/imagery/WMSImagery.java
r13228 r13260 5 5 import java.io.IOException; 6 6 import java.io.StringReader; 7 import java.io.StringWriter; 7 8 import java.net.MalformedURLException; 8 9 import java.net.URL; … … 24 25 import javax.xml.parsers.DocumentBuilder; 25 26 import javax.xml.parsers.ParserConfigurationException; 27 import javax.xml.transform.TransformerException; 28 import javax.xml.transform.TransformerFactory; 29 import javax.xml.transform.TransformerFactoryConfigurationError; 30 import javax.xml.transform.dom.DOMSource; 31 import javax.xml.transform.stream.StreamResult; 26 32 27 33 import org.openstreetmap.josm.data.Bounds; … … 229 235 230 236 final Response response = HttpClient.create(getCapabilitiesUrl).connect(); 231 final String incomingData = response.fetchContent(); 232 Logging.debug("Server response to Capabilities request:"); 233 Logging.debug(incomingData); 237 String incomingData = null; 234 238 235 239 if (response.getResponseCode() >= 400) { 236 throw new WMSGetCapabilitiesException(response.getResponseMessage(), incomingData);240 throw new WMSGetCapabilitiesException(response.getResponseMessage(), response.fetchContent()); 237 241 } 238 242 … … 243 247 return new InputSource(new StringReader("")); 244 248 }); 245 Document document = builder.parse( new InputSource(new StringReader(incomingData)));249 Document document = builder.parse(response.getContent()); 246 250 Element root = document.getDocumentElement(); 251 252 try { 253 StringWriter writer = new StringWriter(); 254 TransformerFactory.newInstance().newTransformer().transform(new DOMSource(document), new StreamResult(writer)); 255 incomingData = writer.getBuffer().toString(); 256 Logging.debug("Server response to Capabilities request:"); 257 Logging.debug(incomingData); 258 } catch (TransformerFactoryConfigurationError | TransformerException e) { 259 Logging.warn(e); 260 } 247 261 248 262 // Check if the request resulted in ServiceException
Note:
See TracChangeset
for help on using the changeset viewer.