@@ -89,7 +89,7 @@ class StreamingRowIterator implements CloseableIterator<Row> {
8989 final Set <Integer > hiddenColumns , final Map <Integer , Float > columnWidths ,
9090 final Set <CellRangeAddress > mergedCells , final Set <HyperlinkData > hyperlinks ,
9191 final Map <String , SharedFormula > sharedFormulaMap , final float defaultRowHeight ,
92- final StreamingSheet sheet ) throws ParseException {
92+ final StreamingSheet sheet ) throws XMLStreamException {
9393 this .streamingSheetReader = streamingSheetReader ;
9494 this .sst = sst ;
9595 this .stylesTable = stylesTable ;
@@ -118,17 +118,13 @@ private float getDefaultRowHeight() {
118118 *
119119 * @return true if data was read
120120 */
121- private boolean getRow () throws ParseException {
122- try {
123- rowCache .clear ();
124- while (rowCache .size () < rowCacheSize && parser .hasNext ()) {
125- handleEvent (parser .nextEvent ());
126- }
127- rowCacheIterator = rowCache .iterator ();
128- return rowCacheIterator .hasNext ();
129- } catch (XMLStreamException e ) {
130- throw new ParseException ("Error reading XML stream" , e );
121+ private boolean getRow () throws XMLStreamException {
122+ rowCache .clear ();
123+ while (rowCache .size () < rowCacheSize && parser .hasNext ()) {
124+ handleEvent (parser .nextEvent ());
131125 }
126+ rowCacheIterator = rowCache .iterator ();
127+ return rowCacheIterator .hasNext ();
132128 }
133129
134130 private void handleEvent (XMLEvent event ) {
@@ -630,9 +626,17 @@ private String getAttributeValue(Attribute att) {
630626 return att == null ? null : att .getValue ();
631627 }
632628
629+ /**
630+ * @return whether there are more rows
631+ * @throws ParseException if there is an error parsing the underlying data
632+ */
633633 @ Override
634634 public boolean hasNext () throws ParseException {
635- return (rowCacheIterator != null && rowCacheIterator .hasNext ()) || getRow ();
635+ try {
636+ return (rowCacheIterator != null && rowCacheIterator .hasNext ()) || getRow ();
637+ } catch (XMLStreamException e ) {
638+ throw new ParseException (e );
639+ }
636640 }
637641
638642 @ Override
0 commit comments