You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "iris ding (JIRA)" <ji...@apache.org> on 2015/04/24 10:00:47 UTC

[jira] [Created] (CXF-6370) wrong usages for System.arraycopy in org.apache.cxf.jaxrs.impl.AsyncResponseImpl

iris ding created CXF-6370:
------------------------------

             Summary: wrong usages for System.arraycopy in org.apache.cxf.jaxrs.impl.AsyncResponseImpl
                 Key: CXF-6370
                 URL: https://issues.apache.org/jira/browse/CXF-6370
             Project: CXF
          Issue Type: Bug
          Components: JAX-RS
    Affects Versions: 2.7.15, 3.0.3, 3.0.2
            Reporter: iris ding


In org.apache.cxf.jaxrs.impl.AsyncResponseImpl, below method used 
System.arraycopy(). However, it mismatch the arrary to copy out of and array to copy into: 
"void java.lang.System.arraycopy(Object array1, int start1, Object array2, int start2, int length)
Copies the contents of array1 starting at offset start1 into array2 starting at offset start2 for length elements."

After below modification, my CTS test passed!




@Override
    public Map<Class<?>, Collection<Class<?>>> register(Object callback, Object... callbacks)
                    throws NullPointerException {
        Map<Class<?>, Collection<Class<?>>> map =
                        new HashMap<Class<?>, Collection<Class<?>>>();

        Object[] allCallbacks = new Object[1 + callbacks.length];
        allCallbacks[0] = callback;
       // wrong usage for System.arraycopy
       // System.arraycopy(allCallbacks, 1, callbacks, 0, callbacks.length);
        System.arraycopy(callbacks, 0, allCallbacks, 1, callbacks.length);



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)