< prev index next >

src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java

Print this page
rev 1143 : 8182054: Improve wsdl support
Summary: Also reviewed by Roman Grigoriadi <roman.grigoriadi@oracle.com>
Reviewed-by: joehw, lancea

*** 1,7 **** /* ! * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 24,42 **** */ package com.sun.tools.internal.ws.wsdl.parser; import com.sun.istack.internal.NotNull; ! import com.sun.tools.internal.ws.resources.WscompileMessages; ! import com.sun.tools.internal.ws.wscompile.AbortException; ! import com.sun.tools.internal.ws.wscompile.DefaultAuthenticator; import com.sun.tools.internal.ws.wscompile.ErrorReceiver; import com.sun.tools.internal.ws.wscompile.WsimportOptions; import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; import com.sun.tools.internal.xjc.reader.internalizer.LocatorTable; import com.sun.xml.internal.bind.marshaller.DataWriter; - import com.sun.xml.internal.ws.util.JAXWSUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.ContentHandler; import org.xml.sax.*; --- 24,39 ---- */ package com.sun.tools.internal.ws.wsdl.parser; import com.sun.istack.internal.NotNull; ! import com.sun.tools.internal.ws.util.xml.XmlUtil; import com.sun.tools.internal.ws.wscompile.ErrorReceiver; import com.sun.tools.internal.ws.wscompile.WsimportOptions; import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; import com.sun.tools.internal.xjc.reader.internalizer.LocatorTable; import com.sun.xml.internal.bind.marshaller.DataWriter; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.ContentHandler; import org.xml.sax.*;
*** 49,61 **** import javax.xml.transform.Transformer; import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.sax.SAXResult; - import javax.net.ssl.HttpsURLConnection; - import javax.net.ssl.HostnameVerifier; - import javax.net.ssl.SSLSession; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.*; --- 46,55 ----
*** 116,132 **** public DOMForest(InternalizationLogic logic, @NotNull EntityResolver entityResolver, WsimportOptions options, ErrorReceiver errReceiver) { this.options = options; this.entityResolver = entityResolver; this.errorReceiver = errReceiver; this.logic = logic; try { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); this.documentBuilder = dbf.newDocumentBuilder(); - - this.parserFactory = SAXParserFactory.newInstance(); - this.parserFactory.setNamespaceAware(true); } catch (ParserConfigurationException e) { throw new AssertionError(e); } } --- 110,126 ---- public DOMForest(InternalizationLogic logic, @NotNull EntityResolver entityResolver, WsimportOptions options, ErrorReceiver errReceiver) { this.options = options; this.entityResolver = entityResolver; this.errorReceiver = errReceiver; this.logic = logic; + // secure xml processing can be switched off if input requires it + boolean disableXmlSecurity = options == null ? false : options.disableXmlSecurity; + + DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(disableXmlSecurity); + this.parserFactory = XmlUtil.newSAXParserFactory(disableXmlSecurity); try { this.documentBuilder = dbf.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new AssertionError(e); } }
*** 366,376 **** * This is a debug method. As such, error handling is sloppy. */ public void dump(OutputStream out) throws IOException { try { // create identity transformer ! Transformer it = TransformerFactory.newInstance().newTransformer(); for (Map.Entry<String, Document> e : core.entrySet()) { out.write(("---<< " + e.getKey() + '\n').getBytes()); DataWriter dw = new DataWriter(new OutputStreamWriter(out), null); --- 360,373 ---- * This is a debug method. As such, error handling is sloppy. */ public void dump(OutputStream out) throws IOException { try { // create identity transformer ! // secure xml processing can be switched off if input requires it ! boolean secureProcessingEnabled = options == null || !options.disableXmlSecurity; ! TransformerFactory tf = XmlUtil.newTransformerFactory(secureProcessingEnabled); ! Transformer it = tf.newTransformer(); for (Map.Entry<String, Document> e : core.entrySet()) { out.write(("---<< " + e.getKey() + '\n').getBytes()); DataWriter dw = new DataWriter(new OutputStreamWriter(out), null);
< prev index next >