You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by bu...@apache.org on 2003/06/12 20:58:18 UTC

DO NOT REPLY [Bug 20719] - BeanPropertyDescriptor cpu consuming on large arrays

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20719>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20719

BeanPropertyDescriptor cpu consuming on large arrays





------- Additional Comments From nisol.fabien@hydro.qc.ca  2003-06-12 18:58 -------
We modified the source code from axis 1_1 rc2 like the following to bypass the
problem:

old code:

    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);

            // Copy over the old elements
            int len = 0;
            if (array != null) {
                len = Array.getLength(array);
            }
            set(obj, newArray);
            
            for (int index=0; index<len; index++) {
                set(obj, index, Array.get(array, index));
            }
        }
    }

to new code:

    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);
            // Copy over the old elements
            if (array != null) {
                System.arraycopy(array, 0, newArray, 0, Array.getLength(array));
            }
            // Set the object to use the larger array
            set(obj, newArray);
        }
    }

I think this modification should be integrated in next release of Axis


Fabien Nisol
nisol.fabien@hydro.qc.ca