You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/02/28 21:23:57 UTC

svn commit: r1075515 - in /commons/sandbox/digester3/trunk/src: main/java/org/apache/commons/digester3/ main/java/org/apache/commons/digester3/internal/ test/java/org/apache/commons/digester3/ test/java/org/apache/commons/digester3/substitution/

Author: simonetripodi
Date: Mon Feb 28 20:23:56 2011
New Revision: 1075515

URL: http://svn.apache.org/viewvc?rev=1075515&view=rev
Log:
no more Digester parse result cast, the compiler automatically does it, thanks Matt Benson!!!

Modified:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Digester.java
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/DigesterImpl.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/AbstractTestCase.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/CallMethodRuleTestCase.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespaceSnapshotTestCase.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetNestedPropertiesRuleTestCase.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertyRuleTestCase.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XIncludeTestCase.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XMLSchemaTestCase.java
    commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/substitution/VariableExpansionTestCase.java

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Digester.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Digester.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Digester.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Digester.java Mon Feb 28 20:23:56 2011
@@ -81,7 +81,7 @@ public interface Digester extends Conten
      * @exception IOException if an input/output error occurs
      * @exception SAXException if a parsing exception occurs
      */
-    Object parse(File file) throws IOException, SAXException;
+    <T> T parse(File file) throws IOException, SAXException;
 
     /**
      * Parse the content of the specified input source using this Digester.
@@ -92,7 +92,7 @@ public interface Digester extends Conten
      * @exception IOException if an input/output error occurs
      * @exception SAXException if a parsing exception occurs
      */
-    Object parse(InputSource input) throws IOException, SAXException;
+    <T> T parse(InputSource input) throws IOException, SAXException;
 
     /**
      * Parse the content of the specified input stream using this Digester.
@@ -103,7 +103,7 @@ public interface Digester extends Conten
      * @exception IOException if an input/output error occurs
      * @exception SAXException if a parsing exception occurs
      */
-    Object parse(InputStream input) throws IOException, SAXException;
+    <T> T parse(InputStream input) throws IOException, SAXException;
 
     /**
      * Parse the content of the specified reader using this Digester.
@@ -114,7 +114,7 @@ public interface Digester extends Conten
      * @exception IOException if an input/output error occurs
      * @exception SAXException if a parsing exception occurs
      */
-    Object parse(Reader reader) throws IOException, SAXException;
+    <T> T parse(Reader reader) throws IOException, SAXException;
 
     /**
      * Parse the content of the specified URI using this Digester.
@@ -125,7 +125,7 @@ public interface Digester extends Conten
      * @exception IOException if an input/output error occurs
      * @exception SAXException if a parsing exception occurs
      */
-    Object parse(String uri) throws IOException, SAXException;
+    <T> T parse(String uri) throws IOException, SAXException;
 
     /**
      * Parse the content of the specified URL using this Digester.
@@ -136,7 +136,7 @@ public interface Digester extends Conten
      * @exception IOException if an input/output error occurs
      * @exception SAXException if a parsing exception occurs
      */
-    Object parse(URL url) throws IOException, SAXException;
+    <T> T parse(URL url) throws IOException, SAXException;
 
     /**
      * Return the <code>Rules</code> implementation object containing our

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/DigesterImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/DigesterImpl.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/DigesterImpl.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/DigesterImpl.java Mon Feb 28 20:23:56 2011
@@ -1026,14 +1026,15 @@ public final class DigesterImpl implemen
     /**
      * {@inheritDoc}
      */
-    public Object parse(File file) throws IOException, SAXException {
-        return this.parse(createInputSourceFromFile(file));
+    public <T> T parse(File file) throws IOException, SAXException {
+        return this.<T>parse(createInputSourceFromFile(file));
     }
 
     /**
      * {@inheritDoc}
      */
-    public Object parse(InputSource input) throws IOException, SAXException {
+    @SuppressWarnings("unchecked")
+    public <T> T parse(InputSource input) throws IOException, SAXException {
         if (input == null) {
             throw new IllegalArgumentException("InputSource to parse must be not null");
         }
@@ -1042,7 +1043,11 @@ public final class DigesterImpl implemen
 
         try {
             this.reader.parse(input);
-            return this.root;
+
+            if (this.root == null) {
+                return null;
+            }
+            return (T) this.root;
         } finally {
             this.cleanup();
         }
@@ -1051,29 +1056,29 @@ public final class DigesterImpl implemen
     /**
      * {@inheritDoc}
      */
-    public Object parse(InputStream input) throws IOException, SAXException {
-        return this.parse(createInputSourceFromInputStream(input));
+    public <T> T parse(InputStream input) throws IOException, SAXException {
+        return this.<T>parse(createInputSourceFromInputStream(input));
     }
 
     /**
      * {@inheritDoc}
      */
-    public Object parse(Reader reader) throws IOException, SAXException {
-        return this.parse(createInputSourceFromReader(reader));
+    public <T> T parse(Reader reader) throws IOException, SAXException {
+        return this.<T>parse(createInputSourceFromReader(reader));
     }
 
     /**
      * {@inheritDoc}
      */
-    public Object parse(String uri) throws IOException, SAXException {
-        return this.parse(createInputSourceFromUri(uri));
+    public <T> T parse(String uri) throws IOException, SAXException {
+        return this.<T>parse(createInputSourceFromUri(uri));
     }
 
     /**
      * {@inheritDoc}
      */
-    public Object parse(URL url) throws IOException, SAXException {
-        return this.parse(createInputSourceFromURL(url));
+    public <T> T parse(URL url) throws IOException, SAXException {
+        return this.<T>parse(createInputSourceFromURL(url));
     }
 
     /**

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/AbstractTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/AbstractTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/AbstractTestCase.java Mon Feb 28 20:23:56 2011
@@ -58,8 +58,8 @@ public abstract class AbstractTestCase {
      * @return
      * @throws Throwable
      */
-    protected Object newBasicDigesterAndParse(String xmlResourceName, RulesModule...rulesModules) throws Throwable {
-        return this.newBasicDigester(rulesModules).parse(getInputStream(xmlResourceName));
+    protected <T> T newBasicDigesterAndParse(String xmlResourceName, RulesModule...rulesModules) throws Throwable {
+        return this.newBasicDigester(rulesModules).<T>parse(getInputStream(xmlResourceName));
     }
 
 }

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java Mon Feb 28 20:23:56 2011
@@ -195,7 +195,7 @@ public class BeanPropertySetterRuleTestC
      */
     @Test
     public void testSetGivenProperty() throws SAXException, IOException {
-        SimpleTestBean bean = (SimpleTestBean) newBasicDigester(new AbstractRulesModule() {
+        SimpleTestBean bean = newBasicDigester(new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -234,7 +234,7 @@ public class BeanPropertySetterRuleTestC
     public void testSetUnknownProperty() {
         // Attempt to parse the input
         try {
-            SimpleTestBean bean = (SimpleTestBean) newBasicDigester(new AbstractRulesModule() {
+            SimpleTestBean bean = newBasicDigester(new AbstractRulesModule() {
 
                 @Override
                 protected void configure() {
@@ -263,7 +263,7 @@ public class BeanPropertySetterRuleTestC
      */
     @Test
     public void testAutomaticallySetProperties() throws SAXException, IOException {
-        SimpleTestBean bean = (SimpleTestBean) newLoader(new AbstractRulesModule() {
+        SimpleTestBean bean = newLoader(new AbstractRulesModule() {
 
             @Override
             protected void configure() {

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/CallMethodRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/CallMethodRuleTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/CallMethodRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/CallMethodRuleTestCase.java Mon Feb 28 20:23:56 2011
@@ -71,7 +71,7 @@ public class CallMethodRuleTestCase exte
      */
     @Test
     public void testCallMethodOnly() throws Throwable {
-        Employee employee = (Employee) newBasicDigesterAndParse("Test9.xml", new AbstractRulesModule() {
+        Employee employee = newBasicDigesterAndParse("Test9.xml", new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -97,7 +97,7 @@ public class CallMethodRuleTestCase exte
      */
     @Test
     public void testSetLastNameProperty() throws Throwable {
-        Employee employee = (Employee) newBasicDigesterAndParse("Test5.xml", new AbstractRulesModule() {
+        Employee employee = newBasicDigesterAndParse("Test5.xml", new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -114,7 +114,7 @@ public class CallMethodRuleTestCase exte
 
     @Test
     public void testSetAgeProperty() throws Throwable {
-        Employee employee = (Employee) newBasicDigesterAndParse("Test5.xml", new AbstractRulesModule() {
+        Employee employee = newBasicDigesterAndParse("Test5.xml", new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -131,7 +131,7 @@ public class CallMethodRuleTestCase exte
 
     @Test
     public void testSetActiveProperty() throws Throwable {
-        Employee employee = (Employee) newBasicDigesterAndParse("Test5.xml", new AbstractRulesModule() {
+        Employee employee = newBasicDigesterAndParse("Test5.xml", new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -149,7 +149,7 @@ public class CallMethodRuleTestCase exte
 
     @Test
     public void testSetSalaryProperty() throws Throwable {
-        Employee employee = (Employee) newBasicDigesterAndParse("Test5.xml", new AbstractRulesModule() {
+        Employee employee = newBasicDigesterAndParse("Test5.xml", new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -179,7 +179,7 @@ public class CallMethodRuleTestCase exte
             append("  <value name='The value'/>").
             append("</map>");
 
-        HashMap<AlphaBean, BetaBean> map = (HashMap<AlphaBean, BetaBean>) newBasicDigester(new AbstractRulesModule() {
+        HashMap<AlphaBean, BetaBean> map = newBasicDigester(new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -225,7 +225,7 @@ public class CallMethodRuleTestCase exte
         NamedBean root1 = null;
         try {
             // an exception will be thrown if the method can't be found
-            root1 = (NamedBean) newBasicDigesterAndParse("Test8.xml", new AbstractRulesModule() {
+            root1 = newBasicDigesterAndParse("Test8.xml", new AbstractRulesModule() {
 
                 @Override
                 protected void configure() {
@@ -653,7 +653,7 @@ public class CallMethodRuleTestCase exte
 
         });
 
-        HashMap<String, Address> map = (HashMap<String, Address>) digester.parse(getInputStream("Test5.xml"));
+        HashMap<String, Address> map = digester.parse(getInputStream("Test5.xml"));
 
         assertNotNull(map);
         Set<String> keys = map.keySet();
@@ -690,7 +690,7 @@ public class CallMethodRuleTestCase exte
 
         });
 
-        HashMap<String, Address> map = (HashMap<String, Address>) digester.parse(getInputStream("Test5.xml"));
+        HashMap<String, Address> map = digester.parse(getInputStream("Test5.xml"));
 
         assertNotNull(map);
         Set<String> keys = map.keySet();

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespaceSnapshotTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespaceSnapshotTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespaceSnapshotTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespaceSnapshotTestCase.java Mon Feb 28 20:23:56 2011
@@ -77,10 +77,9 @@ public class NamespaceSnapshotTestCase e
         .setNamespaceAware(true)
         .newDigester();
 
-        Object result = digester.parse(getInputStream("Test11.xml"));
-        assertNotNull(result);
+        NamespacedBox root = digester.parse(getInputStream("Test11.xml"));
+        assertNotNull(root);
 
-        NamespacedBox root = (NamespacedBox) result;
         Map<String, String> nsmap = root.getNamespaces();
         assertEquals(3, nsmap.size());
         assertEquals("", nsmap.get(""));

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetNestedPropertiesRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetNestedPropertiesRuleTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetNestedPropertiesRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetNestedPropertiesRuleTestCase.java Mon Feb 28 20:23:56 2011
@@ -54,7 +54,7 @@ public class SetNestedPropertiesRuleTest
      */
     @Test
     public void testAutomaticallySetProperties() throws SAXException, IOException {
-        SimpleTestBean bean = (SimpleTestBean) newBasicDigester(new AbstractRulesModule() {
+        SimpleTestBean bean = newBasicDigester(new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -101,7 +101,7 @@ public class SetNestedPropertiesRuleTest
             "</root>";
 
         try {
-            SimpleTestBean bean = (SimpleTestBean) newBasicDigester(new AbstractRulesModule() {
+            SimpleTestBean bean = newBasicDigester(new AbstractRulesModule() {
 
                 @Override
                 protected void configure() {
@@ -157,7 +157,7 @@ public class SetNestedPropertiesRuleTest
 
         });
 
-        SimpleTestBean bean = (SimpleTestBean) digester.parse(new StringReader(TEST_XML));
+        SimpleTestBean bean = digester.parse(new StringReader(TEST_XML));
 
         // check properties are set correctly
         assertEquals(
@@ -211,7 +211,7 @@ public class SetNestedPropertiesRuleTest
 
         });
 
-        SimpleTestBean bean = (SimpleTestBean) digester.parse(new StringReader(TEST_XML));
+        SimpleTestBean bean = digester.parse(new StringReader(TEST_XML));
 
         // check properties are set correctly
         assertEquals(
@@ -268,7 +268,7 @@ public class SetNestedPropertiesRuleTest
 
         });
 
-        SimpleTestBean bean = (SimpleTestBean) digester.parse(new StringReader(TEST_XML));
+        SimpleTestBean bean = digester.parse(new StringReader(TEST_XML));
 
         // check properties are set correctly
         assertEquals(
@@ -338,7 +338,7 @@ public class SetNestedPropertiesRuleTest
 
         });
 
-        SimpleTestBean bean = (SimpleTestBean) digester.parse(reader);
+        SimpleTestBean bean = digester.parse(reader);
 
         assertNotNull("No object created", bean);
 
@@ -398,7 +398,7 @@ public class SetNestedPropertiesRuleTest
         });
 
         try {
-            SimpleTestBean bean = (SimpleTestBean) digester.parse(reader);
+            SimpleTestBean bean = digester.parse(reader);
             fail("Expected to generate an exception.");
             assertNotNull(bean); // just to prevent compiler warning on unused var
         } catch(SAXException e) {
@@ -439,7 +439,7 @@ public class SetNestedPropertiesRuleTest
 
         });
 
-        SimpleTestBean bean = (SimpleTestBean) digester.parse(reader);
+        SimpleTestBean bean = digester.parse(reader);
         assertNotNull(bean);
     }
 
@@ -474,7 +474,7 @@ public class SetNestedPropertiesRuleTest
 
         });
 
-        SimpleTestBean bean = (SimpleTestBean) digester.parse(reader);
+        SimpleTestBean bean = digester.parse(reader);
         assertNotNull(bean);
     }
 

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java Mon Feb 28 20:23:56 2011
@@ -57,7 +57,7 @@ public class SetPropertiesRuleTestCase e
     @Test
     public void testPositive() throws Exception {
         // Parse the input
-        SimpleTestBean bean = (SimpleTestBean) newBasicDigester(new AbstractRulesModule() {
+        SimpleTestBean bean = newBasicDigester(new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -89,7 +89,7 @@ public class SetPropertiesRuleTestCase e
     @Test
     public void testIgnoreMissing() throws Exception {
         // Parse the input
-        SimpleTestBean bean = (SimpleTestBean) newBasicDigester(new AbstractRulesModule() {
+        SimpleTestBean bean = newBasicDigester(new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -121,7 +121,7 @@ public class SetPropertiesRuleTestCase e
     public void testNegativeNotIgnoreMissing() throws Exception {
         try {
             // Parse the input
-            SimpleTestBean bean =  (SimpleTestBean) newBasicDigester(new AbstractRulesModule() {
+            SimpleTestBean bean = newBasicDigester(new AbstractRulesModule() {
 
                 @Override
                 protected void configure() {
@@ -161,7 +161,7 @@ public class SetPropertiesRuleTestCase e
     @Test
     public void testPositiveNotIgnoreMissingWithIgnoreAttributes() throws Exception {
         // Parse the input
-        SimpleTestBean bean =  (SimpleTestBean) newBasicDigester(new AbstractRulesModule() {
+        SimpleTestBean bean = newBasicDigester(new AbstractRulesModule() {
 
             @Override
             protected void configure() {

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertyRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertyRuleTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertyRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertyRuleTestCase.java Mon Feb 28 20:23:56 2011
@@ -72,7 +72,7 @@ public class SetPropertyRuleTestCase ext
     @Test
     public void testPositive() throws Exception {
         // Parse the input
-        SimpleTestBean bean = (SimpleTestBean) this.digester.parse(xmlTestReader(TEST_XML_1));
+        SimpleTestBean bean = this.digester.parse(xmlTestReader(TEST_XML_1));
 
         // Check that the properties were set correctly
         assertEquals("alpha property set",
@@ -95,7 +95,7 @@ public class SetPropertyRuleTestCase ext
     public void testNegative() {
         // Parse the input (should fail)
         try {
-            SimpleTestBean bean = (SimpleTestBean) this.digester.parse(xmlTestReader(TEST_XML_2));
+            SimpleTestBean bean = this.digester.parse(xmlTestReader(TEST_XML_2));
 
             fail("Should have thrown NoSuchMethodException");
             assertNotNull(bean); // just to prevent compiler warning on unused var
@@ -146,7 +146,7 @@ public class SetPropertyRuleTestCase ext
 
         // Parse the input - should not throw an exception
         @SuppressWarnings("unused")
-        SimpleTestBean bean = (SimpleTestBean) this.digester.parse(xmlTestReader(TEST_XML_3));
+        SimpleTestBean bean = this.digester.parse(xmlTestReader(TEST_XML_3));
     }
 
     /**

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XIncludeTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XIncludeTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XIncludeTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XIncludeTestCase.java Mon Feb 28 20:23:56 2011
@@ -37,7 +37,7 @@ public class XIncludeTestCase extends Ab
     @Test
     public void testXInclude() throws SAXException, IOException {
         // Parse our test input
-        Employee employee = (Employee) newLoader(new EmployeeModule())
+        Employee employee = newLoader(new EmployeeModule())
             .setNamespaceAware(true)
             .setXIncludeAware(true)
             .newDigester()

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XMLSchemaTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XMLSchemaTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XMLSchemaTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/XMLSchemaTestCase.java Mon Feb 28 20:23:56 2011
@@ -79,7 +79,7 @@ public class XMLSchemaTestCase extends A
         digester.setErrorHandler(teh);
 
         // Parse our test input
-        Employee employee = (Employee) digester.parse(getInputStream("Test13-01.xml"));
+        Employee employee = digester.parse(getInputStream("Test13-01.xml"));
         assertNotNull("failed to parsed an employee", employee);
         assertTrue("Test13-01 should not generate errors in Schema validation", teh.clean);
 

Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/substitution/VariableExpansionTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/substitution/VariableExpansionTestCase.java?rev=1075515&r1=1075514&r2=1075515&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/substitution/VariableExpansionTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/substitution/VariableExpansionTestCase.java Mon Feb 28 20:23:56 2011
@@ -108,7 +108,7 @@ public class VariableExpansionTestCase {
         String xml = "<root alpha='${attr1}' beta='var{attr2}'/>";
         StringReader input = new StringReader(xml);
 
-        Object root = newLoader(new RulesModule() {
+        SimpleTestBean bean = newLoader(new RulesModule() {
 
             public void configure(RulesBinder binder) {
                 binder.forPattern("root").createObject().ofType(SimpleTestBean.class)
@@ -117,8 +117,7 @@ public class VariableExpansionTestCase {
 
         }).newDigester().parse(input);
 
-        assertNotNull("Digester returned no object", root);
-        SimpleTestBean bean = (SimpleTestBean) root;
+        assertNotNull("Digester returned no object", bean);
 
         assertEquals("${attr1}", bean.getAlpha());
         assertEquals("var{attr2}", bean.getBeta());
@@ -132,7 +131,7 @@ public class VariableExpansionTestCase {
         String xml = "<root alpha='${attr1}' beta='var{attr2}'/>";
         StringReader input = new StringReader(xml);
 
-        Object root = newLoader(new AbstractRulesModule() {
+        SimpleTestBean bean = newLoader(new AbstractRulesModule() {
 
             @Override
             protected void configure() {
@@ -145,8 +144,7 @@ public class VariableExpansionTestCase {
         .newDigester()
         .parse(input);
 
-        assertNotNull("Digester returned no object", root);
-        SimpleTestBean bean = (SimpleTestBean) root;
+        assertNotNull("Digester returned no object", bean);
 
         assertEquals("${attr1}", bean.getAlpha());
         assertEquals("var{attr2}", bean.getBeta());
@@ -239,7 +237,7 @@ public class VariableExpansionTestCase {
             "</root>";
 
         StringReader input = new StringReader(xml);
-        Object root = newLoader(new RulesModule() {
+        SimpleTestBean bean = newLoader(new RulesModule() {
 
             public void configure(RulesBinder rulesBinder) {
                 rulesBinder.forPattern("root")
@@ -253,8 +251,7 @@ public class VariableExpansionTestCase {
         .newDigester()
         .parse(input);
 
-        assertNotNull("Digester returned no object", root);
-        SimpleTestBean bean = (SimpleTestBean) root;
+        assertNotNull("Digester returned no object", bean);
 
         assertEquals(
             "Twas brillig and the slithy toves" +