[ 
https://issues.apache.org/jira/browse/CXF-6630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jan Vondrouš updated CXF-6630:
------------------------------
    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 belive, that it is correct fix, becaouse 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.

  was:
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 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 belive, that it is correct fix, becaouse 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.


> Cannot call setAttribute with a null name
> -----------------------------------------
>
>                 Key: CXF-6630
>                 URL: https://issues.apache.org/jira/browse/CXF-6630
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.1.2, 3.1.3
>            Reporter: Jan Vondrouš
>
> 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 belive, that it is correct fix, becaouse 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to