Changeset 5580 in josm


Ignore:
Timestamp:
2012-11-13T22:48:12+01:00 (12 years ago)
Author:
Don-vip
Message:

fix #8191 - Do not load external DTDs when reading (supposed) XML files. When reading W3C XHTML DTD (in case of invalid served XML file), this causes JOSM to hang two minutes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/XmlObjectParser.java

    r5510 r5580  
    3030import org.xml.sax.Locator;
    3131import org.xml.sax.SAXException;
     32import org.xml.sax.SAXNotRecognizedException;
     33import org.xml.sax.SAXNotSupportedException;
    3234import org.xml.sax.SAXParseException;
    3335import org.xml.sax.XMLReader;
     
    292294            XMLReader reader = saxParser.getXMLReader();
    293295            reader.setContentHandler(contentHandler);
     296            try {
     297                // Do not load external DTDs (fix #8191)
     298                reader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
     299            } catch (SAXException e) {
     300                // Exception very unlikely to happen, so no need to translate this
     301                System.err.println("Cannot disable 'load-external-dtd' feature: "+e.getMessage());
     302            }
    294303            reader.parse(new InputSource(in));
    295304            queueIterator = queue.iterator();
Note: See TracChangeset for help on using the changeset viewer.