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

Cannot call setAttribute with a null name

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.2, 3.1.3
    • Fix Version/s: 3.0.7, 3.1.4
    • Component/s: JAX-RS
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      After update on version 3.1.2. Our application ends with this Exception

      ...
      Caused by: java.lang.IllegalArgumentException: Cannot call setAttribute with a null name
      at org.apache.catalina.connector.Request.setAttribute(Request.java:1500)
      at org.apache.catalina.connector.RequestFacade.setAttribute(RequestFacade.java:541)
      at javax.servlet.ServletRequestWrapper.setAttribute(ServletRequestWrapper.java:239)
      at javax.servlet.ServletRequestWrapper.setAttribute(ServletRequestWrapper.java:239)
      at org.apache.cxf.jaxrs.provider.RequestDispatcherProvider.writeTo(RequestDispatcherProvider.java:212)
      ... 59 more

      I believe, that i know where is problem and that fix is really trivial:
      Class:
      org.apache.cxf.jaxrs.provider.RequestDispatcherProvider
      have method
      protected String getBeanName(Object bean) {
      ...
      String name = beanNames.get(bean.getClass().getName());
      if (name != null)

      { return null; }


      ...
      }
      This return null and cause exception (stacktrace is above)

      Fix should be trivial just change "return null;"
      into
      "return name;"

      I believe, that it is correct fix, because code in version 3.1.1 looked like this:
      String name = beanNames.get(bean.getClass().getName());
      return name != null ? name : bean.getClass().getSimpleName().toLowerCase();

      Thanks for fix, because we want use new version of CXF. And we cannot due to this issue.

        Attachments

          Activity

            People

            • Assignee:
              sergey_beryozkin Sergey Beryozkin
              Reporter:
              bugs_ Jan Vondrouš
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: