From 680f9692c848a18ffd72d2ded3569473c19fefbd Mon Sep 17 00:00:00 2001 From: Arjen Poutsma Date: Wed, 15 Jun 2011 11:09:58 +0000 Subject: [PATCH] SPR-8341 - Spring OXM CastorMarshaller unmarshalling methods --- .../oxm/castor/CastorMarshaller.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/org.springframework.oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java b/org.springframework.oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java index eabaa9a2bb..6c2faa38e0 100644 --- a/org.springframework.oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java +++ b/org.springframework.oxm/src/main/java/org/springframework/oxm/castor/CastorMarshaller.java @@ -575,17 +575,6 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing } } - @Override - protected final Object unmarshalXmlEventReader(XMLEventReader eventReader) { - XMLReader reader = StaxUtils.createXMLReader(eventReader); - try { - return unmarshalSaxReader(reader, new InputSource()); - } - catch (IOException ex) { - throw new UnmarshallingFailureException("Failed to read XML stream", ex); - } - } - @Override protected final Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource) throws XmlMappingException, IOException { @@ -602,14 +591,23 @@ public class CastorMarshaller extends AbstractMarshaller implements Initializing } } + @Override + protected final Object unmarshalXmlEventReader(XMLEventReader eventReader) { + try { + return createUnmarshaller().unmarshal(eventReader); + } + catch (XMLException ex) { + throw convertCastorException(ex, false); + } + } + @Override protected final Object unmarshalXmlStreamReader(XMLStreamReader streamReader) { - XMLReader reader = StaxUtils.createXMLReader(streamReader); try { - return unmarshalSaxReader(reader, new InputSource()); + return createUnmarshaller().unmarshal(streamReader); } - catch (IOException ex) { - throw new UnmarshallingFailureException("Failed to read XML stream", ex); + catch (XMLException ex) { + throw convertCastorException(ex, false); } }