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

Cannot call setAttribute with a null name

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.1.2, 3.1.3
    • 3.0.7, 3.1.4
    • JAX-RS
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: