1 /* |
1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1997, 2013, 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 |
24 */ |
24 */ |
25 |
25 |
26 package com.sun.tools.internal.ws.wsdl.parser; |
26 package com.sun.tools.internal.ws.wsdl.parser; |
27 |
27 |
28 import com.sun.istack.internal.NotNull; |
28 import com.sun.istack.internal.NotNull; |
29 import com.sun.tools.internal.ws.resources.WscompileMessages; |
29 import com.sun.tools.internal.ws.util.xml.XmlUtil; |
30 import com.sun.tools.internal.ws.wscompile.AbortException; |
|
31 import com.sun.tools.internal.ws.wscompile.DefaultAuthenticator; |
|
32 import com.sun.tools.internal.ws.wscompile.ErrorReceiver; |
30 import com.sun.tools.internal.ws.wscompile.ErrorReceiver; |
33 import com.sun.tools.internal.ws.wscompile.WsimportOptions; |
31 import com.sun.tools.internal.ws.wscompile.WsimportOptions; |
34 import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; |
32 import com.sun.tools.internal.ws.wsdl.document.schema.SchemaConstants; |
35 import com.sun.tools.internal.xjc.reader.internalizer.LocatorTable; |
33 import com.sun.tools.internal.xjc.reader.internalizer.LocatorTable; |
36 import com.sun.xml.internal.bind.marshaller.DataWriter; |
34 import com.sun.xml.internal.bind.marshaller.DataWriter; |
37 import com.sun.xml.internal.ws.util.JAXWSUtils; |
|
38 import org.w3c.dom.Document; |
35 import org.w3c.dom.Document; |
39 import org.w3c.dom.Element; |
36 import org.w3c.dom.Element; |
40 import org.w3c.dom.NodeList; |
37 import org.w3c.dom.NodeList; |
41 import org.xml.sax.ContentHandler; |
38 import org.xml.sax.ContentHandler; |
42 import org.xml.sax.*; |
39 import org.xml.sax.*; |
49 import javax.xml.transform.Transformer; |
46 import javax.xml.transform.Transformer; |
50 import javax.xml.transform.TransformerException; |
47 import javax.xml.transform.TransformerException; |
51 import javax.xml.transform.TransformerFactory; |
48 import javax.xml.transform.TransformerFactory; |
52 import javax.xml.transform.dom.DOMSource; |
49 import javax.xml.transform.dom.DOMSource; |
53 import javax.xml.transform.sax.SAXResult; |
50 import javax.xml.transform.sax.SAXResult; |
54 import javax.net.ssl.HttpsURLConnection; |
|
55 import javax.net.ssl.HostnameVerifier; |
|
56 import javax.net.ssl.SSLSession; |
|
57 import java.io.IOException; |
51 import java.io.IOException; |
58 import java.io.InputStream; |
52 import java.io.InputStream; |
59 import java.io.OutputStream; |
53 import java.io.OutputStream; |
60 import java.io.OutputStreamWriter; |
54 import java.io.OutputStreamWriter; |
61 import java.net.*; |
55 import java.net.*; |
117 this.options = options; |
111 this.options = options; |
118 this.entityResolver = entityResolver; |
112 this.entityResolver = entityResolver; |
119 this.errorReceiver = errReceiver; |
113 this.errorReceiver = errReceiver; |
120 this.logic = logic; |
114 this.logic = logic; |
121 try { |
115 try { |
122 DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); |
116 // secure xml processing can be switched off if input requires it |
|
117 boolean secureProcessingEnabled = options == null || !options.disableSecureXmlProcessing; |
|
118 DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(secureProcessingEnabled); |
123 dbf.setNamespaceAware(true); |
119 dbf.setNamespaceAware(true); |
124 this.documentBuilder = dbf.newDocumentBuilder(); |
120 this.documentBuilder = dbf.newDocumentBuilder(); |
125 |
121 |
126 this.parserFactory = SAXParserFactory.newInstance(); |
122 this.parserFactory = XmlUtil.newSAXParserFactory(secureProcessingEnabled); |
127 this.parserFactory.setNamespaceAware(true); |
123 this.parserFactory.setNamespaceAware(true); |
128 } catch (ParserConfigurationException e) { |
124 } catch (ParserConfigurationException e) { |
129 throw new AssertionError(e); |
125 throw new AssertionError(e); |
130 } |
126 } |
131 } |
127 } |
366 * This is a debug method. As such, error handling is sloppy. |
362 * This is a debug method. As such, error handling is sloppy. |
367 */ |
363 */ |
368 public void dump(OutputStream out) throws IOException { |
364 public void dump(OutputStream out) throws IOException { |
369 try { |
365 try { |
370 // create identity transformer |
366 // create identity transformer |
371 Transformer it = TransformerFactory.newInstance().newTransformer(); |
367 // secure xml processing can be switched off if input requires it |
|
368 boolean secureProcessingEnabled = options == null || !options.disableSecureXmlProcessing; |
|
369 TransformerFactory tf = XmlUtil.newTransformerFactory(secureProcessingEnabled); |
|
370 Transformer it = tf.newTransformer(); |
372 |
371 |
373 for (Map.Entry<String, Document> e : core.entrySet()) { |
372 for (Map.Entry<String, Document> e : core.entrySet()) { |
374 out.write(("---<< " + e.getKey() + '\n').getBytes()); |
373 out.write(("---<< " + e.getKey() + '\n').getBytes()); |
375 |
374 |
376 DataWriter dw = new DataWriter(new OutputStreamWriter(out), null); |
375 DataWriter dw = new DataWriter(new OutputStreamWriter(out), null); |