src/com/sun/xml/internal/stream/XMLEventReaderImpl.java

Print this page

        

@@ -246,12 +246,14 @@
         Object object = null;
         try{
             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;
     }
 
     public XMLEvent peek() throws XMLStreamException{