5454import javax .xml .validation .SchemaFactory ;
5555import javax .xml .validation .Validator ;
5656import org .geotools .util .logging .Logging ;
57+ import org .geotools .xml .XMLUtils ;
5758import org .geowebcache .GeoWebCacheEnvironment ;
5859import org .geowebcache .GeoWebCacheException ;
5960import org .geowebcache .GeoWebCacheExtensions ;
@@ -616,7 +617,7 @@ static Node loadDocument(InputStream xmlFile) throws ConfigurationException, IOE
616617 try {
617618 DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory .newInstance ();
618619 docBuilderFactory .setNamespaceAware (true );
619- DocumentBuilder docBuilder = docBuilderFactory .newDocumentBuilder ();
620+ DocumentBuilder docBuilder = XMLUtils .newDocumentBuilder (docBuilderFactory );
620621 topNode = checkAndTransform (docBuilder .parse (xmlFile ));
621622 } catch (Exception e ) {
622623 throw (IOException ) new IOException (e .getMessage ()).initCause (e );
@@ -758,7 +759,7 @@ static String getCurrentSchemaVersion() {
758759
759760 Document dom ;
760761 try (InputStream is = XMLConfiguration .class .getResourceAsStream ("geowebcache.xsd" )) {
761- dom = DocumentBuilderFactory . newInstance () .newDocumentBuilder ().parse (is );
762+ dom = XMLUtils .newDocumentBuilder ().parse (is );
762763 } catch (Exception e ) {
763764 throw new RuntimeException (e );
764765 }
@@ -777,7 +778,7 @@ private static Node applyTransform(Node oldRootNode, String xslFilename) {
777778 try (InputStream is = XMLConfiguration .class .getResourceAsStream (xslFilename )) {
778779
779780 try {
780- transformer = TransformerFactory . newInstance () .newTransformer (new StreamSource (is ));
781+ transformer = XMLUtils .newTransformer (new StreamSource (is ));
781782 transformer .transform (new DOMSource (oldRootNode ), result );
782783 } catch (TransformerFactoryConfigurationError | TransformerException e ) {
783784 log .log (Level .FINE , e .getMessage (), e );
0 commit comments