Hi David,

I had to do some digging - but yes, we addressed that issue in our Open
Liberty fork of CXF and I must not have contributed that fix back to the
main CXF fork (apologies for that).

Here are the changes I made in the OL fork:
https://github.com/OpenLiberty/open-liberty/pull/2504 - basically deferring
the decoding until after the map has been populated.  If you want, I can
try to push this change back to the main CXF fork.

Thanks for pointing this out,

Andy

On Mon, Apr 12, 2021 at 9:12 PM David Blevins <[email protected]>
wrote:

> Did you run into this in Open Liberty?
>
>
> --
> David Blevins
> http://twitter.com/dblevins
> http://www.tomitribe.com
>
> Begin forwarded message:
>
> *From: *David Blevins <[email protected]>
> *Subject: **@Encoded TCK issue*
> *Date: *April 12, 2021 at 7:07:35 PM PDT
> *To: *[email protected]
>
> Hi All,
>
> I'm investigating a Jakarta EE TCK failure:
>
> -
> com/sun/ts/tests/jaxrs/ee/rs/beanparam/form/plain/JAXRSClient#formFieldParamEntityWithEncodedTest_from_standalone
>
> This test posts a form and is checking to ensure the @Encoded annotation
> is being respected.  The code to respect that annotation is definitely
> implemented, however before that code is called we've already parsed,
> decoded and cached the form into the Message so the test fails.
>
> -
> https://github.com/apache/cxf/blob/master/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/utils/JAXRSUtils.java#L1033-L1054
>
> Essentially, due to this caching the "decode" boolean is ignored after the
> first field of the bean is processed.  When you have a bean like the
> following where there are two fields, one results in 'decode=true' and the
> second in 'decode=false', the second field's wishes will not happen as the
> first field caused the form to be decoded and cached.  The second field
> will then get a decoded value despite the @Encoded annotation.
>
>    public class FormBeanParamEntity {
>      @DefaultValue(Constants.DEFAULT_VALUE)
>      @FormParam(Constants.PARAM_ENTITY_WITH_CONSTRUCTOR)
>      public ParamEntityWithConstructor paramEntityWithConstructor;
>
>      @Encoded
>      @DefaultValue(Constants.DEFAULT_VALUE)
>      @FormParam(Constants.PARAM_ENTITY_WITH_FROMSTRING)
>      public ParamEntityWithFromString paramEntityWithFromString;
>
>
> So essentially @Encoded will only work as the first parameter, field, etc.
>
> Investigating fixes at the moment and will submit a PR.  Open to thoughts
> and preferences.  This is one of about 33 failures I'm hunting down.
>
>
> -David
>
>
>

Reply via email to