@ Override public synchronized ConsumerJournalEntry readJournalEntry ( ) throws JournalException , XMLStreamException { if ( ! open ) { return null ; } if ( ! advancedPastHeader ) { advanceIntoFile ( ) ; advancedPastHeader = true ; } XMLEvent next = reader . peek ( ) ; // advance past any whitespace events. while ( next . isCharacters ( ) && next . asCharacters ( ) . isWhiteSpace ( ) ) { reader . nextEvent ( ) ; next = reader . peek ( ) ; } if ( isStartTagEvent ( next , QNAME_TAG_JOURNAL_ENTRY ) ) { String identifier = peekAtJournalEntryIdentifier ( ) ; ConsumerJournalEntry journalEntry = super . readJournalEntry ( reader ) ; journalEntry . setIdentifier ( identifier ) ; return journalEntry ; } else if ( isEndTagEvent ( next , QNAME_TAG_JOURNAL ) ) { return null ; } else { throw getNotNextMemberOrEndOfGroupException ( QNAME_TAG_JOURNAL , QNAME_TAG_JOURNAL_ENTRY , next ) ; } }
Advance past any white space and then see whether we have any more JournalEntry tags . If we don t just return null .