From c01c25cf0a3e07be0e35914f257c305d10075618 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Tue, 17 Mar 2009 17:03:45 +0000 Subject: [PATCH] clean warnings in xml tools module git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755323 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/xml/ElementTextListClosure.java | 4 ++-- .../maven/archiva/xml/LatinEntities.java | 4 ++-- .../apache/maven/archiva/xml/XMLReader.java | 2 ++ .../maven/archiva/xml/XMLReaderTest.java | 20 +++++++++---------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/ElementTextListClosure.java b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/ElementTextListClosure.java index 9d4c0e4f3..d3b8a4099 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/ElementTextListClosure.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/ElementTextListClosure.java @@ -33,7 +33,7 @@ import java.util.List; public class ElementTextListClosure implements Closure { - private List list = new ArrayList(); + private List list = new ArrayList(); public void execute( Object input ) { @@ -44,7 +44,7 @@ public class ElementTextListClosure } } - public List getList() + public List getList() { return list; } diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java index d4013f161..b14ee4173 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/LatinEntities.java @@ -29,11 +29,11 @@ import java.util.Map; */ public class LatinEntities { - private static final Map defaultEntityMap; + private static final Map defaultEntityMap; static { - defaultEntityMap = new HashMap(); + defaultEntityMap = new HashMap(); defaultEntityMap.put( "nbsp", "\u00a0" ); defaultEntityMap.put( "iexcl", "\u00a1" ); diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java index 759519e13..4e230e92d 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/maven/archiva/xml/XMLReader.java @@ -204,6 +204,7 @@ public class XMLReader /** * Remove namespaces from element recursively. */ + @SuppressWarnings("unchecked") public void removeNamespaces( Element elem ) { elem.setQName( QName.get( elem.getName(), Namespace.NO_NAMESPACE, elem.getQualifiedName() ) ); @@ -275,6 +276,7 @@ public class XMLReader } } + @SuppressWarnings("unchecked") public List getElementList( String xpathExpr ) throws XMLException { diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java index 719352f2d..1fb12fba8 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/test/java/org/apache/maven/archiva/xml/XMLReaderTest.java @@ -19,13 +19,12 @@ package org.apache.maven.archiva.xml; * under the License. */ -import org.dom4j.Element; - import java.io.File; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; +import org.dom4j.Element; + /** * XMLReaderTest * @@ -34,14 +33,13 @@ import java.util.List; public class XMLReaderTest extends AbstractArchivaXmlTestCase { - private void assertElementTexts( List elementList, String[] expectedTexts ) + private void assertElementTexts( List elementList, String[] expectedTexts ) { assertEquals( "Element List Size", expectedTexts.length, elementList.size() ); - List texts = new ArrayList(); - for ( Iterator iter = elementList.iterator(); iter.hasNext(); ) + List texts = new ArrayList(); + for ( Element element : elementList ) { - Element element = (Element) iter.next(); texts.add( element.getTextTrim() ); } @@ -58,7 +56,7 @@ public class XMLReaderTest File xmlFile = getExampleXml( "no-prolog-basic.xml" ); XMLReader reader = new XMLReader( "basic", xmlFile ); - List fruits = reader.getElementList( "//basic/fruits/fruit" ); + List fruits = reader.getElementList( "//basic/fruits/fruit" ); assertElementTexts( fruits, new String[] { "apple", "cherry", "pear", "peach" } ); } @@ -68,7 +66,7 @@ public class XMLReaderTest File xmlFile = getExampleXml( "no-prolog-with-entities.xml" ); XMLReader reader = new XMLReader( "basic", xmlFile ); - List names = reader.getElementList( "//basic/names/name" ); + List names = reader.getElementList( "//basic/names/name" ); assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } ); } @@ -78,7 +76,7 @@ public class XMLReaderTest File xmlFile = getExampleXml( "no-prolog-with-utf8.xml" ); XMLReader reader = new XMLReader( "basic", xmlFile ); - List names = reader.getElementList( "//basic/names/name" ); + List names = reader.getElementList( "//basic/names/name" ); assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } ); } @@ -88,7 +86,7 @@ public class XMLReaderTest File xmlFile = getExampleXml( "prolog-with-utf8.xml" ); XMLReader reader = new XMLReader( "basic", xmlFile ); - List names = reader.getElementList( "//basic/names/name" ); + List names = reader.getElementList( "//basic/names/name" ); assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } ); }