Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-18345

EMPTY_ELEMENT_AS_NULL disabled by default in jackson-dataformat-xml

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.3.0
    • 3.18.1, 3.19.0
    • camel-jacksonxml
    • None
    • Unknown

    Description

      Jackson 2.12.x changed the default for the 'EMPTY_ELEMENT_AS_NULL' feature from true to false (see [here|https://github.com/FasterXML/jackson-dataformat-xml/issues/411]) and we can enable back this property using XMLMapper:

      xmlMapper.configure(FromXmlParser.Feature.EMPTY_ELEMENT_AS_NULL, true);

      However, there's no way to enable this behaviour in jaxonxml inside camel routes. In the documentation It's specified that we can enable or disable certain types of properties that are inside SerializationFeature, DeserializationFeature and MapperFeature but there's no way to enable EMPTY_ELEMENT_AS_NULL since is in another enum (FromXmlParser). We've tried enabling the feature ACCEPT_EMPTY_STRING_AS_NULL_OBJECT but that doesn't work either.

      We've managed to implement a workaround by using <bean> instead of <jacksonxml> in our camel routes (we use Camel XML DSL), but that's not efficient as we would have to replace all <jacksonxml> references. So we need to have the possibility to enable back EMPTY_ELEMENT_AS_NULL from <jacksonxml> in camel XML DSL.

       

      Attachments

        1. image-2022-08-04-11-48-11-568.png
          18 kB
          José Bustamante
        2. image-2022-08-04-11-41-09-007.png
          24 kB
          José Bustamante
        3. image-2022-08-04-11-36-25-666.png
          24 kB
          José Bustamante

        Activity

          People

            davsclaus Claus Ibsen
            wayqui José Bustamante
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: