cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michał P (JIRA) <j...@apache.org>
Subject [jira] [Updated] (CXF-5995) ClientProxyImpl problem with handling @BeanParams with null headers/cookies.
Date Wed, 10 Sep 2014 09:06:28 GMT

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

Michał P updated CXF-5995:
--------------------------
    Description: 
Problem occures when my @BeanParam object has String @HeaderParam values that are null.

On client side inside ClientProxyImpl#getValuesFromBeanParam always returns full Map<String,
BeanPair> even when BeanPair has null values.

{code:title=ClientProxyImpl.java|borderStyle=solid}
// line 481
String propertyName = m.getName().substring(3);
Method getter = bean.getClass().getMethod("get" + propertyName, new Class[]{});
Object value = getter.invoke(bean, new Object[]{});
String annotationValue = AnnotationUtils.getAnnotationValue(annotation);
values.put(annotationValue, new BeanPair(value, m.getParameterAnnotations()[0]));
{code}

Methods such handleHeaders, handleCookies has useless condition that is
always true (BeanPair is never null)

{code:title=ClientProxyImpl.java|borderStyle=solid}
// line 585
for (Map.Entry<String, BeanPair> entry : values.entrySet()) {
    if (entry.getValue() != null) {
        headers.add(entry.getKey(), convertParamValue(entry.getValue().getValue(), entry.getValue().getAnns()));
    }
}
{code}

That couses unintended behaviour on server side when server receives BeanParam objects with
fields with String value equal to "null".

I've sent no headers but servers received header with "null" String.

  was:
Problem occures when my @BeanParam object has String @HeaderParam values that are null.

On client side inside ClientProxyImpl#getValuesFromBeanParam always returns full Map<String,
BeanPair> even when BeanPair has null values.

{code:title=ClientProxyImpl.java|borderStyle=solid}
String propertyName = m.getName().substring(3);
Method getter = bean.getClass().getMethod("get" + propertyName, new Class[]{});
Object value = getter.invoke(bean, new Object[]{});
String annotationValue = AnnotationUtils.getAnnotationValue(annotation);
values.put(annotationValue, new BeanPair(value, m.getParameterAnnotations()[0]));
{code}

Methods such handleHeaders, handleCookies has useless condition that is
always true (BeanPair is never null)

{code:title=ClientProxyImpl.java|borderStyle=solid}
for (Map.Entry<String, BeanPair> entry : values.entrySet()) {
    if (entry.getValue() != null) {
    ...
    }
}
{code}

That couses unintended behaviour on server side when server receives BeanParam objects with
fields with String value equal to "null".

I've sent no headers but servers received header with "null" String.


> ClientProxyImpl problem with handling @BeanParams with null headers/cookies.
> ----------------------------------------------------------------------------
>
>                 Key: CXF-5995
>                 URL: https://issues.apache.org/jira/browse/CXF-5995
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.0.0, 3.0.1
>            Reporter: Michał P
>
> Problem occures when my @BeanParam object has String @HeaderParam values that are null.
> On client side inside ClientProxyImpl#getValuesFromBeanParam always returns full Map<String,
BeanPair> even when BeanPair has null values.
> {code:title=ClientProxyImpl.java|borderStyle=solid}
> // line 481
> String propertyName = m.getName().substring(3);
> Method getter = bean.getClass().getMethod("get" + propertyName, new Class[]{});
> Object value = getter.invoke(bean, new Object[]{});
> String annotationValue = AnnotationUtils.getAnnotationValue(annotation);
> values.put(annotationValue, new BeanPair(value, m.getParameterAnnotations()[0]));
> {code}
> Methods such handleHeaders, handleCookies has useless condition that is
> always true (BeanPair is never null)
> {code:title=ClientProxyImpl.java|borderStyle=solid}
> // line 585
> for (Map.Entry<String, BeanPair> entry : values.entrySet()) {
>     if (entry.getValue() != null) {
>         headers.add(entry.getKey(), convertParamValue(entry.getValue().getValue(), entry.getValue().getAnns()));
>     }
> }
> {code}
> That couses unintended behaviour on server side when server receives BeanParam objects
with fields with String value equal to "null".
> I've sent no headers but servers received header with "null" String.



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

Mime
View raw message