@Override public Revision next(){
  try {
    int revCount, articleID;
    revCount=result.getInt(3);
    articleID=result.getInt(5);
    if (articleID != this.currentArticleID) {
      this.currentRevCounter=0;
      this.currentArticleID=articleID;
    }
    if (revCount - 1 != this.currentRevCounter) {
      logger.error("\nInvalid RevCounter -" + " [ArticleId " + articleID + ", RevisionId "+ result.getInt(4)+ ", RevisionCounter "+ result.getInt(3)+ "] - Expected: "+ (this.currentRevCounter + 1));
      this.currentRevCounter=revCount;
      this.previousRevision=null;
      return null;
    }
    this.currentRevCounter=revCount;
    this.primaryKey=result.getInt(1);
    Revision revision=new Revision(revCount);
    revision.setPrimaryKey(this.primaryKey);
    if (!shouldLoadRevisionText) {
      String currentRevision;
      Diff diff;
      RevisionDecoder decoder=new RevisionDecoder(config.getCharacterSet());
      if (binaryData) {
        decoder.setInput(result.getBinaryStream(2),true);
      }
 else {
        decoder.setInput(result.getString(2));
      }
      diff=decoder.decode();
      try {
        currentRevision=diff.buildRevision(previousRevision);
      }
 catch (      Exception e) {
        this.previousRevision=null;
        logger.error("Reconstruction failed -" + " [ArticleId " + result.getInt(5) + ", RevisionId "+ result.getInt(4)+ ", RevisionCounter "+ result.getInt(3)+ "]");
        return null;
      }
      previousRevision=currentRevision;
      revision.setRevisionText(currentRevision);
    }
 else {
      if (revApi == null) {
        revApi=new RevisionApi(config);
      }
      revision.setRevisionApi(revApi);
    }
    revision.setRevisionID(result.getInt(4));
    revision.setArticleID(articleID);
    revision.setTimeStamp(new Timestamp(result.getLong(6)));
    revision.setFullRevisionID(result.getInt(7));
    revision.setContributorName(result.getString(8));
    revision.setContributorId(result.getInt(9));
    revision.setComment(result.getString(10));
    revision.setMinor(result.getBoolean(11));
    revision.setContributorIsRegistered(result.getBoolean(12));
    return revision;
  }
 catch (  DecodingException e) {
    throw new RuntimeException(e);
  }
catch (  SQLException e) {
    throw new RuntimeException(e);
  }
catch (  IOException e) {
    throw new RuntimeException(e);
  }
catch (  WikiApiException e) {
    throw new RuntimeException(e);
  }
}

@ Override public Revision next ( ) { try { int revCount , articleID ; revCount = result . getInt ( 3 ) ; articleID = result . getInt ( 5 ) ; if ( articleID != this . currentArticleID ) { this . currentRevCounter = 0 ; this . currentArticleID = articleID ; } if ( revCount - 1 != this . currentRevCounter ) { logger . error ( "\nInvalid RevCounter -" + " [ArticleId " + articleID + ", RevisionId " + result . getInt ( 4 ) + ", RevisionCounter " + result . getInt ( 3 ) + "] - Expected: " + ( this . currentRevCounter + 1 ) ) ; this . currentRevCounter = revCount ; this . previousRevision = null ; return null ; } this . currentRevCounter = revCount ; this . primaryKey = result . getInt ( 1 ) ; Revision revision = new Revision ( revCount ) ; revision . setPrimaryKey ( this . primaryKey ) ; if ( ! shouldLoadRevisionText ) { String currentRevision ; Diff diff ; RevisionDecoder decoder = new RevisionDecoder ( config . getCharacterSet ( ) ) ; if ( binaryData ) { decoder . setInput ( result . getBinaryStream ( 2 ) , true ) ; } else { decoder . setInput ( result . getString ( 2 ) ) ; } diff = decoder . decode ( ) ; try { currentRevision = diff . buildRevision ( previousRevision ) ; } catch ( Exception e ) { this . previousRevision = null ; logger . error ( "Reconstruction failed -" + " [ArticleId " + result . getInt ( 5 ) + ", RevisionId " + result . getInt ( 4 ) + ", RevisionCounter " + result . getInt ( 3 ) + "]" ) ; return null ; } previousRevision = currentRevision ; revision . setRevisionText ( currentRevision ) ; } else { if ( revApi == null ) { revApi = new RevisionApi ( config ) ; } revision . setRevisionApi ( revApi ) ; } revision . setRevisionID ( result . getInt ( 4 ) ) ; revision . setArticleID ( articleID ) ; revision . setTimeStamp ( new Timestamp ( result . getLong ( 6 ) ) ) ; revision . setFullRevisionID ( result . getInt ( 7 ) ) ; revision . setContributorName ( result . getString ( 8 ) ) ; revision . setContributorId ( result . getInt ( 9 ) ) ; revision . setComment ( result . getString ( 10 ) ) ; revision . setMinor ( result . getBoolean ( 11 ) ) ; revision . setContributorIsRegistered ( result . getBoolean ( 12 ) ) ; return revision ; } catch ( DecodingException e ) { throw new RuntimeException ( e ) ; } catch ( SQLException e ) { throw new RuntimeException ( e ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } catch ( WikiApiException e ) { throw new RuntimeException ( e ) ; } }
returns the next revision .
