code: public Revision getDiscussionRevisionForArticleRevision(int revisionId) throws WikiApiException, WikiPageNotFoundException{
  		//get article revision
  		Revision rev = revApi.getRevision(revisionId);
  		Timestamp revTime = rev.getTimeStamp();
  
  		//get corresponding discussion page
  		Page discussion = wiki.getDiscussionPage(rev.getArticleID());
  
  		/*
  		 * find correct revision of discussion page
  		 */
  		List<Timestamp> discussionTs = revApi.getRevisionTimestamps(discussion.getPageId());
  
  		// sort in reverse order - newest first
  		Collections.sort(discussionTs, new Comparator<Timestamp>()
  		{
  			public int compare(Timestamp ts1, Timestamp ts2)
  			{
  				return ts2.compareTo(ts1);
  			}
  		});
  
  		//find first timestamp equal to or before the article revision timestamp
  		for(Timestamp curDiscTime:discussionTs){
  			if(curDiscTime==revTime||curDiscTime.before(revTime)){
  				return revApi.getRevision(discussion.getPageId(), curDiscTime);
  			}
  		}
  
  		throw new WikiPageNotFoundException("Not discussion page was available at the time of the given article revision");
  	}
docs: For a given article revision, the method returns the revision of the article discussion
  page which was current at the time the revision was created.
  
  @param revisionId revision of the article for which the talk page revision should be retrieved
  @return the revision of the talk page that was current at the creation time of the given article revision
  @throws WikiApiException if any error occurred accessing the Wiki db
  @throws WikiPageNotFoundException if no discussion page was available at the time of the given article revision