@Test public void testStrictSAXParserFactory() throws ParserConfigurationException, SAXException, IOException { thrown.expect(SAXParseException.class); thrown.expectMessage(containsString("DOCTYPE is disallowed")); SafeXml.newStrictSaxParserFactory().newSAXParser().parse(xmlDocument, new DefaultHandler()); }
public static SAXParserFactory newStrictSaxParserFactory() throws SAXException, ParserConfigurationException { SAXParserFactory factory = newSaxParserFactory(); factory.setFeature(APACHE_DISALLOW_DOCTYPE_DECL, true); return factory; }
SafeXml { public static SAXParserFactory newStrictSaxParserFactory() throws SAXException, ParserConfigurationException { SAXParserFactory factory = newSaxParserFactory(); factory.setFeature(APACHE_DISALLOW_DOCTYPE_DECL, true); return factory; } }
SafeXml { public static SAXParserFactory newStrictSaxParserFactory() throws SAXException, ParserConfigurationException { SAXParserFactory factory = newSaxParserFactory(); factory.setFeature(APACHE_DISALLOW_DOCTYPE_DECL, true); return factory; } private  SafeXml(); }
SafeXml { public static SAXParserFactory newStrictSaxParserFactory() throws SAXException, ParserConfigurationException { SAXParserFactory factory = newSaxParserFactory(); factory.setFeature(APACHE_DISALLOW_DOCTYPE_DECL, true); return factory; } private  SafeXml(); static XMLInputFactory newXmlInputFactory(); static DocumentBuilderFactory newdocumentBuilderFactory(); static DocumentBuilderFactory newStrictDocumentBuilderFactory(); static TransformerFactory newTransformerFactory(); static SAXTransformerFactory newSaxTransformerFactory(); static SAXParserFactory newSaxParserFactory(); static SAXParserFactory newStrictSaxParserFactory(); }
SafeXml { public static SAXParserFactory newStrictSaxParserFactory() throws SAXException, ParserConfigurationException { SAXParserFactory factory = newSaxParserFactory(); factory.setFeature(APACHE_DISALLOW_DOCTYPE_DECL, true); return factory; } private  SafeXml(); static XMLInputFactory newXmlInputFactory(); static DocumentBuilderFactory newdocumentBuilderFactory(); static DocumentBuilderFactory newStrictDocumentBuilderFactory(); static TransformerFactory newTransformerFactory(); static SAXTransformerFactory newSaxTransformerFactory(); static SAXParserFactory newSaxParserFactory(); static SAXParserFactory newStrictSaxParserFactory();  }