1 /* |
1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
110 public DOMForest(InternalizationLogic logic, @NotNull EntityResolver entityResolver, WsimportOptions options, ErrorReceiver errReceiver) { |
110 public DOMForest(InternalizationLogic logic, @NotNull EntityResolver entityResolver, WsimportOptions options, ErrorReceiver errReceiver) { |
111 this.options = options; |
111 this.options = options; |
112 this.entityResolver = entityResolver; |
112 this.entityResolver = entityResolver; |
113 this.errorReceiver = errReceiver; |
113 this.errorReceiver = errReceiver; |
114 this.logic = logic; |
114 this.logic = logic; |
115 try { |
115 // secure xml processing can be switched off if input requires it |
116 // secure xml processing can be switched off if input requires it |
116 boolean disableXmlSecurity = options == null ? false : options.disableXmlSecurity; |
117 boolean secureProcessingEnabled = options == null || !options.disableXmlSecurity; |
117 |
118 DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(secureProcessingEnabled); |
118 DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(disableXmlSecurity); |
119 dbf.setNamespaceAware(true); |
119 this.parserFactory = XmlUtil.newSAXParserFactory(disableXmlSecurity); |
|
120 try { |
120 this.documentBuilder = dbf.newDocumentBuilder(); |
121 this.documentBuilder = dbf.newDocumentBuilder(); |
121 |
|
122 this.parserFactory = XmlUtil.newSAXParserFactory(secureProcessingEnabled); |
|
123 this.parserFactory.setNamespaceAware(true); |
|
124 } catch (ParserConfigurationException e) { |
122 } catch (ParserConfigurationException e) { |
125 throw new AssertionError(e); |
123 throw new AssertionError(e); |
126 } |
124 } |
127 } |
125 } |
128 |
126 |