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
The following commit(s) were added to refs/heads/master by this push:
new c7e1100d Spelling
c7e1100d is described below
commit c7e1100d86fe1386e213a95f3546e7cb756d676c
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jan 1 11:10:03 2023 -0500
Spelling
---
.../java/org/apache/commons/beanutils2/LazyDynaClass.java | 5 +++--
.../apache/commons/beanutils2/bugs/Jira347TestCase.java | 2 +-
.../beanutils2/memoryleaktests/MemoryLeakTestCase.java | 14 +++++++-------
3 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/src/main/java/org/apache/commons/beanutils2/LazyDynaClass.java
b/src/main/java/org/apache/commons/beanutils2/LazyDynaClass.java
index 3bf08f7e..2635e25f 100644
--- a/src/main/java/org/apache/commons/beanutils2/LazyDynaClass.java
+++ b/src/main/java/org/apache/commons/beanutils2/LazyDynaClass.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.beanutils2;
+import java.util.Arrays;
+
/**
* <p>DynaClass which implements the {@code MutableDynaClass} interface.</p>
*
@@ -241,8 +243,7 @@ public class LazyDynaClass extends BasicDynaClass
implements MutableDynaClass {
// Create a new property array with the specified property
final DynaProperty[] oldProperties = getDynaProperties();
- final DynaProperty[] newProperties = new
DynaProperty[oldProperties.length + 1];
- System.arraycopy(oldProperties, 0, newProperties, 0,
oldProperties.length);
+ final DynaProperty[] newProperties = Arrays.copyOf(oldProperties,
oldProperties.length + 1);
newProperties[oldProperties.length] = property;
// Update the properties
diff --git
a/src/test/java/org/apache/commons/beanutils2/bugs/Jira347TestCase.java
b/src/test/java/org/apache/commons/beanutils2/bugs/Jira347TestCase.java
index f4eb48d0..5e981869 100644
--- a/src/test/java/org/apache/commons/beanutils2/bugs/Jira347TestCase.java
+++ b/src/test/java/org/apache/commons/beanutils2/bugs/Jira347TestCase.java
@@ -122,7 +122,7 @@ public class Jira347TestCase extends TestCase {
// System.out.println("After GC: " + getMemoryStats());
if (ref.get() != null) {
- throw new IllegalStateException("Your JVM is not releasing
SoftReference, try running the testcase with less memory (-Xmx)");
+ throw new IllegalStateException("Your JVM is not releasing
SoftReference, try running the test with less memory (-Xmx)");
}
}
diff --git
a/src/test/java/org/apache/commons/beanutils2/memoryleaktests/MemoryLeakTestCase.java
b/src/test/java/org/apache/commons/beanutils2/memoryleaktests/MemoryLeakTestCase.java
index ecdc2832..596baed7 100644
---
a/src/test/java/org/apache/commons/beanutils2/memoryleaktests/MemoryLeakTestCase.java
+++
b/src/test/java/org/apache/commons/beanutils2/memoryleaktests/MemoryLeakTestCase.java
@@ -76,7 +76,7 @@ public class MemoryLeakTestCase {
assertNotSame("ClassLoaders should be different..",
getClass().getClassLoader(), beanClass.getClassLoader());
assertSame("BeanClass ClassLoader incorrect",
beanClass.getClassLoader(), loader);
- // if you comment the following line, the testcase will work, and the
ClassLoader will be released.
+ // if you comment the following line, the test will work, and the
ClassLoader will be released.
// That proves that nothing is wrong with the test, and PropertyUtils
is holding a reference
assertEquals("initialValue", PropertyUtils.getProperty(bean, "name"));
@@ -123,7 +123,7 @@ public class MemoryLeakTestCase {
assertNotSame("ClassLoaders should be different..",
getClass().getClassLoader(), beanClass.getClassLoader());
assertSame("BeanClass ClassLoader incorrect",
beanClass.getClassLoader(), loader);
- // if you comment the following three lines, the testcase will work,
and the ClassLoader will be released.
+ // if you comment the following three lines, the test will work, and
the ClassLoader will be released.
// That proves that nothing is wrong with the test, and PropertyUtils
is holding a reference
assertEquals("Second Value", PropertyUtils.getProperty(bean,
"mappedProperty(Second Key)"));
PropertyUtils.setProperty(bean, "mappedProperty(Second Key)", "New
Second Value");
@@ -273,7 +273,7 @@ public class MemoryLeakTestCase {
assertNotSame("ClassLoaders should be different..",
getClass().getClassLoader(), beanClass.getClassLoader());
assertSame("BeanClass ClassLoader incorrect",
beanClass.getClassLoader(), loader);
- // if you comment the following line, the testcase will work, and the
ClassLoader will be released.
+ // if you comment the following line, the test will work, and the
ClassLoader will be released.
// That proves that nothing is wrong with the test, and MethodUtils is
holding a reference
assertEquals("initialValue", MethodUtils.invokeExactMethod(bean,
"getName", new Object[0]));
@@ -321,7 +321,7 @@ public class MemoryLeakTestCase {
assertNotSame("ClassLoaders should be different..",
getClass().getClassLoader(), beanClass.getClassLoader());
assertSame("BeanClass ClassLoader incorrect",
beanClass.getClassLoader(), loader);
- // if you comment the following line, the testcase will work, and the
ClassLoader will be released.
+ // if you comment the following line, the test will work, and the
ClassLoader will be released.
// That proves that nothing is wrong with the test, and WrapDynaClass
is holding a reference
assertEquals("initialValue", wrapDynaBean.get("name"));
@@ -373,7 +373,7 @@ public class MemoryLeakTestCase {
assertNotSame("ClassLoaders should be different..",
getClass().getClassLoader(), beanClass.getClassLoader());
assertSame("BeanClass ClassLoader incorrect",
beanClass.getClassLoader(), loader);
- // if you comment the following two lines, the testcase will work, and
the ClassLoader will be released.
+ // if you comment the following two lines, the test will work, and the
ClassLoader will be released.
// That proves that nothing is wrong with the test, and
ConvertUtilsBean is holding a reference
ConvertUtils.register(new IntegerConverter(), beanClass);
assertEquals("12345", ConvertUtils.convert(bean, String.class));
@@ -420,7 +420,7 @@ public class MemoryLeakTestCase {
assertNotSame("ClassLoaders should be different..",
getClass().getClassLoader(), beanClass.getClassLoader());
assertSame("BeanClass ClassLoader incorrect",
beanClass.getClassLoader(), loader);
- // if you comment the following two lines, the testcase will work, and
the ClassLoader will be released.
+ // if you comment the following two lines, the test will work, and the
ClassLoader will be released.
// That proves that nothing is wrong with the test, and
LocaleConvertUtilsBean is holding a reference
LocaleConvertUtils.register(new IntegerLocaleConverter(Locale.US,
false), (Class<Integer>) beanClass, Locale.US);
assertEquals(new Integer(12345),
LocaleConvertUtils.convert(bean.toString(), Integer.class, Locale.US, "#,###"));
@@ -499,7 +499,7 @@ public class MemoryLeakTestCase {
final boolean isNotNull = ref.get() != null;
System.out.println("Count " + count+ " " + isNotNull); // debug for
Continuum failure
- final String message = "Your JVM is not releasing SoftReference, try
running the testcase with less memory (-Xmx)";
+ final String message = "Your JVM is not releasing SoftReference, try
running the test with less memory (-Xmx)";
Assume.assumeFalse(message, isNotNull);
}