cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sea...@apache.org
Subject svn commit: r693819 - in /cxf/trunk: common/common/src/main/java/org/apache/cxf/configuration/spring/ common/common/src/main/java/org/apache/cxf/helpers/ common/common/src/main/java/org/apache/cxf/staxutils/ integration/jbi/src/main/java/org/apache/cxf...
Date Wed, 10 Sep 2008 12:44:06 GMT
Author: seanoc
Date: Wed Sep 10 05:44:01 2008
New Revision: 693819

URL: http://svn.apache.org/viewvc?rev=693819&view=rev
Log:
Modified code to remove use of NodeList

Modified:
    cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractFactoryBeanDefinitionParser.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
    cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
    cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultInInterceptor.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java
    cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java
    cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
    cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
    cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
    cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java
    cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
    cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/SchemaWriterImpl.java
    cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/WSDLCorbaWriterImpl.java

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractBeanDefinitionParser.java
Wed Sep 10 05:44:01 2008
@@ -34,7 +34,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.CacheMap;
@@ -110,14 +109,11 @@
     }
     
     protected void parseChildElements(Element element, ParserContext ctx, BeanDefinitionBuilder
bean) {
-        NodeList children = element.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) {
-            Node n = children.item(i);
-            if (n.getNodeType() == Node.ELEMENT_NODE) {
-                String name = n.getLocalName();
-                
-                mapElement(ctx, bean, (Element) n, name);
-            }
+        Element el = DOMUtils.getFirstElement(element);
+        while (el != null) {
+            String name = el.getLocalName();
+            mapElement(ctx, bean, el, name);
+            el = DOMUtils.getNextElement(el);     
         }
     }
 
@@ -209,15 +205,7 @@
     }
 
     protected Element getFirstChild(Element element) {
-        Element first = null;
-        NodeList children = element.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) {
-            Node n = children.item(i);
-            if (n.getNodeType() == Node.ELEMENT_NODE) {
-                first = (Element) n;
-            }
-        }
-        return first;
+        return DOMUtils.getFirstElement(element);
     }
 
     protected void addBusWiringAttribute(BeanDefinitionBuilder bean, BusWiringType type)
{
@@ -239,14 +227,15 @@
                                             String propertyName, 
                                             Class<?> c) {
         Element data = null;
-        NodeList nl = parent.getChildNodes();
-        for (int i = 0; i < nl.getLength(); i++) {
-            Node n = nl.item(i);
-            if (n.getNodeType() == Node.ELEMENT_NODE && name.getLocalPart().equals(n.getLocalName())
-                && name.getNamespaceURI().equals(n.getNamespaceURI())) {
-                data = (Element)n;
+        
+        Node node = parent.getFirstChild();
+        while (node != null) {
+            if (node.getNodeType() == Node.ELEMENT_NODE && name.getLocalPart().equals(node.getLocalName())
+                && name.getNamespaceURI().equals(node.getNamespaceURI())) {
+                data = (Element)node;
                 break;
             }
+            node = node.getNextSibling();
         }
 
         if (data == null) {

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractFactoryBeanDefinitionParser.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractFactoryBeanDefinitionParser.java
(original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/configuration/spring/AbstractFactoryBeanDefinitionParser.java
Wed Sep 10 05:44:01 2008
@@ -23,7 +23,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.xml.ParserContext;
@@ -67,14 +66,13 @@
             addBusWiringAttribute(factoryBean, BusWiringType.PROPERTY);
         }
         
-        NodeList children = element.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) {
-            Node n = children.item(i);
-            if (n.getNodeType() == Node.ELEMENT_NODE) {
-                String name = n.getLocalName();
-               
-                mapElement(ctx, factoryBean, (Element) n, name);
+        Node node = element.getFirstChild();
+        while (node != null) {
+            if (node.getNodeType() == Node.ELEMENT_NODE) {
+                String name = node.getLocalName();
+                mapElement(ctx, factoryBean, (Element) node, name);
             }
+            node = node.getNextSibling();
         }
         
         String id = getIdOrName(element);

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/helpers/XMLUtils.java Wed Sep 10
05:44:01 2008
@@ -316,11 +316,11 @@
         return createTextNode(node.getOwnerDocument(), data);
     }
 
-    public static void removeContents(Node node) {
-        NodeList list = node.getChildNodes();
-        for (int i = 0; i < list.getLength(); i++) {
-            Node entry = list.item(i);
-            node.removeChild(entry);
+    public static void removeContents(Node parent) {     
+        Node node = parent.getFirstChild();
+        while (node != null) {
+            parent.removeChild(node);
+            node = node.getNextSibling();
         }
     }
 

Modified: cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java (original)
+++ cxf/trunk/common/common/src/main/java/org/apache/cxf/staxutils/StaxUtils.java Wed Sep
10 05:44:01 2008
@@ -57,7 +57,6 @@
 import org.w3c.dom.EntityReference;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 import org.w3c.dom.ProcessingInstruction;
 import org.w3c.dom.Text;
 
@@ -443,16 +442,15 @@
         if (writeProlog) {
             writer.writeStartDocument();
         }
-
-        NodeList rootChildren = d.getChildNodes();
-        for (int rcx = 0; rcx < rootChildren.getLength(); rcx++) {
-            Node rootChild = rootChildren.item(rcx);
-            // don't write PIs if we're not writing a prolog.
-            if (writeProlog || rootChild.getNodeType() == Node.ELEMENT_NODE) {
-                writeNode(rootChild, writer, repairing);
+        
+        Node node = d.getFirstChild();
+        while (node != null) {
+            if (writeProlog || node.getNodeType() == Node.ELEMENT_NODE) {
+                writeNode(node, writer, repairing);
             }
+            node = node.getNextSibling();
         }
-
+        
         if (writeProlog) {
             writer.writeEndDocument();
         }

Modified: cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java (original)
+++ cxf/trunk/integration/jbi/src/main/java/org/apache/cxf/jbi/se/CXFServiceUnit.java Wed
Sep 10 05:44:01 2008
@@ -39,8 +39,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
@@ -280,14 +278,15 @@
             return root;
         } 
         
-        NodeList children = root.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) { 
-            Node child = children.item(i);
-            Node found = findNode(child, name);
-            if (found != null) { 
+        Node node = root.getFirstChild();
+        
+        while (node != null) {
+            Node found = findNode(node, name);
+            if (found != null) {
                 return found;
-            } 
-        } 
+            }
+            node = node.getNextSibling();
+        }
         return null;
     } 
     

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultInInterceptor.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultInInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultInInterceptor.java
Wed Sep 10 05:44:01 2008
@@ -30,7 +30,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.binding.corba.CorbaBindingException;
 import org.apache.cxf.binding.corba.CorbaMessage;
@@ -142,13 +141,11 @@
             faultDoc.createElementNS(partInfoName.getNamespaceURI(), partInfoName.getLocalPart());
         
         Element faultDataElement = (Element) faultData.getFirstChild();
-        
-        NodeList nodeList = faultDataElement.getChildNodes();
-       
-        for (int i = 0; i < nodeList.getLength(); i++) { 
-            Node importedFaultData = faultDoc.
-                            importNode(nodeList.item(i), true);
+        Node node = faultDataElement.getFirstChild();
+        while (node != null) {
+            Node importedFaultData = faultDoc.importNode(node, true);
             partElement.appendChild(importedFaultData);
+            node = node.getNextSibling();
         }
         faultElement.appendChild(partElement);
         faultEx.setDetail(faultElement);

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java
Wed Sep 10 05:44:01 2008
@@ -34,7 +34,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.binding.corba.CorbaBindingException;
 import org.apache.cxf.binding.corba.CorbaDestination;
@@ -294,13 +293,14 @@
         Document faultDoc = DOMUtils.createDocument();
         Element faultElement = faultDoc.createElement(exType.getException().getLocalPart());
         faultDoc.appendChild(faultElement);
-       
-        NodeList nodeList = faultDetail.getChildNodes();
         
-        for (int i = 0; i < nodeList.getLength(); i++) { 
-            Node importedFaultData = faultDoc.importNode(nodeList.item(i), true);
+        Node node = faultDetail.getFirstChild();
+        while (node != null) {
+            Node importedFaultData = faultDoc.importNode(node, true);
             faultElement.appendChild(importedFaultData);
+            node = node.getNextSibling();     
         }
+        
         if (LOG.isLoggable(Level.FINE)) {
             LOG.fine("Exception DOM: " + XMLUtils.toString(faultElement));
         }

Modified: cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java
(original)
+++ cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/IriDecoderHelper.java
Wed Sep 10 05:44:01 2008
@@ -32,7 +32,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
@@ -332,10 +331,10 @@
                     root.appendChild(ec);
                 }
             } else {
-                NodeList childNodes = ec.getChildNodes();
-                for (int j = 0; j < childNodes.getLength(); j++) {
-                    Node n = childNodes.item(j);
-                    ec.removeChild(n);
+                Node node = ec.getFirstChild();
+                while (node != null) {
+                    ec.removeChild(node);
+                    node = node.getNextSibling();
                 }
             }
 
@@ -348,29 +347,26 @@
     }
 
     private static Element getIndexedElement(Element e, int i) {
-        NodeList childNodes = e.getChildNodes();
+        Element elem = DOMUtils.getFirstElement(e);
         int elNum = 0;
-        for (int j = 0; j < childNodes.getLength(); j++) {
-            Node n = childNodes.item(j);
-            if (n.getNodeType() == Node.ELEMENT_NODE) {
-                if (i == elNum) {
-                    return (Element) n;
-                }
-                elNum++;
+        while (elem != null) {
+            if (i == elNum) {
+                return elem;
             }
+            elNum++;
+            elem = DOMUtils.getNextElement(elem);
         }
         return null;
     }
 
     private static Element getElement(Element element, QName name) {
-        NodeList childNodes = element.getChildNodes();
-        for (int j = 0; j < childNodes.getLength(); j++) {
-            Node n = childNodes.item(j);
-            if (n.getNodeType() == Node.ELEMENT_NODE
-                && n.getLocalName().equals(name.getLocalPart())
-                && n.getNamespaceURI().equals(name.getNamespaceURI())) {
-                return (Element)n;
+        Element elem = DOMUtils.getFirstElement(element);
+        while (elem != null) {
+            if (elem.getLocalName().equals(name.getLocalPart())
+                && elem.getNamespaceURI().equals(name.getNamespaceURI())) {
+                return elem;
             }
+            elem = DOMUtils.getNextElement(elem);         
         }
         return null;
     }

Modified: cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/interceptor/URIParameterOutInterceptor.java
Wed Sep 10 05:44:01 2008
@@ -21,7 +21,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.binding.http.URIMapper;
 import org.apache.cxf.endpoint.Endpoint;
@@ -89,15 +88,14 @@
                     int locEnd = locPath.indexOf('}', idx1);
                     String name = locPath.substring(idx1 + 1, locEnd);
                     idx1 = locEnd;
-
-                    NodeList childNodes = root.getChildNodes();
-                    for (int i = 0; i < childNodes.getLength(); i++) {
-                        Node n = childNodes.item(i);
-
-                        if (n.getNodeType() == Node.ELEMENT_NODE && name.equals(n.getLocalName()))
{
-                            builder.append(DOMUtils.getContent(n));
+                    
+                    Node node = root.getFirstChild();
+                    while (node != null) {
+                        if (node.getNodeType() == Node.ELEMENT_NODE && name.equals(node.getLocalName()))
{
+                            builder.append(DOMUtils.getContent(node));
                             break;
-                        }
+                        }   
+                        node = node.getNextSibling();
                     }
 
                     start = locEnd + 1;

Modified: cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/jbi/src/main/java/org/apache/cxf/binding/jbi/interceptor/JBIFaultOutInterceptor.java
Wed Sep 10 05:44:01 2008
@@ -24,13 +24,13 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.binding.jbi.JBIConstants;
 import org.apache.cxf.binding.jbi.JBIFault;
 import org.apache.cxf.binding.jbi.JBIMessage;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.NSStack;
 import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
@@ -64,13 +64,10 @@
                 writer.writeEmptyElement("fault");
             } else {
                 Element detail = jbiFault.getDetail();
-                NodeList details = detail.getChildNodes();
-                for (int i = 0; i < details.getLength(); i++) {
-                    if (details.item(i) instanceof Element) {
-                        StaxUtils.writeNode(details.item(i), writer, true);
-                        break;
-                    }
-                }
+                Element elem = DOMUtils.getFirstElement(detail);
+                if (elem != null) {
+                    StaxUtils.writeNode(elem, writer, true);    
+                }              
             }
             writer.writeEndElement();
             writer.flush();

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap11FaultOutInterceptor.java
Wed Sep 10 05:44:01 2008
@@ -29,7 +29,7 @@
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
 
 import org.apache.cxf.binding.soap.Soap11;
 import org.apache.cxf.binding.soap.SoapFault;
@@ -118,10 +118,11 @@
             if (fault.hasDetails()) {
                 Element detail = fault.getDetail();
                 writer.writeStartElement("detail");
-
-                NodeList details = detail.getChildNodes();
-                for (int i = 0; i < details.getLength(); i++) {
-                    StaxUtils.writeNode(details.item(i), writer, true);
+                
+                Node node = detail.getFirstChild();
+                while (node != null) {
+                    StaxUtils.writeNode(node, writer, true);
+                    node = node.getNextSibling();
                 }
 
                 // Details

Modified: cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
(original)
+++ cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/Soap12FaultOutInterceptor.java
Wed Sep 10 05:44:01 2008
@@ -26,7 +26,7 @@
 import javax.xml.stream.XMLStreamWriter;
 
 import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
 
 import org.apache.cxf.binding.soap.SoapFault;
 import org.apache.cxf.binding.soap.SoapMessage;
@@ -95,9 +95,10 @@
                 Element detail = fault.getDetail();
                 writer.writeStartElement(defaultPrefix, "Detail", ns);
 
-                NodeList details = detail.getChildNodes();
-                for (int i = 0; i < details.getLength(); i++) {
-                    StaxUtils.writeNode(details.item(i), writer, true);
+                Node node = detail.getFirstChild();
+                while (node != null) {
+                    StaxUtils.writeNode(node, writer, true);
+                    node = node.getNextSibling();
                 }
 
                 // Details

Modified: cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java
(original)
+++ cxf/trunk/rt/databinding/xmlbeans/src/main/java/org/apache/cxf/xmlbeans/XmlBeansSchemaInitializer.java
Wed Sep 10 05:44:01 2008
@@ -34,8 +34,6 @@
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.xml.sax.InputSource;
 
@@ -43,6 +41,7 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.xmlschema.SchemaCollection;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.helpers.XMLUtils;
 import org.apache.cxf.service.ServiceModelVisitor;
 import org.apache.cxf.service.model.MessagePartInfo;
@@ -127,20 +126,17 @@
             schemaMap.put(file, null);
 
             Document doc = XMLUtils.parse(ins);
-            
-            NodeList nodes = doc.getDocumentElement().getChildNodes();
-            for (int i = 0; i < nodes.getLength(); i++) {
-                Node n = nodes.item(i);
-                if (n instanceof Element) {
-                    Element e = (Element)n;
-                    if (e.getLocalName().equals("import")) {
-                        String loc = e.getAttribute("schemaLocation");
-                        if (!StringUtils.isEmpty(loc)) {
-                            getSchema(sts, loc);
-                        }
+            Element elem = DOMUtils.getFirstElement(doc.getDocumentElement());
+            while (elem != null) {
+                if (elem.getLocalName().equals("import")) {
+                    String loc = elem.getAttribute("schemaLocation");
+                    if (!StringUtils.isEmpty(loc)) {
+                        getSchema(sts, loc);
                     }
-                }
-            }            
+                }                 
+                elem = DOMUtils.getNextElement(elem);
+            }
+                
             XmlSchema schema = dataBinding.addSchemaDocument(serviceInfo,
                                                              schemas, 
                                                              doc, 

Modified: cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
(original)
+++ cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/EndpointDefinitionParser.java
Wed Sep 10 05:44:01 2008
@@ -26,8 +26,6 @@
 import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
@@ -36,6 +34,7 @@
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
 import org.apache.cxf.configuration.spring.BusWiringType;
+import org.apache.cxf.helpers.DOMUtils;
 import org.apache.cxf.jaxws.EndpointImpl;
 import org.springframework.beans.BeansException;
 import org.springframework.beans.FatalBeanException;
@@ -97,29 +96,27 @@
             }
         }
         
-        NodeList children = element.getChildNodes();
-        for (int i = 0; i < children.getLength(); i++) {
-            Node n = children.item(i);
-            if (n.getNodeType() == Node.ELEMENT_NODE) {
-                String name = n.getLocalName();
-                if ("properties".equals(name)) {
-                    Map map = ctx.getDelegate().parseMapElement((Element) n, bean.getBeanDefinition());
-                    bean.addPropertyValue("properties", map);
-                } else if ("binding".equals(name)) {
-                    setFirstChildAsProperty((Element) n, ctx, bean, "bindingConfig");
-                } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
-                    || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
-                    || "features".equals(name) || "schemaLocations".equals(name)
-                    || "handlers".equals(name)) {
-                    List list = ctx.getDelegate().parseListElement((Element) n, bean.getBeanDefinition());
-                    bean.addPropertyValue(name, list);
-                } else if (IMPLEMENTOR.equals(name)) {
-                    ctx.getDelegate()
-                        .parseConstructorArgElement((Element)n, bean.getBeanDefinition());
-                } else {
-                    setFirstChildAsProperty((Element) n, ctx, bean, name);
-                }
+        Element elem = DOMUtils.getFirstElement(element);
+        while (elem != null) {
+            String name = elem.getLocalName();
+            if ("properties".equals(name)) {
+                Map map = ctx.getDelegate().parseMapElement(elem, bean.getBeanDefinition());
+                bean.addPropertyValue("properties", map);
+            } else if ("binding".equals(name)) {
+                setFirstChildAsProperty(elem, ctx, bean, "bindingConfig");
+            } else if ("inInterceptors".equals(name) || "inFaultInterceptors".equals(name)
+                || "outInterceptors".equals(name) || "outFaultInterceptors".equals(name)
+                || "features".equals(name) || "schemaLocations".equals(name)
+                || "handlers".equals(name)) {
+                List list = ctx.getDelegate().parseListElement(elem, bean.getBeanDefinition());
+                bean.addPropertyValue(name, list);
+            } else if (IMPLEMENTOR.equals(name)) {
+                ctx.getDelegate()
+                    .parseConstructorArgElement(elem, bean.getBeanDefinition());
+            } else {
+                setFirstChildAsProperty(elem, ctx, bean, name);
             }
+            elem = DOMUtils.getNextElement(elem);
         }
         if (!isAbstract) {
             bean.setInitMethodName("publish");

Modified: cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
(original)
+++ cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/service/factory/ReflectionServiceFactoryBean.java
Wed Sep 10 05:44:01 2008
@@ -304,7 +304,9 @@
     }
     
     protected void buildServiceFromWSDL(String url) {
-        LOG.info("Creating Service " + getServiceQName() + " from WSDL: " + url);
+        if (LOG.isLoggable(Level.FINE)) {
+            LOG.fine("Creating Service " + getServiceQName() + " from WSDL: " + url);
+        }
         populateFromClass = false;
         WSDLServiceFactory factory = new WSDLServiceFactory(getBus(), url, getServiceQName());
         setService(factory.create());
@@ -323,7 +325,9 @@
     }
 
     protected void buildServiceFromClass() {
-        LOG.info("Creating Service " + getServiceQName() + " from class " + getServiceClass().getName());
+        if (LOG.isLoggable(Level.FINE)) {
+            LOG.fine("Creating Service " + getServiceQName() + " from class " + getServiceClass().getName());
+        }
         populateFromClass = true;
 
         if (Proxy.isProxyClass(this.getServiceClass())) {

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/toolspec/ToolSpec.java
Wed Sep 10 05:44:01 2008
@@ -279,14 +279,15 @@
     public String getAnnotation() {
         String result = null;
         Element element = doc.getDocumentElement();
-        NodeList list = element.getChildNodes();
-
-        for (int i = 0; i < list.getLength(); i++) {
-            if ((list.item(i).getNodeType() == Node.ELEMENT_NODE)
-                && ("annotation".equals(list.item(i).getNodeName()))) {
-                result = list.item(i).getFirstChild().getNodeValue();
+        
+        Node node = element.getFirstChild();
+        while (node != null) {
+            if ((node.getNodeType() == Node.ELEMENT_NODE)
+                && ("annotation".equals(node.getNodeName()))) {
+                result = node.getNodeValue();
                 break;
             }
+            node = node.getNextSibling();
         }
         return result;
     }

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/SchemaWriterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/SchemaWriterImpl.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/SchemaWriterImpl.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/SchemaWriterImpl.java
Wed Sep 10 05:44:01 2008
@@ -35,7 +35,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import com.ibm.wsdl.Constants;
 import com.ibm.wsdl.util.xml.DOM2Writer;
@@ -128,15 +127,16 @@
         }                
         
         pw.print(">");
-        NodeList list = element.getChildNodes();
+        Node node = element.getFirstChild();
         pw.println();
-        for (int i = 0; i < list.getLength(); i++) {
-            Node node = list.item(i);
+        while (node != null) {
             if (node.getNodeType() == Node.ELEMENT_NODE) {
                 printDOMElement((Element) node, pw, indentCount + 2);
                 pw.println();
             }
+            node = node.getNextSibling();
         }
+        
         indent(pw, indentCount);
         if (element.getLocalName().equals("schema")) {
             pw.print("</xs:" + element.getLocalName() + ">");

Modified: cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/WSDLCorbaWriterImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/WSDLCorbaWriterImpl.java?rev=693819&r1=693818&r2=693819&view=diff
==============================================================================
--- cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/WSDLCorbaWriterImpl.java
(original)
+++ cxf/trunk/tools/corba/src/main/java/org/apache/cxf/tools/corba/common/WSDLCorbaWriterImpl.java
Wed Sep 10 05:44:01 2008
@@ -37,7 +37,6 @@
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
 
 import com.ibm.wsdl.Constants;
 import com.ibm.wsdl.util.xml.DOM2Writer;
@@ -173,14 +172,14 @@
             pw.print(" " + attr.getName() + "=\"" + attr.getValue() + "\"");
         }
         pw.print(">");
-        NodeList list = element.getChildNodes();
+        Node node = element.getFirstChild();
         pw.println();
-        for (int i = 0; i < list.getLength(); i++) {
-            Node node = list.item(i);
+        while (node != null) {
             if (node.getNodeType() == Node.ELEMENT_NODE) {
                 printDOMElement((Element) node, pw, indentCount + 2);
                 pw.println();
             }
+            node = node.getNextSibling();
         }
         indent(pw, indentCount);
         pw.print("</" + element.getNodeName() + ">");



Mime
View raw message