7144423: StAX EventReader swallows the cause of error

Make sure the cause of the error is properly reported

Reviewed-by: lancea, psandoz
This commit is contained in:
Joe Wang 2012-06-12 10:23:49 -07:00
parent e881068530
commit 94d67fa6a5

View File

@ -248,8 +248,11 @@ public class XMLEventReaderImpl implements javax.xml.stream.XMLEventReader{
object = nextEvent();
}catch(XMLStreamException streamException){
fLastEvent = null ;
//xxx: what should be done in this case ?
throw new NoSuchElementException();
//don't swallow the cause
NoSuchElementException e = new NoSuchElementException(streamException.getMessage());
e.initCause(streamException.getCause());
throw e;
}
return object;
}