# HG changeset patch # User joehw # Date 1339524004 25200 # Node ID 0a1789d9f5be34f3caed741252f0a2cee7d93e2b # Parent 9d758706c2948b8b1d47c3f7bea3cc2a6a2b87f7 7144423: StAX EventReader swallows the cause of error Summary: make sure the cause of the error is properly reported Reviewed-by: lancea, psandoz diff -r 9d758706c294 -r 0a1789d9f5be src/com/sun/xml/internal/stream/XMLEventReaderImpl.java --- a/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java Mon Jun 11 11:45:42 2012 -0700 +++ b/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java Tue Jun 12 11:00:04 2012 -0700 @@ -248,8 +248,10 @@ 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; }