This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git

commit 009b9d56aecaaf5e57a2a156c91691cf35f4ffa3
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Sat Aug 31 10:10:16 2024 -0400

    Remove pre-Java 1.4 code
---
 .../org/apache/commons/beanutils2/BeanMap.java     | 46 +++++--------------
 .../BeanPropertyValueChangeConsumer.java           | 24 ++--------
 .../BeanPropertyValueEqualsPredicate.java          | 24 ++--------
 .../beanutils2/BeanToPropertyValueTransformer.java | 30 +++----------
 .../org/apache/commons/beanutils2/BeanUtils.java   | 12 -----
 .../apache/commons/beanutils2/BeanUtilsBean.java   | 52 ----------------------
 .../commons/beanutils2/ConversionException.java    |  2 +-
 .../commons/beanutils2/ConvertingWrapDynaBean.java | 14 +-----
 .../commons/beanutils2/PropertyUtilsBean.java      | 12 ++---
 .../beanutils2/converters/AbstractConverter.java   |  8 +---
 .../apache/commons/beanutils2/BeanMapTestCase.java | 18 ++++----
 .../commons/beanutils2/BeanUtilsBeanTestCase.java  | 25 +----------
 12 files changed, 42 insertions(+), 225 deletions(-)

diff --git a/src/main/java/org/apache/commons/beanutils2/BeanMap.java 
b/src/main/java/org/apache/commons/beanutils2/BeanMap.java
index 11c28fca..8ebd028d 100644
--- a/src/main/java/org/apache/commons/beanutils2/BeanMap.java
+++ b/src/main/java/org/apache/commons/beanutils2/BeanMap.java
@@ -149,16 +149,12 @@ public class BeanMap extends AbstractMap<String, Object> 
implements Cloneable {
         if (bean == null) {
             return;
         }
-
         Class<? extends Object> beanClass = null;
         try {
             beanClass = bean.getClass();
             bean = beanClass.newInstance();
         } catch (final Exception e) {
-            final UnsupportedOperationException uoe = new 
UnsupportedOperationException(
-                    "Could not create new instance of class: " + beanClass);
-            BeanUtils.initCause(uoe, e);
-            throw uoe;
+            throw new UnsupportedOperationException("Could not create new 
instance of class: " + beanClass, e);
         }
     }
 
@@ -186,13 +182,11 @@ public class BeanMap extends AbstractMap<String, Object> 
implements Cloneable {
     @Override
     public Object clone() throws CloneNotSupportedException {
         final BeanMap newMap = (BeanMap) super.clone();
-
         if (bean == null) {
             // no bean, just an empty bean map at the moment. return a newly
             // cloned and empty bean map.
             return newMap;
         }
-
         Object newBean = null;
         final Class<? extends Object> beanClass = bean.getClass(); // Cannot 
throw Exception
         try {
@@ -201,19 +195,16 @@ public class BeanMap extends AbstractMap<String, Object> 
implements Cloneable {
             // unable to instantiate
             final CloneNotSupportedException cnse = new 
CloneNotSupportedException(
                     "Unable to instantiate the underlying bean \"" + 
beanClass.getName() + "\": " + e);
-            BeanUtils.initCause(cnse, e);
+            cnse.initCause(e);
             throw cnse;
         }
-
         try {
             newMap.setBean(newBean);
-        } catch (final Exception exception) {
-            final CloneNotSupportedException cnse = new 
CloneNotSupportedException(
-                    "Unable to set bean in the cloned bean map: " + exception);
-            BeanUtils.initCause(cnse, exception);
+        } catch (final Exception e) {
+            final CloneNotSupportedException cnse = new 
CloneNotSupportedException("Unable to set bean in the cloned bean map: " + e);
+            cnse.initCause(e);
             throw cnse;
         }
-
         try {
             // copy only properties that are readable and writable. If its
             // not readable, we can't get the value from the old map. If
@@ -223,13 +214,11 @@ public class BeanMap extends AbstractMap<String, Object> 
implements Cloneable {
                     newMap.put(key, get(key));
                 }
             });
-        } catch (final Exception exception) {
-            final CloneNotSupportedException cnse = new 
CloneNotSupportedException(
-                    "Unable to copy bean values to cloned bean map: " + 
exception);
-            BeanUtils.initCause(cnse, exception);
+        } catch (final Exception e) {
+            final CloneNotSupportedException cnse = new 
CloneNotSupportedException("Unable to copy bean values to cloned bean map: " + 
e);
+            cnse.initCause(e);
             throw cnse;
         }
-
         return newMap;
     }
 
@@ -333,18 +322,9 @@ public class BeanMap extends AbstractMap<String, Object> 
implements Cloneable {
 
             return new Object[] { value };
         } catch (final InvocationTargetException e) {
-            final IllegalArgumentException iae = new 
IllegalArgumentException(e.getMessage());
-            if (!BeanUtils.initCause(iae, e)) {
-                logInfo(e);
-            }
-            throw iae;
+            throw new IllegalArgumentException(e.getMessage(), e);
         } catch (final InstantiationException e) {
-            final IllegalArgumentException iae = new 
IllegalArgumentException(e.getMessage());
-            if (!BeanUtils.initCause(iae, e)) {
-                logInfo(e);
-            }
-            BeanUtils.initCause(iae, e);
-            throw iae;
+            throw new IllegalArgumentException(e.getMessage(), e);
         }
     }
 
@@ -624,11 +604,7 @@ public class BeanMap extends AbstractMap<String, Object> 
implements Cloneable {
                 final Object newValue = get(name);
                 firePropertyChange(name, oldValue, newValue);
             } catch (final InvocationTargetException | IllegalAccessException 
e) {
-                final IllegalArgumentException iae = new 
IllegalArgumentException(e.getMessage());
-                if (!BeanUtils.initCause(iae, e)) {
-                    logInfo(e);
-                }
-                throw iae;
+                throw new IllegalArgumentException(e.getMessage(), e);
             }
             return oldValue;
         }
diff --git 
a/src/main/java/org/apache/commons/beanutils2/BeanPropertyValueChangeConsumer.java
 
b/src/main/java/org/apache/commons/beanutils2/BeanPropertyValueChangeConsumer.java
index 54ccc22b..a215f32f 100644
--- 
a/src/main/java/org/apache/commons/beanutils2/BeanPropertyValueChangeConsumer.java
+++ 
b/src/main/java/org/apache/commons/beanutils2/BeanPropertyValueChangeConsumer.java
@@ -165,34 +165,18 @@ public class BeanPropertyValueChangeConsumer<T, V> 
implements Consumer<T> {
             final String errorMsg = "Unable to execute Closure. Null value 
encountered in property path...";
 
             if (!ignoreNull) {
-                final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-                if (!BeanUtils.initCause(iae, e)) {
-                    log.error(errorMsg, e);
-                }
-                throw iae;
+                throw new IllegalArgumentException(errorMsg, e);
             }
             log.warn(errorMsg, e);
         } catch (final IllegalAccessException e) {
             final String errorMsg = "Unable to access the property provided.";
-            final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-            if (!BeanUtils.initCause(iae, e)) {
-                log.error(errorMsg, e);
-            }
-            throw iae;
+            throw new IllegalArgumentException(errorMsg, e);
         } catch (final InvocationTargetException e) {
             final String errorMsg = "Exception occurred in property's getter";
-            final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-            if (!BeanUtils.initCause(iae, e)) {
-                log.error(errorMsg, e);
-            }
-            throw iae;
+            throw new IllegalArgumentException(errorMsg, e);
         } catch (final NoSuchMethodException e) {
             final String errorMsg = "Property not found";
-            final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-            if (!BeanUtils.initCause(iae, e)) {
-                log.error(errorMsg, e);
-            }
-            throw iae;
+            throw new IllegalArgumentException(errorMsg, e);
         }
     }
 
diff --git 
a/src/main/java/org/apache/commons/beanutils2/BeanPropertyValueEqualsPredicate.java
 
b/src/main/java/org/apache/commons/beanutils2/BeanPropertyValueEqualsPredicate.java
index 9f181fa2..913d2f3a 100644
--- 
a/src/main/java/org/apache/commons/beanutils2/BeanPropertyValueEqualsPredicate.java
+++ 
b/src/main/java/org/apache/commons/beanutils2/BeanPropertyValueEqualsPredicate.java
@@ -255,34 +255,18 @@ public class BeanPropertyValueEqualsPredicate<T, V> 
implements Predicate<T> {
             final String errorMsg = "Problem during evaluation. Null value 
encountered in property path...";
 
             if (!ignoreNull) {
-                final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-                if (!BeanUtils.initCause(iae, e)) {
-                    log.error(errorMsg, e);
-                }
-                throw iae;
+                throw new IllegalArgumentException(errorMsg, e);
             }
             log.warn(errorMsg, e);
         } catch (final IllegalAccessException e) {
             final String errorMsg = "Unable to access the property provided.";
-            final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-            if (!BeanUtils.initCause(iae, e)) {
-                log.error(errorMsg, e);
-            }
-            throw iae;
+            throw new IllegalArgumentException(errorMsg, e);
         } catch (final InvocationTargetException e) {
             final String errorMsg = "Exception occurred in property's getter";
-            final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-            if (!BeanUtils.initCause(iae, e)) {
-                log.error(errorMsg, e);
-            }
-            throw iae;
+            throw new IllegalArgumentException(errorMsg, e);
         } catch (final NoSuchMethodException e) {
             final String errorMsg = "Property not found.";
-            final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-            if (!BeanUtils.initCause(iae, e)) {
-                log.error(errorMsg, e);
-            }
-            throw iae;
+            throw new IllegalArgumentException(errorMsg, e);
         }
 
         return evaluation;
diff --git 
a/src/main/java/org/apache/commons/beanutils2/BeanToPropertyValueTransformer.java
 
b/src/main/java/org/apache/commons/beanutils2/BeanToPropertyValueTransformer.java
index 6ab13401..c0d2706d 100644
--- 
a/src/main/java/org/apache/commons/beanutils2/BeanToPropertyValueTransformer.java
+++ 
b/src/main/java/org/apache/commons/beanutils2/BeanToPropertyValueTransformer.java
@@ -145,44 +145,24 @@ public class BeanToPropertyValueTransformer<T, R> 
implements Function<T, R> {
      */
     @Override
     public R apply(final T object) {
-
         R propertyValue = null;
-
         try {
             propertyValue = (R) PropertyUtils.getProperty(object, 
propertyName);
         } catch (final IllegalArgumentException e) {
             final String errorMsg = "Problem during transformation. Null value 
encountered in property path...";
-
             if (!ignoreNull) {
-                final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-                if (!BeanUtils.initCause(iae, e)) {
-                    log.error(errorMsg, e);
-                }
-                throw iae;
+                throw new IllegalArgumentException(errorMsg, e);
             }
             log.warn(errorMsg, e);
         } catch (final IllegalAccessException e) {
             final String errorMsg = "Unable to access the property provided.";
-            final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-            if (!BeanUtils.initCause(iae, e)) {
-                log.error(errorMsg, e);
-            }
-            throw iae;
+            throw new IllegalArgumentException(errorMsg, e);
         } catch (final InvocationTargetException e) {
             final String errorMsg = "Exception occurred in property's getter";
-            final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-            if (!BeanUtils.initCause(iae, e)) {
-                log.error(errorMsg, e);
-            }
-            throw iae;
+            throw new IllegalArgumentException(errorMsg, e);
         } catch (final NoSuchMethodException e) {
-            final String errorMsg = "No property found for name [" +
-                propertyName + "]";
-            final IllegalArgumentException iae = new 
IllegalArgumentException(errorMsg);
-            if (!BeanUtils.initCause(iae, e)) {
-                log.error(errorMsg, e);
-            }
-            throw iae;
+            final String errorMsg = "No property found for name [" + 
propertyName + "]";
+            throw new IllegalArgumentException(errorMsg, e);
         }
 
         return propertyValue;
diff --git a/src/main/java/org/apache/commons/beanutils2/BeanUtils.java 
b/src/main/java/org/apache/commons/beanutils2/BeanUtils.java
index afba4a27..0022fbfb 100644
--- a/src/main/java/org/apache/commons/beanutils2/BeanUtils.java
+++ b/src/main/java/org/apache/commons/beanutils2/BeanUtils.java
@@ -364,18 +364,6 @@ public class BeanUtils {
 
     }
 
-    /**
-     * If we're running on JDK 1.4 or later, initialize the cause for the 
given throwable.
-     *
-     * @param  throwable The throwable.
-     * @param  cause     The cause of the throwable.
-     * @return  true if the cause was initialized, otherwise false.
-     * @since 1.8.0
-     */
-    public static boolean initCause(final Throwable throwable, final Throwable 
cause) {
-        return BeanUtilsBean.getInstance().initCause(throwable, cause);
-    }
-
     /**
      * <p>Populate the JavaBeans properties of the specified bean, based on
      * the specified name/value pairs.</p>
diff --git a/src/main/java/org/apache/commons/beanutils2/BeanUtilsBean.java 
b/src/main/java/org/apache/commons/beanutils2/BeanUtilsBean.java
index 9b81b2aa..bbd6ded2 100644
--- a/src/main/java/org/apache/commons/beanutils2/BeanUtilsBean.java
+++ b/src/main/java/org/apache/commons/beanutils2/BeanUtilsBean.java
@@ -21,7 +21,6 @@ import java.beans.IndexedPropertyDescriptor;
 import java.beans.PropertyDescriptor;
 import java.lang.reflect.Array;
 import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -62,9 +61,6 @@ public class BeanUtilsBean {
      */
     private static final Log LOG = LogFactory.getLog(BeanUtilsBean.class);
 
-    /** A reference to Throwable's initCause method, or null if it's not there 
in this JVM */
-    private static final Method INIT_CAUSE_METHOD = getInitCauseMethod();
-
     /**
      * Determines the type of a {@code DynaProperty}. Here a special treatment
      * is needed for mapped properties.
@@ -81,34 +77,6 @@ public class BeanUtilsBean {
         return value == null ? String.class : value.getClass();
     }
 
-    /**
-     * Returns a <code>Method<code> allowing access to
-     * {@link Throwable#initCause(Throwable)} method of {@link Throwable},
-     * or {@code null} if the method
-     * does not exist.
-     *
-     * @return A {@code Method<code> for <code>Throwable.initCause}, or
-     * {@code null} if unavailable.
-     */
-    private static Method getInitCauseMethod() {
-        try {
-            final Class<?>[] paramsClasses = { Throwable.class };
-            return Throwable.class.getMethod("initCause", paramsClasses);
-        } catch (final NoSuchMethodException e) {
-            final Log log = LogFactory.getLog(BeanUtils.class);
-            if (log.isWarnEnabled()) {
-                log.warn("Throwable does not have initCause() method in JDK 
1.3");
-            }
-            return null;
-        } catch (final Throwable e) {
-            final Log log = LogFactory.getLog(BeanUtils.class);
-            if (log.isWarnEnabled()) {
-                log.warn("Error getting the Throwable initCause() method", e);
-            }
-            return null;
-        }
-    }
-
     /**
      * Gets the instance which provides the functionality for {@link 
BeanUtils}.
      * This is a pseudo-singleton - an single instance is provided per 
(thread) context classloader.
@@ -797,26 +765,6 @@ public class BeanUtilsBean {
         return getConvertUtils().convert(value);
     }
 
-    /**
-     * If we're running on JDK 1.4 or later, initialize the cause for the 
given throwable.
-     *
-     * @param  throwable The throwable.
-     * @param  cause     The cause of the throwable.
-     * @return  true if the cause was initialized, otherwise false.
-     * @since 1.8.0
-     */
-    public boolean initCause(final Throwable throwable, final Throwable cause) 
{
-        if (INIT_CAUSE_METHOD != null && cause != null) {
-            try {
-                INIT_CAUSE_METHOD.invoke(throwable, cause);
-                return true;
-            } catch (final Throwable e) {
-             // can't initialize cause
-            }
-        }
-        return false;
-    }
-
     /**
      * <p>Populate the JavaBeans properties of the specified bean, based on
      * the specified name/value pairs.  This method uses Java reflection APIs
diff --git 
a/src/main/java/org/apache/commons/beanutils2/ConversionException.java 
b/src/main/java/org/apache/commons/beanutils2/ConversionException.java
index fc061c97..5dc808f2 100644
--- a/src/main/java/org/apache/commons/beanutils2/ConversionException.java
+++ b/src/main/java/org/apache/commons/beanutils2/ConversionException.java
@@ -18,7 +18,7 @@
 package org.apache.commons.beanutils2;
 
 /**
- * <p>A <strong>ConversionException</strong> indicates that a call to
+ * A <strong>ConversionException</strong> indicates that a call to
  * {@code Converter.convert()} has failed to complete successfully.
  *
  * @since 1.3
diff --git 
a/src/main/java/org/apache/commons/beanutils2/ConvertingWrapDynaBean.java 
b/src/main/java/org/apache/commons/beanutils2/ConvertingWrapDynaBean.java
index 26a53ead..29211a70 100644
--- a/src/main/java/org/apache/commons/beanutils2/ConvertingWrapDynaBean.java
+++ b/src/main/java/org/apache/commons/beanutils2/ConvertingWrapDynaBean.java
@@ -29,7 +29,6 @@ import java.lang.reflect.InvocationTargetException;
  * <p><strong>IMPLEMENTATION NOTE</strong> - This implementation does not
  * support the {@code contains()</code> and <code>remove()} methods.</p>
  */
-
 public class ConvertingWrapDynaBean extends WrapDynaBean {
 
     private static final long serialVersionUID = 1L;
@@ -41,9 +40,7 @@ public class ConvertingWrapDynaBean extends WrapDynaBean {
      * @param instance JavaBean instance to be wrapped
      */
     public ConvertingWrapDynaBean(final Object instance) {
-
         super(instance);
-
     }
 
     /**
@@ -59,20 +56,13 @@ public class ConvertingWrapDynaBean extends WrapDynaBean {
      */
     @Override
     public void set(final String name, final Object value) {
-
         try {
             BeanUtils.copyProperty(instance, name, value);
         } catch (final InvocationTargetException ite) {
             final Throwable cause = ite.getTargetException();
-            throw new IllegalArgumentException
-                    ("Error setting property '" + name +
-                              "' nested exception - " + cause);
+            throw new IllegalArgumentException("Error setting property '" + 
name + "' nested exception - " + cause);
         } catch (final Throwable t) {
-            final IllegalArgumentException iae = new IllegalArgumentException
-                    ("Error setting property '" + name +
-                              "', exception - " + t);
-            BeanUtils.initCause(iae, t);
-            throw iae;
+            throw new IllegalArgumentException("Error setting property '" + 
name + "', exception - " + t, t);
         }
 
     }
diff --git a/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java 
b/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java
index 74dbc15c..642b04b1 100644
--- a/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java
+++ b/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java
@@ -1233,19 +1233,15 @@ public class PropertyUtilsBean {
                     expectedString.append(parTypes[i].getName());
                 }
             }
-            final IllegalArgumentException e = new 
IllegalArgumentException("Cannot invoke " + 
method.getDeclaringClass().getName() + "." + method.getName()
+            throw new IllegalArgumentException("Cannot invoke " + 
method.getDeclaringClass().getName() + "." + method.getName()
                     + " on bean class '" + bean.getClass() + "' - " + 
cause.getMessage()
                     // as per 
https://issues.apache.org/jira/browse/BEANUTILS-224
-                    + " - had objects of type \"" + valueString + "\" but 
expected signature \"" + expectedString + "\"");
-            if (!BeanUtils.initCause(e, cause)) {
-                LOG.error("Method invocation failed", cause);
-            }
-            throw e;
+                    + " - had objects of type \"" + valueString + "\" but 
expected signature \"" + expectedString + "\"", cause);
         }
     }
 
     /**
-     * <p>Return {@code true} if the specified property name identifies
+     * Return {@code true} if the specified property name identifies
      * a readable property on the specified bean; otherwise, return
      * {@code false}.
      *
@@ -1317,7 +1313,7 @@ public class PropertyUtilsBean {
     }
 
     /**
-     * <p>Return {@code true} if the specified property name identifies
+     * Return {@code true} if the specified property name identifies
      * a writable property on the specified bean; otherwise, return
      * {@code false}.
      *
diff --git 
a/src/main/java/org/apache/commons/beanutils2/converters/AbstractConverter.java 
b/src/main/java/org/apache/commons/beanutils2/converters/AbstractConverter.java
index 624c9add..205d38a2 100644
--- 
a/src/main/java/org/apache/commons/beanutils2/converters/AbstractConverter.java
+++ 
b/src/main/java/org/apache/commons/beanutils2/converters/AbstractConverter.java
@@ -21,7 +21,6 @@ import java.util.Collection;
 import java.util.Locale;
 import java.util.Objects;
 
-import org.apache.commons.beanutils2.BeanUtils;
 import org.apache.commons.beanutils2.ConversionException;
 import org.apache.commons.beanutils2.ConvertUtils;
 import org.apache.commons.beanutils2.Converter;
@@ -330,14 +329,12 @@ public abstract class AbstractConverter<D> implements 
Converter<D> {
                 log().debug("    Conversion threw " + cause);
             }
         }
-
         if (useDefault) {
             return handleMissing(type);
         }
-
         ConversionException cex = null;
         if (cause instanceof ConversionException) {
-            cex = (ConversionException)cause;
+            cex = (ConversionException) cause;
             if (log().isDebugEnabled()) {
                 log().debug("    Re-throwing ConversionException: " + 
cex.getMessage());
                 log().debug("    " + DEFAULT_CONFIG_MSG);
@@ -350,11 +347,8 @@ public abstract class AbstractConverter<D> implements 
Converter<D> {
                 log().debug("    Throwing ConversionException: " + msg);
                 log().debug("    " + DEFAULT_CONFIG_MSG);
             }
-            BeanUtils.initCause(cex, cause);
         }
-
         throw cex;
-
     }
 
     /**
diff --git a/src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java 
b/src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java
index 9e6b38ba..4ee5bbed 100644
--- a/src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java
@@ -34,10 +34,6 @@ import org.apache.commons.collections4.map.AbstractMapTest;
  */
 public class BeanMapTestCase extends AbstractMapTest<String, Object> {
 
-    public BeanMapTestCase() {
-        super("BeanMapTestCase");
-    }
-
     public static class BeanThrowingExceptions extends BeanWithProperties {
         private static final long serialVersionUID = 1L;
 
@@ -150,6 +146,12 @@ public class BeanMapTestCase extends 
AbstractMapTest<String, Object> {
         private static final long serialVersionUID = 1L;
     }
 
+    /**
+     * An object value that will be stored in the bean map as a value. Need to 
save this externally so that we can make sure the object instances are 
equivalent
+     * since getSampleValues() would otherwise construct a new and different 
Object each time.
+     **/
+    private final Object objectInFullMap = new Object();
+
     /*
      * note to self. The getter and setter methods were generated by copying 
the field declarations and using the following regular expression search and
      * replace:
@@ -159,11 +161,9 @@ public class BeanMapTestCase extends 
AbstractMapTest<String, Object> {
      * Also note: The sample keys and mappings were generated manually.
      */
 
-    /**
-     * An object value that will be stored in the bean map as a value. Need to 
save this externally so that we can make sure the object instances are 
equivalent
-     * since getSampleValues() would otherwise construct a new and different 
Object each time.
-     **/
-    private final Object objectInFullMap = new Object();
+    public BeanMapTestCase() {
+        super("BeanMapTestCase");
+    }
 
     @Override
     public Object[] getNewSampleValues() {
diff --git 
a/src/test/java/org/apache/commons/beanutils2/BeanUtilsBeanTestCase.java 
b/src/test/java/org/apache/commons/beanutils2/BeanUtilsBeanTestCase.java
index a2faab43..4f20d111 100644
--- a/src/test/java/org/apache/commons/beanutils2/BeanUtilsBeanTestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/BeanUtilsBeanTestCase.java
@@ -128,9 +128,7 @@ public class BeanUtilsBeanTestCase extends TestCase {
         try {
             throwException(cause);
         } catch (final Throwable e) {
-            final Throwable t = new Exception(parent);
-            BeanUtils.initCause(t, e);
-            throw t;
+            throw new Exception(parent, e);
         }
     }
 
@@ -865,27 +863,6 @@ public class BeanUtilsBeanTestCase extends TestCase {
         assertEquals("java.util.Date --> String", testUtilDate.toString(), 
value);
     }
 
-    /**
-     * Test for {@link BeanUtilsBean#initCause(Throwable, Throwable)} method.
-     */
-    public void testInitCause() {
-        final String parentMsg = "PARENT-THROWABLE";
-        final String causeMsg = "THROWABLE-CAUSE";
-        try {
-            initCauseAndThrowException(parentMsg, causeMsg);
-        } catch (final Throwable thrownParent) {
-            assertEquals("Parent", parentMsg, thrownParent.getMessage());
-            try {
-                assertEquals("Parent", parentMsg, thrownParent.getMessage());
-                final Throwable thrownCause = getCause(thrownParent);
-                assertNotNull("Cause Null", thrownCause);
-                assertEquals("Cause", causeMsg, thrownCause.getMessage());
-            } catch (final Throwable testError) {
-                fail("If you're running JDK 1.3 then don't worry this should 
fail," + " if not then needs checking out: " + testError);
-            }
-        }
-    }
-
     public void testMappedProperty() throws Exception {
         final MappedPropertyTestBean bean = new MappedPropertyTestBean();
 

Reply via email to