Navigation Menu

Skip to content

Commit

Permalink
Fixed Jaxb2Marshaller's partial unmarshalling feature to consistently…
Browse files Browse the repository at this point in the history
… apply to all sources

Issue: SPR-10282
  • Loading branch information
jhoeller committed Mar 19, 2013
1 parent dc9fee0 commit 283b3ee
Showing 1 changed file with 7 additions and 3 deletions.
Expand Up @@ -720,7 +720,7 @@ public Object unmarshal(Source source, MimeContainer mimeContainer) throws XmlMa
return unmarshalStaxSource(unmarshaller, source); return unmarshalStaxSource(unmarshaller, source);
} }
else if (this.mappedClass != null) { else if (this.mappedClass != null) {
return unmarshaller.unmarshal(source, this.mappedClass); return unmarshaller.unmarshal(source, this.mappedClass).getValue();
} }
else { else {
return unmarshaller.unmarshal(source); return unmarshaller.unmarshal(source);
Expand All @@ -734,12 +734,16 @@ else if (this.mappedClass != null) {
protected Object unmarshalStaxSource(Unmarshaller jaxbUnmarshaller, Source staxSource) throws JAXBException { protected Object unmarshalStaxSource(Unmarshaller jaxbUnmarshaller, Source staxSource) throws JAXBException {
XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource); XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource);
if (streamReader != null) { if (streamReader != null) {
return jaxbUnmarshaller.unmarshal(streamReader); return (this.mappedClass != null ?
jaxbUnmarshaller.unmarshal(streamReader, this.mappedClass).getValue() :
jaxbUnmarshaller.unmarshal(streamReader));
} }
else { else {
XMLEventReader eventReader = StaxUtils.getXMLEventReader(staxSource); XMLEventReader eventReader = StaxUtils.getXMLEventReader(staxSource);
if (eventReader != null) { if (eventReader != null) {
return jaxbUnmarshaller.unmarshal(eventReader); return (this.mappedClass != null ?
jaxbUnmarshaller.unmarshal(eventReader, this.mappedClass).getValue() :
jaxbUnmarshaller.unmarshal(eventReader));
} }
else { else {
throw new IllegalArgumentException("StaxSource contains neither XMLStreamReader nor XMLEventReader"); throw new IllegalArgumentException("StaxSource contains neither XMLStreamReader nor XMLEventReader");
Expand Down

0 comments on commit 283b3ee

Please sign in to comment.