Program: 38206
Project: 38206
Buggy source:
/** 
 * Method used to create command objects together with CommandFactory.
 * @param a JSON string.
 * @param a RESTful-header.
 * @param a enumeration that determines command type.
 * @return a Command of the correct type.
 */
private Command createCommand(String json,String restful,String username,CommandType cmdt){
  Command newCommand=null;
  if (cmdt == CommandType.DELETE_ANNOTATION_VALUE_COMMAND) {
    String[] rest=restful.split("String_Node_Str");
    newCommand=cmdFactory.createDeleteAnnotationValueCommand(json,rest[3],rest[4]);
  }
  String parsedRest=parseRest(restful);
  if (cmdt == CommandType.LOGIN_COMMAND) {
    newCommand=cmdFactory.createLoginCommand(json);
  }
 else   if (cmdt == CommandType.LOGOUT_COMMAND) {
    newCommand=cmdFactory.createLogoutCommand(username);
  }
 else   if (cmdt == CommandType.RETRIEVE_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createRetrieveExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.ADD_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createAddExperimentCommand(json);
  }
 else   if (cmdt == CommandType.UPDATE_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createUpdateExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.REMOVE_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createRemoveExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.GET_FILE_FROM_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createGetFileFromExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.ADD_FILE_TO_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createAddFileToExperimentCommand(json);
  }
 else   if (cmdt == CommandType.UPDATE_FILE_IN_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createUpdateFileInExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.DELETE_FILE_FROM_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createDeleteFileFromExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.SEARCH_FOR_EXPERIMENTS_COMMAND) {
    newCommand=cmdFactory.createSearchForExperimentCommand(parsedRest);
  }
 else   if (cmdt == CommandType.UPDATE_USER_COMMAND) {
    newCommand=cmdFactory.createUpdateUserCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.DELETE_USER_COMMAND) {
    newCommand=cmdFactory.createDeleteUserCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.PROCESS_COMMAND) {
    newCommand=cmdFactory.createProcessCommand(json,username);
  }
 else   if (cmdt == CommandType.GET_ANNOTATION_INFORMATION_COMMAND) {
    newCommand=cmdFactory.createGetAnnotationInformationCommand(json);
  }
 else   if (cmdt == CommandType.ADD_ANNOTATION_FIELD_COMMAND) {
    newCommand=cmdFactory.createAddAnnotationFieldCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.ADD_ANNOTATION_VALUE_COMMAND) {
    newCommand=cmdFactory.createAddAnnotationValueCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.RENAME_ANNOTATION_VALUE_COMMAND) {
    newCommand=cmdFactory.creatRenameAnnotationValueCommand(json);
  }
 else   if (cmdt == CommandType.REMOVE_ANNOTATION_FIELD_COMMAND) {
    newCommand=cmdFactory.createRemoveAnnotationFieldCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.GET_ANNOTATION_PRIVILEGES_COMMAND) {
    newCommand=cmdFactory.createGetAnnotationPrivilegesCommand(json);
  }
 else   if (cmdt == CommandType.UPDATE_ANNOTATION_PRIVILEGES_COMMAND) {
    newCommand=cmdFactory.createUpdateAnnotationPrivilegesCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.ADD_GENOME_RELEASE_COMMAND) {
    newCommand=cmdFactory.createAddGenomeReleaseCommand(json);
  }
 else   if (cmdt == CommandType.DELETE_GENOME_RELEASE_COMMAND) {
    newCommand=cmdFactory.createDeleteGenomeReleaseCommand(json);
  }
  return newCommand;
}

Fixed version (ground truth):
/** 
 * Method used to create command objects together with CommandFactory.
 * @param a JSON string.
 * @param a RESTful-header.
 * @param a enumeration that determines command type.
 * @return a Command of the correct type.
 */
private Command createCommand(String json,String restful,String username,CommandType cmdt){
  Command newCommand=null;
  if (cmdt == CommandType.DELETE_ANNOTATION_VALUE_COMMAND) {
    String[] rest=restful.split("String_Node_Str");
    newCommand=cmdFactory.createDeleteAnnotationValueCommand(json,rest[3],rest[4]);
  }
  String parsedRest=parseRest(restful);
  if (cmdt == CommandType.LOGIN_COMMAND) {
    newCommand=cmdFactory.createLoginCommand(json);
  }
 else   if (cmdt == CommandType.LOGOUT_COMMAND) {
    newCommand=cmdFactory.createLogoutCommand(username);
  }
 else   if (cmdt == CommandType.RETRIEVE_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createRetrieveExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.ADD_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createAddExperimentCommand(json);
  }
 else   if (cmdt == CommandType.UPDATE_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createUpdateExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.REMOVE_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createRemoveExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.GET_FILE_FROM_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createGetFileFromExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.ADD_FILE_TO_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createAddFileToExperimentCommand(json);
  }
 else   if (cmdt == CommandType.UPDATE_FILE_IN_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createUpdateFileInExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.DELETE_FILE_FROM_EXPERIMENT_COMMAND) {
    newCommand=cmdFactory.createDeleteFileFromExperimentCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.SEARCH_FOR_EXPERIMENTS_COMMAND) {
    newCommand=cmdFactory.createSearchForExperimentCommand(parsedRest);
  }
 else   if (cmdt == CommandType.UPDATE_USER_COMMAND) {
    newCommand=cmdFactory.createUpdateUserCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.DELETE_USER_COMMAND) {
    newCommand=cmdFactory.createDeleteUserCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.PROCESS_COMMAND) {
    newCommand=cmdFactory.createProcessCommand(json,username);
  }
 else   if (cmdt == CommandType.GET_ANNOTATION_INFORMATION_COMMAND) {
    newCommand=cmdFactory.createGetAnnotationInformationCommand(json);
  }
 else   if (cmdt == CommandType.ADD_ANNOTATION_FIELD_COMMAND) {
    newCommand=cmdFactory.createAddAnnotationFieldCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.ADD_ANNOTATION_VALUE_COMMAND) {
    newCommand=cmdFactory.createAddAnnotationValueCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.RENAME_ANNOTATION_VALUE_COMMAND) {
    newCommand=cmdFactory.creatRenameAnnotationValueCommand(json);
  }
 else   if (cmdt == CommandType.RENAME_ANNOTATION_FIELD_COMMAND) {
    newCommand=cmdFactory.createEditAnnotationFieldCommand(json);
  }
 else   if (cmdt == CommandType.REMOVE_ANNOTATION_FIELD_COMMAND) {
    newCommand=cmdFactory.createRemoveAnnotationFieldCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.GET_ANNOTATION_PRIVILEGES_COMMAND) {
    newCommand=cmdFactory.createGetAnnotationPrivilegesCommand(json);
  }
 else   if (cmdt == CommandType.UPDATE_ANNOTATION_PRIVILEGES_COMMAND) {
    newCommand=cmdFactory.createUpdateAnnotationPrivilegesCommand(json,parsedRest);
  }
 else   if (cmdt == CommandType.ADD_GENOME_RELEASE_COMMAND) {
    newCommand=cmdFactory.createAddGenomeReleaseCommand(json);
  }
 else   if (cmdt == CommandType.DELETE_GENOME_RELEASE_COMMAND) {
    newCommand=cmdFactory.createDeleteGenomeReleaseCommand(json);
  }
  return newCommand;
}