Return-Path: Delivered-To: apmail-ode-commits-archive@www.apache.org Received: (qmail 43557 invoked from network); 6 Oct 2007 23:26:57 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Oct 2007 23:26:57 -0000 Received: (qmail 34816 invoked by uid 500); 6 Oct 2007 23:26:46 -0000 Delivered-To: apmail-ode-commits-archive@ode.apache.org Received: (qmail 34807 invoked by uid 500); 6 Oct 2007 23:26:46 -0000 Mailing-List: contact commits-help@ode.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ode.apache.org Delivered-To: mailing list commits@ode.apache.org Received: (qmail 34798 invoked by uid 99); 6 Oct 2007 23:26:45 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Oct 2007 16:26:45 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 06 Oct 2007 23:26:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id D7E6D1A9832; Sat, 6 Oct 2007 16:25:58 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r582554 - /ode/trunk/utils/src/main/java/org/apache/ode/utils/DOMUtils.java Date: Sat, 06 Oct 2007 23:25:58 -0000 To: commits@ode.apache.org From: vanto@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071006232558.D7E6D1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: vanto Date: Sat Oct 6 16:25:55 2007 New Revision: 582554 URL: http://svn.apache.org/viewvc?rev=582554&view=rev Log: fixing NPE in getParentNamespace() Modified: ode/trunk/utils/src/main/java/org/apache/ode/utils/DOMUtils.java Modified: ode/trunk/utils/src/main/java/org/apache/ode/utils/DOMUtils.java URL: http://svn.apache.org/viewvc/ode/trunk/utils/src/main/java/org/apache/ode/utils/DOMUtils.java?rev=582554&r1=582553&r2=582554&view=diff ============================================================================== --- ode/trunk/utils/src/main/java/org/apache/ode/utils/DOMUtils.java (original) +++ ode/trunk/utils/src/main/java/org/apache/ode/utils/DOMUtils.java Sat Oct 6 16:25:55 2007 @@ -335,24 +335,26 @@ HashMap pref = new HashMap(); Map mine = getMyNamespaces(el); Node n = el.getParentNode(); - do { - if (n instanceof Element) { - Element l = (Element) n; - NamedNodeMap nnm = l.getAttributes(); - int len = nnm.getLength(); - for (int i = 0; i < len; ++i) { - Attr a = (Attr) nnm.item(i); - if (isNSAttribute(a)) { - String key = getNSPrefixFromNSAttr(a); - String uri = a.getValue(); - // prefer prefix bindings that are lower down in the tree. - if (pref.containsKey(key) || mine.containsKey(key)) continue; - pref.put(key, uri); - } - } - } - n = n.getParentNode(); - } while (n != null && n.getNodeType() != Node.DOCUMENT_NODE); + if (n != null) { + do { + if (n instanceof Element) { + Element l = (Element) n; + NamedNodeMap nnm = l.getAttributes(); + int len = nnm.getLength(); + for (int i = 0; i < len; ++i) { + Attr a = (Attr) nnm.item(i); + if (isNSAttribute(a)) { + String key = getNSPrefixFromNSAttr(a); + String uri = a.getValue(); + // prefer prefix bindings that are lower down in the tree. + if (pref.containsKey(key) || mine.containsKey(key)) continue; + pref.put(key, uri); + } + } + } + n = n.getParentNode(); + } while (n != null && n.getNodeType() != Node.DOCUMENT_NODE); + } return pref; }