Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion xstream/src/java/com/thoughtworks/xstream/io/xml/XomDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@
import java.io.Writer;
import java.net.URL;

import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;

import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;

import com.thoughtworks.xstream.io.HierarchicalStreamReader;
import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
import com.thoughtworks.xstream.io.StreamException;
Expand Down Expand Up @@ -101,7 +107,17 @@ protected Builder getBuilder() {
*/
protected Builder createBuilder() {
final Builder builder = getBuilder();
return builder != null ? builder : new Builder();
if (builder != null) {
return builder;
}
try {
final SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
final XMLReader xmlReader = factory.newSAXParser().getXMLReader();
return new Builder(xmlReader);
} catch (final ParserConfigurationException | SAXException e) {
throw new StreamException(e);
}
}

@Override
Expand Down