Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed Jaxb2Marshaller's partial unmarshalling feature to consistently…

… apply to all sources

Issue: SPR-10282
  • Loading branch information...
commit 283b3ee44be2fe89e7a944a10a69a72eb28d1662 1 parent dc9fee0
authored March 19, 2013
10  spring-oxm/src/main/java/org/springframework/oxm/jaxb/Jaxb2Marshaller.java
@@ -720,7 +720,7 @@ public Object unmarshal(Source source, MimeContainer mimeContainer) throws XmlMa
720 720
 				return unmarshalStaxSource(unmarshaller, source);
721 721
 			}
722 722
 			else if (this.mappedClass != null) {
723  
-				return unmarshaller.unmarshal(source, this.mappedClass);
  723
+				return unmarshaller.unmarshal(source, this.mappedClass).getValue();
724 724
 			}
725 725
 			else {
726 726
 				return unmarshaller.unmarshal(source);
@@ -734,12 +734,16 @@ else if (this.mappedClass != null) {
734 734
 	protected Object unmarshalStaxSource(Unmarshaller jaxbUnmarshaller, Source staxSource) throws JAXBException {
735 735
 		XMLStreamReader streamReader = StaxUtils.getXMLStreamReader(staxSource);
736 736
 		if (streamReader != null) {
737  
-			return jaxbUnmarshaller.unmarshal(streamReader);
  737
+			return (this.mappedClass != null ?
  738
+					jaxbUnmarshaller.unmarshal(streamReader, this.mappedClass).getValue() :
  739
+					jaxbUnmarshaller.unmarshal(streamReader));
738 740
 		}
739 741
 		else {
740 742
 			XMLEventReader eventReader = StaxUtils.getXMLEventReader(staxSource);
741 743
 			if (eventReader != null) {
742  
-				return jaxbUnmarshaller.unmarshal(eventReader);
  744
+				return (this.mappedClass != null ?
  745
+						jaxbUnmarshaller.unmarshal(eventReader, this.mappedClass).getValue() :
  746
+						jaxbUnmarshaller.unmarshal(eventReader));
743 747
 			}
744 748
 			else {
745 749
 				throw new IllegalArgumentException("StaxSource contains neither XMLStreamReader nor XMLEventReader");

0 notes on commit 283b3ee

Please sign in to comment.
Something went wrong with that request. Please try again.