7144423: StAX EventReader swallows the cause of error
authorjoehw
Tue, 12 Jun 2012 10:23:49 -0700
changeset 13062 ee5778a552cb
parent 13061 7dfa5735cbc2
child 13063 c1602d72983b
7144423: StAX EventReader swallows the cause of error Summary: make sure the cause of the error is properly reported Reviewed-by: lancea, psandoz
jaxp/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java
--- a/jaxp/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java	Mon Jun 11 15:47:01 2012 -0700
+++ b/jaxp/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java	Tue Jun 12 10:23:49 2012 -0700
@@ -248,8 +248,11 @@
             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;
     }