- Timestamp:
- 2015-04-28T01:11:18+02:00 (10 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/download/PlaceSelection.java
r8285 r8287 46 46 import javax.swing.table.TableCellRenderer; 47 47 import javax.swing.table.TableColumn; 48 import javax.xml.parsers.SAXParserFactory;49 48 50 49 import org.openstreetmap.josm.Main; … … 380 379 InputSource inputSource = new InputSource(reader); 381 380 NameFinderResultParser parser = new NameFinderResultParser(); 382 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, parser);381 Utils.newSafeSAXParser().parse(inputSource, parser); 383 382 this.data = parser.getResult(); 384 383 } -
trunk/src/org/openstreetmap/josm/io/Capabilities.java
r7529 r8287 12 12 13 13 import javax.xml.parsers.ParserConfigurationException; 14 import javax.xml.parsers.SAXParserFactory;15 14 16 15 import org.openstreetmap.josm.Main; 16 import org.openstreetmap.josm.tools.Utils; 17 17 import org.xml.sax.Attributes; 18 18 import org.xml.sax.InputSource; … … 272 272 public static Capabilities parse(InputSource inputSource) throws SAXException, IOException, ParserConfigurationException { 273 273 CapabilitiesParser parser = new CapabilitiesParser(); 274 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, parser);274 Utils.newSafeSAXParser().parse(inputSource, parser); 275 275 return parser.getCapabilities(); 276 276 } -
trunk/src/org/openstreetmap/josm/io/DiffResultProcessor.java
r7658 r8287 14 14 15 15 import javax.xml.parsers.ParserConfigurationException; 16 import javax.xml.parsers.SAXParserFactory;17 16 18 17 import org.openstreetmap.josm.data.osm.Changeset; … … 25 24 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 26 25 import org.openstreetmap.josm.tools.CheckParameterUtil; 26 import org.openstreetmap.josm.tools.Utils; 27 27 import org.openstreetmap.josm.tools.XmlParsingException; 28 28 import org.xml.sax.Attributes; … … 84 84 progressMonitor.beginTask(tr("Parsing response from server...")); 85 85 InputSource inputSource = new InputSource(new StringReader(diffUploadResponse)); 86 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new Parser());86 Utils.newSafeSAXParser().parse(inputSource, new Parser()); 87 87 } catch(XmlParsingException e) { 88 88 throw e; -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r7801 r8287 18 18 19 19 import javax.xml.parsers.ParserConfigurationException; 20 import javax.xml.parsers.SAXParserFactory;21 20 22 21 import org.openstreetmap.josm.Main; … … 30 29 import org.openstreetmap.josm.data.gpx.ImmutableGpxTrack; 31 30 import org.openstreetmap.josm.data.gpx.WayPoint; 31 import org.openstreetmap.josm.tools.Utils; 32 32 import org.xml.sax.Attributes; 33 33 import org.xml.sax.InputSource; … … 542 542 Parser parser = new Parser(); 543 543 try { 544 SAXParserFactory factory = SAXParserFactory.newInstance(); 545 factory.setNamespaceAware(true); 546 factory.newSAXParser().parse(inputSource, parser); 544 Utils.newSafeSAXParser().parse(inputSource, parser); 547 545 return true; 548 546 } catch (SAXException e) { -
trunk/src/org/openstreetmap/josm/io/NoteReader.java
r8285 r8287 11 11 12 12 import javax.xml.parsers.ParserConfigurationException; 13 import javax.xml.parsers.SAXParserFactory;14 13 15 14 import org.openstreetmap.josm.Main; … … 19 18 import org.openstreetmap.josm.data.notes.NoteComment.Action; 20 19 import org.openstreetmap.josm.data.osm.User; 20 import org.openstreetmap.josm.tools.Utils; 21 21 import org.openstreetmap.josm.tools.date.DateUtils; 22 22 import org.xml.sax.Attributes; … … 222 222 DefaultHandler parser = new Parser(); 223 223 try { 224 SAXParserFactory factory = SAXParserFactory.newInstance(); 225 factory.setNamespaceAware(true); 226 factory.newSAXParser().parse(inputSource, parser); 224 Utils.newSafeSAXParser().parse(inputSource, parser); 227 225 } catch (ParserConfigurationException e) { 228 226 Main.error(e); // broken SAXException chaining -
trunk/src/org/openstreetmap/josm/io/OsmChangesetContentParser.java
r7801 r8287 11 11 12 12 import javax.xml.parsers.ParserConfigurationException; 13 import javax.xml.parsers.SAXParserFactory;14 13 15 14 import org.openstreetmap.josm.Main; … … 19 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 20 19 import org.openstreetmap.josm.tools.CheckParameterUtil; 20 import org.openstreetmap.josm.tools.Utils; 21 21 import org.openstreetmap.josm.tools.XmlParsingException; 22 22 import org.xml.sax.Attributes; … … 150 150 progressMonitor.beginTask(""); 151 151 progressMonitor.indeterminateSubTask(tr("Parsing changeset content ...")); 152 SAXParserFactory.newInstance().newSAXParser().parse(source, new Parser());152 Utils.newSafeSAXParser().parse(source, new Parser()); 153 153 } catch(XmlParsingException e) { 154 154 throw e; -
trunk/src/org/openstreetmap/josm/io/OsmChangesetParser.java
r7704 r8287 13 13 14 14 import javax.xml.parsers.ParserConfigurationException; 15 import javax.xml.parsers.SAXParserFactory;16 15 17 16 import org.openstreetmap.josm.data.coor.LatLon; … … 20 19 import org.openstreetmap.josm.data.osm.User; 21 20 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 21 import org.openstreetmap.josm.tools.Utils; 22 22 import org.openstreetmap.josm.tools.XmlParsingException; 23 23 import org.openstreetmap.josm.tools.date.DateUtils; … … 278 278 progressMonitor.indeterminateSubTask(tr("Parsing list of changesets...")); 279 279 InputSource inputSource = new InputSource(new InvalidXmlCharacterFilter(new InputStreamReader(source, StandardCharsets.UTF_8))); 280 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, parser.new Parser());280 Utils.newSafeSAXParser().parse(inputSource, parser.new Parser()); 281 281 return parser.getChangesets(); 282 282 } catch(ParserConfigurationException | SAXException e) { -
trunk/src/org/openstreetmap/josm/io/OsmHistoryReader.java
r7082 r8287 10 10 11 11 import javax.xml.parsers.ParserConfigurationException; 12 import javax.xml.parsers.SAXParserFactory;13 12 14 13 import org.openstreetmap.josm.Main; … … 18 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 19 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 19 import org.openstreetmap.josm.tools.Utils; 20 20 import org.xml.sax.Attributes; 21 21 import org.xml.sax.InputSource; … … 86 86 progressMonitor.beginTask(tr("Parsing OSM history data ...")); 87 87 try { 88 SAXParserFactory.newInstance().newSAXParser().parse(inputSource, new Parser());88 Utils.newSafeSAXParser().parse(inputSource, new Parser()); 89 89 } catch (ParserConfigurationException e) { 90 90 Main.error(e); // broken SAXException chaining -
trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java
r8285 r8287 11 11 12 12 import javax.xml.parsers.ParserConfigurationException; 13 import javax.xml.parsers.SAXParserFactory;14 13 15 14 import org.openstreetmap.josm.Main; … … 21 20 import org.openstreetmap.josm.io.UTFInputStreamReader; 22 21 import org.openstreetmap.josm.tools.LanguageInfo; 22 import org.openstreetmap.josm.tools.Utils; 23 23 import org.xml.sax.Attributes; 24 24 import org.xml.sax.InputSource; … … 49 49 Parser parser = new Parser(); 50 50 try { 51 SAXParserFactory factory = SAXParserFactory.newInstance();52 factory.setNamespaceAware(true);53 51 try (InputStream in = new CachedFile(source) 54 52 .setMaxAge(1*CachedFile.DAYS) … … 56 54 .getInputStream()) { 57 55 InputSource is = new InputSource(UTFInputStreamReader.create(in)); 58 factory.newSAXParser().parse(is, parser);56 Utils.newSafeSAXParser().parse(is, parser); 59 57 return parser.entries; 60 58 } -
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.