Changeset 13901 in josm for trunk/src/org/openstreetmap/josm/data
- Timestamp:
- 2018-06-08T22:43:20+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/GetCapabilitiesParseHelper.java
r13828 r13901 9 9 10 10 import javax.xml.namespace.QName; 11 import javax.xml.stream.XMLInputFactory;12 11 import javax.xml.stream.XMLStreamException; 13 12 import javax.xml.stream.XMLStreamReader; 14 13 15 14 import org.openstreetmap.josm.tools.Utils; 15 import org.openstreetmap.josm.tools.XmlUtils; 16 16 17 17 /** … … 82 82 */ 83 83 public static XMLStreamReader getReader(InputStream in) throws XMLStreamException { 84 XMLInputFactory factory = XMLInputFactory.newInstance(); 85 // do not try to load external entities, nor validate the XML 86 factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE); 87 factory.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE); 88 factory.setProperty(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); 89 return factory.createXMLStreamReader(in); 84 return XmlUtils.newSafeXMLInputFactory().createXMLStreamReader(in); 90 85 } 91 86 -
trunk/src/org/openstreetmap/josm/data/preferences/PreferencesReader.java
r13715 r13901 21 21 22 22 import javax.xml.XMLConstants; 23 import javax.xml.stream.XMLInputFactory;24 23 import javax.xml.stream.XMLStreamConstants; 25 24 import javax.xml.stream.XMLStreamException; … … 37 36 import org.openstreetmap.josm.spi.preferences.StringSetting; 38 37 import org.openstreetmap.josm.tools.Logging; 39 import org.openstreetmap.josm.tools. Utils;38 import org.openstreetmap.josm.tools.XmlUtils; 40 39 import org.xml.sax.SAXException; 41 40 … … 97 96 public static void validateXML(Reader in) throws IOException, SAXException { 98 97 try (CachedFile cf = new CachedFile("resource://data/preferences.xsd"); InputStream xsdStream = cf.getInputStream()) { 99 Schema schema = Utils.newXmlSchemaFactory().newSchema(new StreamSource(xsdStream));98 Schema schema = XmlUtils.newXmlSchemaFactory().newSchema(new StreamSource(xsdStream)); 100 99 Validator validator = schema.newValidator(); 101 100 validator.validate(new StreamSource(in)); … … 127 126 public void parse() throws XMLStreamException, IOException { 128 127 if (reader != null) { 129 this.parser = X MLInputFactory.newInstance().createXMLStreamReader(reader);128 this.parser = XmlUtils.newSafeXMLInputFactory().createXMLStreamReader(reader); 130 129 doParse(); 131 130 } else { 132 131 try (BufferedReader in = Files.newBufferedReader(file.toPath(), StandardCharsets.UTF_8)) { 133 this.parser = X MLInputFactory.newInstance().createXMLStreamReader(in);132 this.parser = XmlUtils.newSafeXMLInputFactory().createXMLStreamReader(in); 134 133 doParse(); 135 134 }
Note:
See TracChangeset
for help on using the changeset viewer.