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

NPE has been swallowed in org.apache.cxf.jaxrs.impl.AsyncResponseImpl

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.3, 3.0.4, 2.7.15
    • Fix Version/s: 3.1.1, 3.0.6
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown
    • Flags:
      Patch

      Description

      According to https://jax-rs-spec.java.net/nonav/2.0/apidocs/javax/ws/rs/container/AsyncResponse.html#register(java.lang.Class):
      we need throw NullPointerException - in case the callback class is null in all register method.

      However, CXF swallows the NPE.

      The proposed fix is to throw NPE in below method:

      public Map<Class<?>, Collection<Class<?>>> register(Class<?> callback, Class<?>... callbacks)
      throws NullPointerException {

      try {
      Object[] extraCallbacks = new Object[callbacks.length];
      for (int i = 0; i < callbacks.length; i++)

      { extraCallbacks[i] = callbacks[i].newInstance(); }

      return register(callback.newInstance(), extraCallbacks);
      }
      //proposed change start
      catch (NullPointerException e)

      { throw e; }

      //proposed change end
      catch (Throwable t)

      { return Collections.emptyMap(); }

      }

      After this, my CTS passed!

        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: