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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.2, 3.0.3, 2.7.15
    • Fix Version/s: 3.1, 3.0.5
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Novice
    • Flags:
      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

            • Assignee:
              sergey_beryozkin Sergey Beryozkin
              Reporter:
              irisding iris ding
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: