Return-Path: Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: (qmail 57172 invoked from network); 5 Jan 2009 15:58:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Jan 2009 15:58:43 -0000 Received: (qmail 64724 invoked by uid 500); 5 Jan 2009 15:58:43 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 64657 invoked by uid 500); 5 Jan 2009 15:58:43 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 64648 invoked by uid 99); 5 Jan 2009 15:58:43 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jan 2009 07:58:43 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Jan 2009 15:58:40 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8E71E2388988; Mon, 5 Jan 2009 07:58:19 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r731604 - in /cxf/trunk: rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ rt/javascript/src/test/java/org/apache/cxf/javascript/ tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/ Date: Mon, 05 Jan 2009 15:58:19 -0000 To: commits@cxf.apache.org From: seanoc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090105155819.8E71E2388988@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: seanoc Date: Mon Jan 5 07:58:18 2009 New Revision: 731604 URL: http://svn.apache.org/viewvc?rev=731604&view=rev Log: Removed more uses of NodeList Modified: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java Modified: cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java?rev=731604&r1=731603&r2=731604&view=diff ============================================================================== --- cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java (original) +++ cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/ReadHeaderInterceptorTest.java Mon Jan 5 07:58:18 2009 @@ -37,6 +37,7 @@ import org.apache.cxf.binding.soap.interceptor.CheckFaultInterceptor; import org.apache.cxf.binding.soap.interceptor.ReadHeadersInterceptor; import org.apache.cxf.headers.Header; +import org.apache.cxf.helpers.DOMUtils; import org.apache.cxf.interceptor.StaxInInterceptor; import org.apache.cxf.message.Attachment; import org.junit.Before; @@ -104,11 +105,10 @@ if (ele.getLocalName().equals("reservation")) { Element reservation = ele; List reservationChilds = new ArrayList(); - for (int j = 0; j < reservation.getChildNodes().getLength(); j++) { - if (reservation.getChildNodes().item(j) instanceof Element) { - Element element = (Element)reservation.getChildNodes().item(j); - reservationChilds.add(element); - } + Element elem = DOMUtils.getFirstElement(reservation); + while (elem != null) { + reservationChilds.add(elem); + elem = DOMUtils.getNextElement(elem); } assertEquals(2, reservationChilds.size()); assertEquals("reference", reservationChilds.get(0).getLocalName()); @@ -122,13 +122,8 @@ if (ele.getLocalName().equals("passenger")) { Element passenger = ele; assertNotNull(passenger); - Element child = null; - for (int j = 0; j < passenger.getChildNodes().getLength(); j++) { - if (passenger.getChildNodes().item(j) instanceof Element) { - child = (Element)passenger.getChildNodes().item(j); - } - } - assertNotNull("passenger should has child element", child); + Element child = DOMUtils.getFirstElement(passenger); + assertNotNull("passenger should have a child element", child); assertEquals("name", child.getLocalName()); assertEquals("Bob", child.getTextContent()); } Modified: cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java URL: http://svn.apache.org/viewvc/cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java?rev=731604&r1=731603&r2=731604&view=diff ============================================================================== --- cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java (original) +++ cxf/trunk/rt/javascript/src/test/java/org/apache/cxf/javascript/JsSimpleDomNode.java Mon Jan 5 07:58:18 2009 @@ -20,6 +20,8 @@ package org.apache.cxf.javascript; import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import java.util.List; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; @@ -38,7 +40,7 @@ private boolean attributesWrapped; private JsSimpleDomNode previousSibling; private JsSimpleDomNode nextSibling; - private JsSimpleDomNode[] children; + private List children; private JsNamedNodeMap attributes; /** @@ -79,8 +81,8 @@ public Object jsGet_firstChild() { establishChildren(); - if (children.length > 0) - return children[0]; + if (children.size() > 0) + return children.get(0); else return null; } @@ -116,13 +118,13 @@ return null; } else { establishChildren(); - return children[0]; // it is, after all, just a convenience feature. + return children.get(0); // it is, after all, just a convenience feature. } } public Object[] jsGet_childNodes() { establishChildren(); - return children; + return children.toArray(); } public Object jsGet_attributes() { @@ -175,23 +177,23 @@ private void establishChildren() { if (!childrenWrapped) { if (wrappedNode.hasChildNodes()) { - children = new JsSimpleDomNode[wrappedNode.getChildNodes().getLength()]; + children = new ArrayList(); Node node = wrappedNode.getFirstChild(); int x = 0; while (node != null) { JsSimpleDomNode prev = null; if (x > 0) { - prev = (JsSimpleDomNode)children[x - 1]; + prev = (JsSimpleDomNode)children.get(x - 1); } - children[x] = newObject(node, prev); + children.add(x, newObject(node, prev)); if (x > 0) { - children[x - 1].setNext(children[x]); + children.get(x - 1).setNext(children.get(x)); } node = node.getNextSibling(); x++; } } else { - children = new JsSimpleDomNode[0]; + children = new ArrayList(); } childrenWrapped = true; } Modified: cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java?rev=731604&r1=731603&r2=731604&view=diff ============================================================================== --- cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java (original) +++ cxf/trunk/tools/wsdlto/frontend/jaxws/src/main/java/org/apache/cxf/tools/wsdlto/frontend/jaxws/customization/CustomizationParser.java Mon Jan 5 07:58:18 2009 @@ -248,11 +248,13 @@ Element childEl = (Element)childNode; if (isJaxbBindingsElement(childEl)) { + NodeList nlist = nodeSelector.queryNodes(schemaNode, childEl.getAttribute("node")); for (int i = 0; i < nlist.getLength(); i++) { Node node = nlist.item(i); copyAllJaxbDeclarations(node, childEl); - } + } + } else { Element cloneNode = (Element)ProcessorUtil.cloneNode(schemaNode.getOwnerDocument(), childEl, true); @@ -270,9 +272,9 @@ childNode = childNode.getNextSibling(); } } - - if (schemaNode.getChildNodes().getLength() > 0) { - schemaNode.insertBefore(annotationNode, schemaNode.getChildNodes().item(0)); + + if (schemaNode.getFirstChild() != null) { + schemaNode.insertBefore(annotationNode, schemaNode.getFirstChild()); } else { schemaNode.appendChild(annotationNode); } @@ -370,13 +372,17 @@ } - for (int i = 0; i < bindings.getChildNodes().getLength(); i++) { - Node childNode = bindings.getChildNodes().item(i); - if (childNode.getNodeType() == Element.ELEMENT_NODE - && childNode.getNamespaceURI().equals(ToolConstants.JAXWS_BINDINGS.getNamespaceURI())) { - childNode.setPrefix("jaxws"); + + + Element element = DOMUtils.getFirstElement(bindings); + while (element != null) { + if (element.getNamespaceURI().equals(ToolConstants.JAXWS_BINDINGS.getNamespaceURI())) { + element.setPrefix("jaxws"); } + element = DOMUtils.getNextElement(element); } + + Node cloneNode = ProcessorUtil.cloneNode(node.getOwnerDocument(), bindings, true); Node firstChild = DOMUtils.getChild(node, "jaxws:bindings");