Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-6370

wrong usages for System.arraycopy in org.apache.cxf.jaxrs.impl.AsyncResponseImpl

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.2, 3.0.3, 2.7.15
    • 3.1, 3.0.5
    • JAX-RS
    • None
    • Novice
    • Patch

    Description

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

      Attachments

        Activity

          People

            sergey_beryozkin Sergey Beryozkin
            irisding Iris Ding
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: