Program: 98889
Project: 98889
Buggy source:
/** 
 * Perform a new deliver for current user to the given activity
 * @param deliver Deliver object with all the files
 * @param activityID Identifier for the target activity
 * @return Results obtained from the analisis of this deliver
 * @throws AuthPelpException If the user is not authenticated.
 * @throws InvalidActivityPelpException If the user cannot perform delivers to this activity, because is not a student or all allowed delivers are performed.
 * @throws ExecPelpException When files cannot be accessed or for some missconfiguration of the analyzer module.
 */
@Override public DeliverResults createNewDeliver(Deliver deliver,ActivityID activityID) throws AuthPelpException, InvalidActivityPelpException, ExecPelpException {
  if (!isUserAuthenticated()) {
    throw new AuthPelpException("String_Node_Str");
  }
  Activity activity=_activityManager.getActivity(activityID);
  if (activity == null) {
    throw new InvalidActivityPelpException("String_Node_Str");
  }
  if (!isStudent(activityID.subjectID)) {
    throw new AuthPelpException("String_Node_Str");
  }
  for (  IClassroomID classroom : _campusConnection.getUserClassrooms(UserRoles.Student,activityID.subjectID)) {
    deliver.addMainClassroom(classroom);
  }
  ISubjectID[] labSubjects=_administrationManager.getLabSubjectOfMain(activityID.subjectID);
  if (labSubjects != null && labSubjects.length > 0) {
    boolean hasLab=false;
    for (    ISubjectID labSubjectID : labSubjects) {
      if (hasLab) {
        break;
      }
      for (      IClassroomID classroom : _campusConnection.getUserClassrooms(UserRoles.Student,labSubjectID)) {
        deliver.addLabClassroom(classroom);
        hasLab=true;
        break;
      }
    }
  }
  int numDelivers=_deliverManager.getNumUserDelivers(_campusConnection.getUserID(),activityID);
  if (activity.getMaxDelivers() != null) {
    if (numDelivers >= activity.getMaxDelivers()) {
      throw new InvalidActivityPelpException("String_Node_Str");
    }
  }
  DeliverID deliverID=_deliverManager.addDeliver(_campusConnection.getUserID(),activityID,deliver);
  if (deliverID == null) {
    throw new ExecPelpException("String_Node_Str");
  }
  Deliver newDeliver=_deliverManager.getDeliver(deliverID);
  if (newDeliver == null) {
    throw new ExecPelpException("String_Node_Str");
  }
  TestID[] testID=_activityManager.getActivityTests(activityID);
  ActivityTest[] tests=null;
  if (testID.length > 0) {
    tests=new ActivityTest[testID.length];
    for (int i=0; i < testID.length; i++) {
      tests[i]=_activityManager.getTest(testID[i]);
    }
  }
  CodeProject project=newDeliver.getCodeProject();
  project.setLanguage(activity.getLanguage());
  AnalysisResults analysisResults=analyzeCode(project,tests);
  if (!_deliverManager.addResults(deliverID,analysisResults)) {
    throw new ExecPelpException("String_Node_Str");
  }
  return _deliverManager.getResults(deliverID);
}

Fixed version (ground truth):
/** 
 * Perform a new deliver for current user to the given activity
 * @param deliver Deliver object with all the files
 * @param activityID Identifier for the target activity
 * @return Results obtained from the analisis of this deliver
 * @throws AuthPelpException If the user is not authenticated.
 * @throws InvalidActivityPelpException If the user cannot perform delivers to this activity, because is not a student or all allowed delivers are performed.
 * @throws ExecPelpException When files cannot be accessed or for some missconfiguration of the analyzer module.
 */
@Override public DeliverResults createNewDeliver(Deliver deliver,ActivityID activityID) throws AuthPelpException, InvalidActivityPelpException, ExecPelpException {
  if (!isUserAuthenticated()) {
    throw new AuthPelpException("String_Node_Str");
  }
  Activity activity=_activityManager.getActivity(activityID);
  if (activity == null) {
    throw new InvalidActivityPelpException("String_Node_Str");
  }
  if (!isStudent(activityID.subjectID)) {
    throw new AuthPelpException("String_Node_Str");
  }
  for (  IClassroomID classroom : _campusConnection.getUserClassrooms(UserRoles.Student,activityID.subjectID)) {
    deliver.addMainClassroom(classroom);
  }
  ISubjectID[] labSubjects=_administrationManager.getLabSubjectOfMain(activityID.subjectID);
  if (labSubjects != null && labSubjects.length > 0) {
    boolean hasLab=false;
    for (    ISubjectID labSubjectID : labSubjects) {
      if (hasLab) {
        break;
      }
      for (      IClassroomID classroom : _campusConnection.getUserClassrooms(UserRoles.Student,labSubjectID)) {
        deliver.addLabClassroom(classroom);
        hasLab=true;
        break;
      }
    }
  }
  int numDelivers=_deliverManager.getNumUserDelivers(_campusConnection.getUserID(),activityID);
  if (activity.getMaxDelivers() != null) {
    if (numDelivers >= activity.getMaxDelivers()) {
      throw new InvalidActivityPelpException("String_Node_Str");
    }
  }
  DeliverID deliverID=_deliverManager.addDeliver(_campusConnection.getUserID(),activityID,deliver);
  if (deliverID == null) {
    throw new ExecPelpException("String_Node_Str");
  }
  Deliver newDeliver=_deliverManager.getDeliver(deliverID);
  if (newDeliver == null) {
    throw new ExecPelpException("String_Node_Str");
  }
  TestID[] testID=_activityManager.getActivityTests(activityID);
  ActivityTest[] tests=null;
  if (testID.length > 0) {
    tests=new ActivityTest[testID.length];
    for (int i=0; i < testID.length; i++) {
      tests[i]=_activityManager.getTest(testID[i]);
    }
  }
  CodeProject project=newDeliver.getCodeProject();
  project.setLanguage(activity.getLanguage());
  AnalysisResults analysisResults=analyzeCode(project,tests);
  if (!_deliverManager.addResults(deliverID,analysisResults)) {
    throw new ExecPelpException("String_Node_Str");
  }
  DeliverResults results=_deliverManager.getResults(deliverID);
  removePrivateResultInformation(results);
  return results;
}