1.1 --- a/src/share/jaxws_classes/com/sun/xml/internal/ws/util/DOMUtil.java Thu Apr 04 19:05:24 2013 -0700 1.2 +++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/DOMUtil.java Tue Apr 09 14:51:13 2013 +0100 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -25,32 +25,25 @@ 1.11 1.12 package com.sun.xml.internal.ws.util; 1.13 1.14 -import org.w3c.dom.Document; 1.15 -import org.w3c.dom.NamedNodeMap; 1.16 -import org.w3c.dom.Node; 1.17 -import org.w3c.dom.NodeList; 1.18 -import org.w3c.dom.Element; 1.19 -import org.xml.sax.SAXException; 1.20 +import com.sun.istack.internal.NotNull; 1.21 +import com.sun.istack.internal.Nullable; 1.22 +import com.sun.xml.internal.ws.util.xml.XmlUtil; 1.23 +import org.w3c.dom.*; 1.24 1.25 +import javax.xml.XMLConstants; 1.26 +import javax.xml.namespace.NamespaceContext; 1.27 import javax.xml.parsers.DocumentBuilder; 1.28 import javax.xml.parsers.DocumentBuilderFactory; 1.29 import javax.xml.parsers.FactoryConfigurationError; 1.30 import javax.xml.parsers.ParserConfigurationException; 1.31 import javax.xml.stream.XMLStreamException; 1.32 import javax.xml.stream.XMLStreamWriter; 1.33 -import javax.xml.XMLConstants; 1.34 -import javax.xml.namespace.NamespaceContext; 1.35 -import java.io.IOException; 1.36 -import java.io.InputStream; 1.37 +import java.util.ArrayList; 1.38 import java.util.Iterator; 1.39 import java.util.List; 1.40 -import java.util.ArrayList; 1.41 - 1.42 -import com.sun.istack.internal.NotNull; 1.43 -import com.sun.istack.internal.Nullable; 1.44 1.45 /** 1.46 - * @author: JAXWS Development Team 1.47 + * @author JAXWS Development Team 1.48 */ 1.49 public class DOMUtil { 1.50 1.51 @@ -63,7 +56,7 @@ 1.52 synchronized (DOMUtil.class) { 1.53 if (db == null) { 1.54 try { 1.55 - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 1.56 + DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(); 1.57 dbf.setNamespaceAware(true); 1.58 db = dbf.newDocumentBuilder(); 1.59 } catch (ParserConfigurationException e) { 1.60 @@ -74,28 +67,6 @@ 1.61 } 1.62 } 1.63 1.64 - public static Node createDOMNode(InputStream inputStream) { 1.65 - 1.66 - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); 1.67 - dbf.setNamespaceAware(true); 1.68 - dbf.setValidating(false); 1.69 - try { 1.70 - DocumentBuilder builder = dbf.newDocumentBuilder(); 1.71 - try { 1.72 - return builder.parse(inputStream); 1.73 - } catch (SAXException e) { 1.74 - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. 1.75 - } catch (IOException e) { 1.76 - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. 1.77 - } 1.78 - } catch (ParserConfigurationException pce) { 1.79 - IllegalArgumentException iae = new IllegalArgumentException(pce.getMessage()); 1.80 - iae.initCause(pce); 1.81 - throw iae; 1.82 - } 1.83 - return null; 1.84 - } 1.85 - 1.86 /** 1.87 * Traverses a DOM node and writes out on a streaming writer. 1.88 * 1.89 @@ -112,6 +83,7 @@ 1.90 switch (child.getNodeType()) { 1.91 case Node.PROCESSING_INSTRUCTION_NODE: 1.92 writer.writeProcessingInstruction(child.getNodeValue()); 1.93 + break; 1.94 case Node.DOCUMENT_TYPE_NODE: 1.95 break; 1.96 case Node.CDATA_SECTION_NODE: 1.97 @@ -126,6 +98,7 @@ 1.98 case Node.ELEMENT_NODE: 1.99 serializeNode((Element) child, writer); 1.100 break; 1.101 + default: break; 1.102 } 1.103 } 1.104 } 1.105 @@ -222,8 +195,9 @@ 1.106 for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) { 1.107 if (n.getNodeType() == Node.ELEMENT_NODE) { 1.108 Element c = (Element) n; 1.109 - if (c.getLocalName().equals(local) && c.getNamespaceURI().equals(nsUri)) 1.110 + if (c.getLocalName().equals(local) && c.getNamespaceURI().equals(nsUri)) { 1.111 return c; 1.112 + } 1.113 } 1.114 } 1.115 return null; 1.116 @@ -232,8 +206,11 @@ 1.117 private static 1.118 @NotNull 1.119 String fixNull(@Nullable String s) { 1.120 - if (s == null) return ""; 1.121 - else return s; 1.122 + if (s == null) { 1.123 + return ""; 1.124 + } else { 1.125 + return s; 1.126 + } 1.127 } 1.128 1.129 /**