dims 2003/06/12 15:04:57
Modified: java/src/org/apache/axis/utils BeanPropertyDescriptor.java
Log:
Fix for Bug 20719 - BeanPropertyDescriptor cpu consuming on large arrays
from [EMAIL PROTECTED] (Fabien Nisol)
Revision Changes Path
1.17 +14 -14
xml-axis/java/src/org/apache/axis/utils/BeanPropertyDescriptor.java
Index: BeanPropertyDescriptor.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/utils/BeanPropertyDescriptor.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- BeanPropertyDescriptor.java 22 Apr 2003 19:36:03 -0000 1.16
+++ BeanPropertyDescriptor.java 12 Jun 2003 22:04:57 -0000 1.17
@@ -196,26 +196,26 @@
}
}
- protected void growArrayToSize(Object obj, Class componentType, int i)
- throws InvocationTargetException, IllegalAccessException {
+ /**
+ * Grow the array
+ * @param obj
+ * @param componentType
+ * @param i
+ * @throws InvocationTargetException
+ * @throws IllegalAccessException
+ */
+ protected void growArrayToSize(Object obj, Class componentType, int i) throws
InvocationTargetException, IllegalAccessException {
// Get the entire array and make sure it is large enough
Object array = get(obj);
if (array == null || Array.getLength(array) <= i) {
- // Construct a larger array of the same type
- Object newArray =
- Array.newInstance(componentType,i+1);
-
- // Set the object to use the larger array
- set(obj, newArray);
-
+ // Construct a larger array of the same type
+ Object newArray = Array.newInstance(componentType, i + 1);
// Copy over the old elements
- int len = 0;
if (array != null) {
- len = Array.getLength(array);
- }
- for (int index=0; index<len; index++) {
- set(obj, index, Array.get(array, index));
+ System.arraycopy(array, 0, newArray, 0, Array.getLength(array));
}
+ // Set the object to use the larger array
+ set(obj, newArray);
}
}