Program: 188629
Project: 188629
Buggy source:
private void processAIPPermissions(IndexService index,ModelService model,Job currentJob,AIP aip,Report reportItem){
  try {
    AIP parentAIP=null;
    String jobCreatorUsername=currentJob.getUsername();
    if (aip.getParentId() != null) {
      try {
        parentAIP=model.retrieveAIP(aip.getParentId());
        Set<PermissionType> userPermissions=parentAIP.getPermissions().getUserPermissions(jobCreatorUsername);
        LOGGER.trace("String_Node_Str",jobCreatorUsername,parentAIP.getId(),userPermissions);
        if (userPermissions.contains(PermissionType.CREATE)) {
          LOGGER.debug("String_Node_Str",jobCreatorUsername);
        }
 else {
          LOGGER.debug("String_Node_Str",jobCreatorUsername);
          reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(NO_PERMISSION_TO_CREATE_UNDER_AIP);
        }
      }
 catch (      NotFoundException nfe) {
        reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(PARENT_AIP_NOT_FOUND);
      }
catch (      AuthorizationDeniedException e) {
        LOGGER.debug("String_Node_Str");
        reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(NO_AIP_PERMISSION);
      }
    }
 else {
      RODAMember member=index.retrieve(RODAMember.class,jobCreatorUsername);
      if (member.getAllRoles().contains(CREATE_TOP_LEVEL_AIP_PERMISSION)) {
        LOGGER.debug("String_Node_Str");
      }
 else {
        reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(NO_CREATE_TOP_LEVEL_AIP_PERMISSION);
        LOGGER.debug("String_Node_Str");
      }
    }
  }
 catch (  GenericException|RequestNotValidException|NotFoundException e) {
    reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(e.getMessage());
  }
}

Fixed version (ground truth):
private void processAIPPermissions(IndexService index,ModelService model,Job currentJob,AIP aip,Report reportItem){
  try {
    AIP parentAIP=null;
    String jobCreatorUsername=currentJob.getUsername();
    if (aip.getParentId() != null) {
      try {
        parentAIP=model.retrieveAIP(aip.getParentId());
        Set<PermissionType> userPermissions=parentAIP.getPermissions().getUserPermissions(jobCreatorUsername);
        LOGGER.trace("String_Node_Str",jobCreatorUsername,parentAIP.getId(),userPermissions);
        if (userPermissions.contains(PermissionType.CREATE)) {
          LOGGER.debug("String_Node_Str",jobCreatorUsername);
        }
 else {
          LOGGER.debug("String_Node_Str",jobCreatorUsername);
          reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(NO_PERMISSION_TO_CREATE_UNDER_AIP);
        }
      }
 catch (      NotFoundException nfe) {
        reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(PARENT_AIP_NOT_FOUND);
      }
catch (      AuthorizationDeniedException e) {
        LOGGER.debug("String_Node_Str");
        reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(NO_AIP_PERMISSION);
      }
    }
 else {
      RODAMember member=index.retrieve(RODAMember.class,jobCreatorUsername);
      if (member.getAllRoles().contains(CREATE_TOP_LEVEL_AIP_PERMISSION) || member.getName().equals("String_Node_Str")) {
        LOGGER.debug("String_Node_Str");
      }
 else {
        reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(NO_CREATE_TOP_LEVEL_AIP_PERMISSION);
        LOGGER.debug("String_Node_Str");
      }
    }
  }
 catch (  GenericException|RequestNotValidException|NotFoundException e) {
    reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(e.getMessage());
  }
}