Changeset 8287 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2015-04-28T01:11:18+02:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Utils.java
r7894 r8287 50 50 import java.util.zip.ZipInputStream; 51 51 52 import javax.xml.XMLConstants; 53 import javax.xml.parsers.ParserConfigurationException; 54 import javax.xml.parsers.SAXParser; 55 import javax.xml.parsers.SAXParserFactory; 56 52 57 import org.apache.commons.compress.compressors.bzip2.BZip2CompressorInputStream; 53 58 import org.openstreetmap.josm.Main; 54 59 import org.openstreetmap.josm.data.Version; 60 import org.xml.sax.SAXException; 55 61 56 62 /** … … 1164 1170 return null; 1165 1171 } 1172 1173 /** 1174 * Returns a new secure SAX parser, supporting XML namespaces. 1175 * @return a new secure SAX parser, supporting XML namespaces 1176 * @throws ParserConfigurationException if a parser cannot be created which satisfies the requested configuration. 1177 * @throws SAXException for SAX errors. 1178 * @since 8287 1179 */ 1180 public static SAXParser newSafeSAXParser() throws ParserConfigurationException, SAXException { 1181 SAXParserFactory parserFactory = SAXParserFactory.newInstance(); 1182 parserFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); 1183 parserFactory.setNamespaceAware(true); 1184 return parserFactory.newSAXParser(); 1185 } 1166 1186 } -
trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java
r8285 r8287 20 20 import javax.xml.XMLConstants; 21 21 import javax.xml.parsers.ParserConfigurationException; 22 import javax.xml.parsers.SAXParser;23 import javax.xml.parsers.SAXParserFactory;24 22 import javax.xml.transform.stream.StreamSource; 25 23 import javax.xml.validation.Schema; … … 250 248 private Iterable<Object> start(final Reader in, final ContentHandler contentHandler) throws SAXException, IOException { 251 249 try { 252 SAXParserFactory parserFactory = SAXParserFactory.newInstance(); 253 parserFactory.setNamespaceAware(true); 254 SAXParser saxParser = parserFactory.newSAXParser(); 255 XMLReader reader = saxParser.getXMLReader(); 250 XMLReader reader = Utils.newSafeSAXParser().getXMLReader(); 256 251 reader.setContentHandler(contentHandler); 257 252 try {
Note:
See TracChangeset
for help on using the changeset viewer.