Skip to content

AbstractMarshaller incorrectly expects DOMResult to already have a node [SPR-7257] #11916

@spring-projects-issues

Description

@spring-projects-issues

Archie Cobbs opened SPR-7257 and commented

If you try to marshall an object into a DOMResult that was created with the DOMResult() no-arg constructor, you get this:

java.lang.IllegalArgumentException: DOMResult does not contain Node
	at org.springframework.util.Assert.notNull(Assert.java:112)
	at org.springframework.oxm.support.AbstractMarshaller.marshalDomResult(AbstractMarshaller.java:192)
	at org.springframework.oxm.support.AbstractMarshaller.marshal(AbstractMarshaller.java:93)

But why? The Javadoc for DOMResult states:

If no output DOM source is set, the transformation will create a Document node as the holder for the result of the transformation, which may be retrieved with getNode().

So this check is in violation of the DOM API. In any case, I can't create the node because I don't know what the document element is going to be (in general, only the marshaller knows that).


Affects: 3.0.2

Referenced from: commits f72c431

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions