If the number of qualifications is more than the length of one page, getAllQualificationsForQualificationType will loop forever because pageNum is never incremented. Just adding pageNum++ at the bottom of the loop fixes it:
public Qualification[] getAllQualificationsForQualificationType(String qualificationTypeId) throws Exception {
List<Qualification> results = new ArrayList<Qualification>();
int pageNum = 1;
do {
Qualification[] qualifications =
this.getQualificationsForQualificationType(qualificationTypeId, pageNum);
if (qualifications != null) {
// Add the results
Collections.addAll(results, qualifications);
}
if (qualifications == null || qualifications.length < DEFAULT_PAGE_SIZE) {
// Check if we're on the last page or not
break;
}
// PATCH
pageNum++;
// ENDPATCH
} while (true);
return (Qualification[]) results.toArray(new Qualification[results.size()]);
}