Skip to content

XmlMapper regression in 3.2.0 #871

@beikov

Description

@beikov

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

XmlMapper wrongly interprets collection element null tag to mean the Collection to be null.

Version Information

3.2.0

Reproduction

xmlMapper.readValue("<Collection><e xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:nil=\"true\"/></Collection>", xmlMapper.constructType( new ParameterizedTypeImpl( CollectionWrapper.class, new Type[] {String.class}, null ));

with the model:

	@JsonRootName(value = "Collection")
	public static class CollectionWrapper<E> {
		@JacksonXmlElementWrapper(useWrapping = false)
		@JacksonXmlProperty(localName = "e")
		Collection<E> value;

		public CollectionWrapper() {
			this.value = new ArrayList<>();
		}

		public CollectionWrapper(Collection<E> value) {
			this.value = value;
		}
	}

Returns a CollectionWrapper with a null for value, whereas it should be a collection with a null element like in Jackson 3.1.4 and before.

Expected behavior

Return a CollectionWrapper with a collection containing a null value.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.2to-evaluateIssue that has been received but not yet evaluated

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions