Changeset 5635 in josm for trunk/src/org
- Timestamp:
- 2012-12-27T00:48:51+01:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/OsmApi.java
r5587 r5635 25 25 import java.util.HashMap; 26 26 27 import javax.xml.parsers.ParserConfigurationException; 27 28 import javax.xml.parsers.SAXParserFactory; 28 29 … … 40 41 import org.xml.sax.InputSource; 41 42 import org.xml.sax.SAXException; 43 import org.xml.sax.SAXParseException; 42 44 import org.xml.sax.helpers.DefaultHandler; 43 45 … … 216 218 cancel = false; 217 219 try { 218 String s = new CapabilitiesCache(monitor, fastFail).updateIfRequiredString(); 219 InputSource inputSource = new InputSource(new StringReader(s)); 220 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new CapabilitiesParser()); 220 CapabilitiesCache cache = new CapabilitiesCache(monitor, fastFail); 221 try { 222 initializeCapabilities(cache.updateIfRequiredString()); 223 } catch (SAXParseException parseException) { 224 // XML parsing may fail if JOSM previously stored a corrupted capabilities document (see #8278) 225 // In that case, force update and try again 226 initializeCapabilities(cache.updateForceString()); 227 } 221 228 if (capabilities.supportsVersion("0.6")) { 222 229 version = "0.6"; … … 261 268 throw new OsmApiInitializationException(e); 262 269 } 270 } 271 272 private void initializeCapabilities(String xml) throws SAXException, IOException, ParserConfigurationException { 273 InputSource inputSource = new InputSource(new StringReader(xml)); 274 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new CapabilitiesParser()); 263 275 } 264 276
Note:
See TracChangeset
for help on using the changeset viewer.