@Override protected void jumpToItem(int itemIndex) throws Exception { for (int i = 0; i < itemIndex; i++) { try { QName fragmentName = readToStartFragment(); readToEndFragment(fragmentName); } catch (NoSuchElementException e) { if (itemIndex == (i + 1)) { // we can presume a NoSuchElementException on the last item means the EOF was reached on the last run return; } else { // if NoSuchElementException occurs on an item other than the last one, this indicates a problem throw e; } } } }
@Override protected void jumpToItem(int itemIndex) throws Exception { for (int i = 0; i < itemIndex; i++) { try { QName fragmentName = readToStartFragment(); readToEndFragment(fragmentName); } catch (NoSuchElementException e) { if (itemIndex == (i + 1)) { // we can presume a NoSuchElementException on the last item means the EOF was reached on the last run return; } else { // if NoSuchElementException occurs on an item other than the last one, this indicates a problem throw e; } } } }