Return-Path: Delivered-To: apmail-ant-notifications-archive@locus.apache.org Received: (qmail 69778 invoked from network); 20 Feb 2008 20:31:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Feb 2008 20:31:42 -0000 Received: (qmail 67791 invoked by uid 500); 20 Feb 2008 20:31:37 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 67755 invoked by uid 500); 20 Feb 2008 20:31:37 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 67746 invoked by uid 99); 20 Feb 2008 20:31:37 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Feb 2008 12:31:37 -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.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 20 Feb 2008 20:30:55 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3D3B01A9832; Wed, 20 Feb 2008 12:31:16 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r629603 - /ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java Date: Wed, 20 Feb 2008 20:31:15 -0000 To: notifications@ant.apache.org From: maartenc@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080220203116.3D3B01A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: maartenc Date: Wed Feb 20 12:31:13 2008 New Revision: 629603 URL: http://svn.apache.org/viewvc?rev=629603&view=rev Log: Made this class JDK 1.4 compatible Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java Modified: ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java URL: http://svn.apache.org/viewvc/ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java?rev=629603&r1=629602&r2=629603&view=diff ============================================================================== --- ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java (original) +++ ant/ivy/core/trunk/src/java/org/apache/ivy/plugins/parser/m2/PomReader.java Wed Feb 20 12:31:13 2008 @@ -177,7 +177,7 @@ } } - public Iterable/* */ getDependencies() { + public List /* */ getDependencies() { Element dependenciesElement = getFirstChildElement(projectElement, DEPENDENCIES); LinkedList dependencies = new LinkedList(); if (dependenciesElement != null) { @@ -193,7 +193,7 @@ } - public Iterable/* */ getDependencyMgt() { + public List /* */ getDependencyMgt() { Element dependenciesElement = getFirstChildElement(projectElement, DEPENDENCY_MGT); dependenciesElement = getFirstChildElement(dependenciesElement, DEPENDENCIES); LinkedList dependencies = new LinkedList(); @@ -260,7 +260,7 @@ return getFirstChildElement(depElement, OPTIONAL) != null; } - public Iterable/**/ getExcludedModules() { + public List /**/ getExcludedModules() { Element exclusionsElement = getFirstChildElement(depElement, EXCLUSIONS); LinkedList exclusions = new LinkedList(); if (exclusionsElement != null) { @@ -290,7 +290,7 @@ } for (Iterator it = getAllChilds(propsEl).iterator(); it.hasNext();) { Element prop = (Element) it.next(); - pomProperties.put(prop.getNodeName(), prop.getTextContent()); + pomProperties.put(prop.getNodeName(), getTextContent(prop)); } return pomProperties; } @@ -304,18 +304,32 @@ } } - + private static String getTextContent(Element element) { + StringBuffer result = new StringBuffer(); + + NodeList childNodes = element.getChildNodes(); + for (int i = 0; i < childNodes.getLength(); i++) { + Node child = childNodes.item(i); + + switch (child.getNodeType()) { + case Node.CDATA_SECTION_NODE: + case Node.TEXT_NODE: + result.append(child.getNodeValue()); + break; + } + } + + return result.toString(); + } private static String getFirstChildText(Element parentElem, String name) { Element node = getFirstChildElement(parentElem, name); if (node != null) { - node.normalize(); - return node.getTextContent(); + return getTextContent(node); } else { return null; } } - private static Element getFirstChildElement(Element parentElem, String name) { if (parentElem == null) {