nus-yam/ex-repair huggingface dataset:
Program: 188514
Project: 188514
Buggy source:
private void createEvent(VirusCheckResult virusCheckResult,Exception exception,PluginState state,AIP aip,ModelService model,IndexService index,boolean notify) throws PluginException {
  try {
    StringBuilder outcomeDetailExtension=new StringBuilder(virusCheckResult.getReport());
    if (state != PluginState.SUCCESS && exception != null) {
      outcomeDetailExtension.append("String_Node_Str").append(exception.getClass().getName()).append("String_Node_Str").append(exception.getMessage());
    }
    PluginHelper.createPluginEvent(this,aip.getId(),model,index,state,outcomeDetailExtension.toString(),notify);
  }
 catch (  RequestNotValidException|NotFoundException|GenericException|AuthorizationDeniedException|ValidationException|AlreadyExistsException e) {
    throw new PluginException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private void createEvent(VirusCheckResult virusCheckResult,Exception exception,PluginState state,AIP aip,ModelService model,IndexService index,boolean notify) throws PluginException {
  try {
    StringBuilder outcomeDetailExtension=new StringBuilder();
    outcomeDetailExtension.append(virusCheckResult == null ? "String_Node_Str" : virusCheckResult.getReport());
    if (state != PluginState.SUCCESS && exception != null) {
      outcomeDetailExtension.append("String_Node_Str").append(exception.getClass().getName()).append("String_Node_Str").append(exception.getMessage());
    }
    PluginHelper.createPluginEvent(this,aip.getId(),model,index,state,outcomeDetailExtension.toString(),notify);
  }
 catch (  RequestNotValidException|NotFoundException|GenericException|AuthorizationDeniedException|ValidationException|AlreadyExistsException e) {
    throw new PluginException("String_Node_Str",e);
  }
}
Program: 188515
Project: 188515
Buggy source:
private static String getSiegfriedServerEndpoint(Path sourceDirectory){
  String siegfriedServer=RodaCoreFactory.getRodaConfigurationAsString("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  String endpoint=siegfriedServer + "String_Node_Str" + new String(Base64.encode(sourceDirectory.toString().getBytes()));
  return endpoint;
}

Fixed version (ground truth):
private static String getSiegfriedServerEndpoint(Path sourceDirectory){
  String siegfriedServer=RodaCoreFactory.getRodaConfigurationAsString("String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  return String.format("String_Node_Str",siegfriedServer,new String(Base64.encode(sourceDirectory.toString().getBytes())));
}
Program: 188517
Project: 188517
Buggy source:
public void acknowledgeNotification(String notificationId,String token) throws GenericException, NotFoundException, AuthorizationDeniedException {
  Notification notification=this.retrieveNotification(notificationId);
  String ackToken=token.substring(0,36);
  String emailToken=token.substring(36);
  if (notification.getAcknowledgeToken().equals(ackToken)) {
    for (    String recipient : notification.getRecipientUsers()) {
      if (recipient.equals(emailToken)) {
        DateFormat df=DateFormat.getDateTimeInstance();
        String ackDate=df.format(new Date());
        notification.addAcknowledgedUser(recipient,ackDate);
        notification.setAcknowledged(true);
        this.updateNotification(notification);
      }
    }
  }
}

Fixed version (ground truth):
public void acknowledgeNotification(String notificationId,String token) throws GenericException, NotFoundException, AuthorizationDeniedException {
  Notification notification=this.retrieveNotification(notificationId);
  String ackToken=token.substring(0,36);
  String emailToken=token.substring(36);
  if (notification.getAcknowledgeToken().equals(ackToken)) {
    for (    String recipient : notification.getRecipientUsers()) {
      String recipientUUID=UUID.nameUUIDFromBytes(recipient.getBytes()).toString();
      if (recipientUUID.equals(emailToken)) {
        DateFormat df=DateFormat.getDateTimeInstance();
        String ackDate=df.format(new Date());
        notification.addAcknowledgedUser(recipient,ackDate);
        notification.setAcknowledged(true);
        this.updateNotification(notification);
      }
    }
  }
}
Program: 188518
Project: 188518
Buggy source:
@Override public void onSuccessImpl(Void result){
  Toast.showInfo(messages.dialogDone(),messages.allItemsWereAccepted());
  mainSearch.refresh();
}

Fixed version (ground truth):
@Override public void onSuccessImpl(Void result){
  Toast.showInfo(messages.dialogDone(),messages.allItemsWereRejected());
  mainSearch.refresh();
  acceptButton.setEnabled(false);
  rejectButton.setEnabled(false);
}
Program: 188519
Project: 188519
Buggy source:
@SuppressWarnings("String_Node_Str") @UiHandler("String_Node_Str") void buttonAcceptHandler(ClickEvent e){
  boolean accept=true;
  SelectedItems<?> selected=mainSearch.getSelected();
  String rejectReason=null;
  BrowserService.Util.getInstance().appraisal((SelectedItems<IndexedAIP>)selected,accept,rejectReason,new LoadingAsyncCallback<Void>(){
    @Override public void onSuccessImpl(    Void result){
      Toast.showInfo(messages.dialogDone(),messages.allItemsWereAccepted());
      mainSearch.refresh();
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @UiHandler("String_Node_Str") void buttonAcceptHandler(ClickEvent e){
  boolean accept=true;
  SelectedItems<?> selected=mainSearch.getSelected();
  String rejectReason=null;
  BrowserService.Util.getInstance().appraisal((SelectedItems<IndexedAIP>)selected,accept,rejectReason,new LoadingAsyncCallback<Void>(){
    @Override public void onSuccessImpl(    Void result){
      Toast.showInfo(messages.dialogDone(),messages.allItemsWereAccepted());
      mainSearch.refresh();
      acceptButton.setEnabled(false);
      rejectButton.setEnabled(false);
    }
  }
);
}
Program: 188520
Project: 188520
Buggy source:
@UiHandler("String_Node_Str") void buttonRejectHandler(ClickEvent e){
  final boolean accept=false;
  final SelectedItems<?> selected=mainSearch.getSelected();
  Dialogs.showPromptDialog(messages.rejectMessage(),messages.rejectSIPQuestion(),null,RegExp.compile("String_Node_Str"),messages.dialogCancel(),messages.dialogOk(),new AsyncCallback<String>(){
    @Override public void onFailure(    Throwable caught){
    }
    @SuppressWarnings("String_Node_Str") @Override public void onSuccess(    final String rejectReason){
      BrowserService.Util.getInstance().appraisal((SelectedItems<IndexedAIP>)selected,accept,rejectReason,new LoadingAsyncCallback<Void>(){
        @Override public void onSuccessImpl(        Void result){
          Toast.showInfo(messages.dialogDone(),messages.allItemsWereAccepted());
          mainSearch.refresh();
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonRejectHandler(ClickEvent e){
  final boolean accept=false;
  final SelectedItems<?> selected=mainSearch.getSelected();
  Dialogs.showPromptDialog(messages.rejectMessage(),messages.rejectSIPQuestion(),null,RegExp.compile("String_Node_Str"),messages.dialogCancel(),messages.dialogOk(),new AsyncCallback<String>(){
    @Override public void onFailure(    Throwable caught){
    }
    @SuppressWarnings("String_Node_Str") @Override public void onSuccess(    final String rejectReason){
      BrowserService.Util.getInstance().appraisal((SelectedItems<IndexedAIP>)selected,accept,rejectReason,new LoadingAsyncCallback<Void>(){
        @Override public void onSuccessImpl(        Void result){
          Toast.showInfo(messages.dialogDone(),messages.allItemsWereRejected());
          mainSearch.refresh();
          acceptButton.setEnabled(false);
          rejectButton.setEnabled(false);
        }
      }
);
    }
  }
);
}
Program: 188521
Project: 188521
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void onSuccess(final String rejectReason){
  BrowserService.Util.getInstance().appraisal((SelectedItems<IndexedAIP>)selected,accept,rejectReason,new LoadingAsyncCallback<Void>(){
    @Override public void onSuccessImpl(    Void result){
      Toast.showInfo(messages.dialogDone(),messages.allItemsWereAccepted());
      mainSearch.refresh();
    }
  }
);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void onSuccess(final String rejectReason){
  BrowserService.Util.getInstance().appraisal((SelectedItems<IndexedAIP>)selected,accept,rejectReason,new LoadingAsyncCallback<Void>(){
    @Override public void onSuccessImpl(    Void result){
      Toast.showInfo(messages.dialogDone(),messages.allItemsWereRejected());
      mainSearch.refresh();
      acceptButton.setEnabled(false);
      rejectButton.setEnabled(false);
    }
  }
);
}
Program: 188522
Project: 188522
Buggy source:
@UiHandler("String_Node_Str") void buttonAppraisalHandler(ClickEvent e){
  HistoryUtils.newHistory(IngestAppraisal.RESOLVER,RodaConstants.INGEST_JOB_ID,job.getId());
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonAppraisalHandler(ClickEvent e){
  HistoryUtils.newHistory(IngestAppraisal.RESOLVER,RodaConstants.SEARCH_ITEMS,RodaConstants.INGEST_JOB_ID,job.getId());
}
Program: 188526
Project: 188526
Buggy source:
public static String executeRsyncAgents(boolean hasCompression) throws CommandException {
  String dataTarget=RodaCoreFactory.getRodaConfigurationAsString("String_Node_Str","String_Node_Str","String_Node_Str");
  if (dataTarget == null) {
    return PROPERTIES_ERROR_MESSAGE;
  }
  List<String> rsyncCommand=addInitialCommandPart(hasCompression);
  Path sourceAgentPath=RodaCoreFactory.getDataPath().resolve(RodaConstants.CORE_STORAGE_FOLDER).resolve(RodaConstants.STORAGE_CONTAINER_PRESERVATION).resolve(RodaConstants.STORAGE_CONTAINER_PRESERVATION_AGENTS);
  String targetAgentPath=dataTarget + "String_Node_Str" + RodaConstants.CORE_STORAGE_FOLDER+ "String_Node_Str"+ RodaConstants.STORAGE_CONTAINER_PRESERVATION+ "String_Node_Str"+ RodaConstants.STORAGE_CONTAINER_PRESERVATION_AGENTS+ "String_Node_Str";
  rsyncCommand.add(sourceAgentPath + "String_Node_Str");
  rsyncCommand.add(targetAgentPath);
  LOGGER.debug("String_Node_Str",rsyncCommand);
  return CommandUtility.execute(rsyncCommand);
}

Fixed version (ground truth):
public static String executeRsyncAgents(boolean hasCompression) throws CommandException {
  String dataTarget=RodaCoreFactory.getRodaConfigurationAsString("String_Node_Str","String_Node_Str","String_Node_Str");
  if (dataTarget == null) {
    return PROPERTIES_ERROR_MESSAGE;
  }
  List<String> rsyncCommand=addInitialCommandPart(hasCompression);
  Path sourceAgentPath=RodaCoreFactory.getDataPath().resolve(RodaConstants.CORE_STORAGE_FOLDER).resolve(RodaConstants.STORAGE_CONTAINER_PRESERVATION).resolve(RodaConstants.STORAGE_CONTAINER_PRESERVATION_AGENTS);
  String targetAgentPath=dataTarget + RodaConstants.CORE_STORAGE_FOLDER + "String_Node_Str"+ RodaConstants.STORAGE_CONTAINER_PRESERVATION+ "String_Node_Str"+ RodaConstants.STORAGE_CONTAINER_PRESERVATION_AGENTS+ "String_Node_Str";
  StringBuilder ret=new StringBuilder();
  if (Files.exists(sourceAgentPath)) {
    rsyncCommand.add(sourceAgentPath + "String_Node_Str");
    rsyncCommand.add(targetAgentPath);
    String output=CommandUtility.execute(rsyncCommand);
    ret.append("String_Node_Str").append(StringUtils.join(rsyncCommand,"String_Node_Str")).append("String_Node_Str");
    ret.append(output);
  }
 else {
  }
  return ret.toString();
}
Program: 188527
Project: 188527
Buggy source:
public static String executeRsyncEvent(PreservationMetadata pm,boolean hasCompression) throws CommandException {
  String dataTarget=RodaCoreFactory.getRodaConfigurationAsString("String_Node_Str","String_Node_Str","String_Node_Str");
  if (dataTarget == null) {
    return PROPERTIES_ERROR_MESSAGE;
  }
  List<String> rsyncCommand=addInitialCommandPart(hasCompression);
  Path sourceEventPath=RodaCoreFactory.getDataPath().resolve(RodaConstants.CORE_STORAGE_FOLDER).resolve(RodaConstants.STORAGE_CONTAINER_AIP).resolve(pm.getAipId()).resolve(RodaConstants.STORAGE_DIRECTORY_METADATA).resolve(RodaConstants.STORAGE_DIRECTORY_PRESERVATION).resolve(pm.getId() + RodaConstants.PREMIS_SUFFIX);
  String targetEventPath=dataTarget + "String_Node_Str" + RodaConstants.CORE_STORAGE_FOLDER+ "String_Node_Str"+ RodaConstants.STORAGE_CONTAINER_AIP+ "String_Node_Str"+ pm.getAipId()+ "String_Node_Str"+ RodaConstants.STORAGE_DIRECTORY_METADATA+ "String_Node_Str"+ RodaConstants.STORAGE_DIRECTORY_PRESERVATION+ "String_Node_Str"+ pm.getId()+ RodaConstants.PREMIS_SUFFIX+ "String_Node_Str";
  rsyncCommand.add(sourceEventPath + "String_Node_Str");
  rsyncCommand.add(targetEventPath);
  LOGGER.debug("String_Node_Str",rsyncCommand);
  return CommandUtility.execute(rsyncCommand);
}

Fixed version (ground truth):
public static String executeRsyncEvent(PreservationMetadata pm,boolean hasCompression) throws CommandException {
  String dataTarget=RodaCoreFactory.getRodaConfigurationAsString("String_Node_Str","String_Node_Str","String_Node_Str");
  if (dataTarget == null) {
    return PROPERTIES_ERROR_MESSAGE;
  }
  List<String> rsyncCommand=addInitialCommandPart(hasCompression);
  Path sourceEventPath=RodaCoreFactory.getDataPath().resolve(RodaConstants.CORE_STORAGE_FOLDER).resolve(RodaConstants.STORAGE_CONTAINER_AIP).resolve(pm.getAipId()).resolve(RodaConstants.STORAGE_DIRECTORY_METADATA).resolve(RodaConstants.STORAGE_DIRECTORY_PRESERVATION).resolve(pm.getId() + RodaConstants.PREMIS_SUFFIX);
  String targetEventPath=dataTarget + RodaConstants.CORE_STORAGE_FOLDER + "String_Node_Str"+ RodaConstants.STORAGE_CONTAINER_AIP+ "String_Node_Str"+ pm.getAipId()+ "String_Node_Str"+ RodaConstants.STORAGE_DIRECTORY_METADATA+ "String_Node_Str"+ RodaConstants.STORAGE_DIRECTORY_PRESERVATION+ "String_Node_Str"+ pm.getId()+ RodaConstants.PREMIS_SUFFIX;
  StringBuilder ret=new StringBuilder();
  if (Files.exists(sourceEventPath)) {
    rsyncCommand.add(sourceEventPath.toString());
    rsyncCommand.add(targetEventPath);
    String output=CommandUtility.execute(rsyncCommand);
    ret.append("String_Node_Str").append(StringUtils.join(rsyncCommand,"String_Node_Str")).append("String_Node_Str");
    ret.append(output);
  }
 else {
  }
  return ret.toString();
}
Program: 188529
Project: 188529
Buggy source:
@Override public List<String> getCategories(){
  return Arrays.asList(RodaConstants.PLUGIN_CATEGORY_DISSEMINATION,RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE);
}

Fixed version (ground truth):
@Override public List<String> getCategories(){
  return Arrays.asList(RodaConstants.PLUGIN_CATEGORY_DISSEMINATION);
}
Program: 188530
Project: 188530
Buggy source:
public static SolrInputDocument representationPermissionsUpdateToSolrDocument(Representation representation,Permissions permissions){
  SolrInputDocument document=new SolrInputDocument();
  document.addField(RodaConstants.INDEX_UUID,IdUtils.getRepresentationId(representation.getAipId(),IdUtils.getRepresentationId(representation)));
  document.addField(RodaConstants.REPRESENTATION_ID,representation.getId());
  return permissionsUpdateToSolrDocument(document,permissions);
}

Fixed version (ground truth):
public static SolrInputDocument representationPermissionsUpdateToSolrDocument(Representation representation,Permissions permissions){
  SolrInputDocument document=new SolrInputDocument();
  document.addField(RodaConstants.INDEX_UUID,IdUtils.getRepresentationId(representation));
  return permissionsUpdateToSolrDocument(document,permissions);
}
Program: 188531
Project: 188531
Buggy source:
public AkkaEmbeddedPluginOrchestrator(){
  maxNumberOfJobsInParallel=JobsHelper.getMaxNumberOfJobsInParallel();
  index=RodaCoreFactory.getIndexService();
  model=RodaCoreFactory.getModelService();
  storage=RodaCoreFactory.getStorageService();
  runningJobs=new HashMap<>();
  Config akkaConfig=getAkkaConfiguration();
  workersSystem=ActorSystem.create("String_Node_Str",akkaConfig);
  Props jobsProps=new RoundRobinPool(maxNumberOfJobsInParallel).props(Props.create(AkkaJobActor.class));
  jobWorkersRouter=workersSystem.actorOf(jobsProps,"String_Node_Str");
}

Fixed version (ground truth):
public AkkaEmbeddedPluginOrchestrator(){
  maxNumberOfJobsInParallel=JobsHelper.getMaxNumberOfJobsInParallel();
  index=RodaCoreFactory.getIndexService();
  model=RodaCoreFactory.getModelService();
  storage=RodaCoreFactory.getStorageService();
  runningJobs=new HashMap<>();
  Config akkaConfig=getAkkaConfiguration();
  jobsSystem=ActorSystem.create("String_Node_Str",akkaConfig);
  jobsManager=jobsSystem.actorOf(Props.create(AkkaJobsManager.class,maxNumberOfJobsInParallel),"String_Node_Str");
}
Program: 188532
Project: 188532
Buggy source:
@Override public void executeJob(Job job,boolean async) throws JobAlreadyStartedException {
  LOGGER.info("String_Node_Str",job.getName(),job.getId());
  if (runningJobs.containsKey(job.getId())) {
    LOGGER.info("String_Node_Str",job.getName(),job.getId());
    throw new JobAlreadyStartedException();
  }
 else {
    if (async) {
      jobWorkersRouter.tell(job,ActorRef.noSender());
    }
 else {
      int timeoutInSeconds=JobsHelper.getSyncTimeout();
      Timeout timeout=new Timeout(Duration.create(timeoutInSeconds,"String_Node_Str"));
      Future<Object> future=Patterns.ask(jobWorkersRouter,job,timeout);
      try {
        Await.result(future,timeout.duration());
      }
 catch (      Exception e) {
        LOGGER.error("String_Node_Str",e);
      }
    }
    LOGGER.info("String_Node_Str",job.getName(),job.getId());
  }
}

Fixed version (ground truth):
@Override public void executeJob(Job job,boolean async) throws JobAlreadyStartedException {
  LOGGER.info("String_Node_Str",job.getName(),job.getId());
  if (runningJobs.containsKey(job.getId())) {
    LOGGER.info("String_Node_Str",job.getName(),job.getId());
    throw new JobAlreadyStartedException();
  }
 else {
    if (async) {
      jobsManager.tell(job,ActorRef.noSender());
    }
 else {
      int timeoutInSeconds=JobsHelper.getSyncTimeout();
      Timeout timeout=new Timeout(Duration.create(timeoutInSeconds,"String_Node_Str"));
      Future<Object> future=Patterns.ask(jobsManager,job,timeout);
      try {
        Await.result(future,timeout.duration());
      }
 catch (      Exception e) {
        LOGGER.error("String_Node_Str",e);
      }
    }
    LOGGER.info("String_Node_Str",job.getName(),job.getId());
  }
}
Program: 188533
Project: 188533
Buggy source:
@Override public void shutdown(){
  LOGGER.info("String_Node_Str");
  Future<Terminated> terminate=workersSystem.terminate();
  terminate.onComplete(new OnComplete<Terminated>(){
    public void onComplete(    Throwable failure,    Terminated result){
      if (failure != null) {
        LOGGER.error("String_Node_Str",failure);
      }
 else {
        LOGGER.info("String_Node_Str");
      }
    }
  }
,workersSystem.dispatcher());
}

Fixed version (ground truth):
@Override public void shutdown(){
  LOGGER.info("String_Node_Str");
  Future<Terminated> terminate=jobsSystem.terminate();
  terminate.onComplete(new OnComplete<Terminated>(){
    public void onComplete(    Throwable failure,    Terminated result){
      if (failure != null) {
        LOGGER.error("String_Node_Str",failure);
      }
 else {
        LOGGER.info("String_Node_Str");
      }
    }
  }
,jobsSystem.dispatcher());
}
Program: 188534
Project: 188534
Buggy source:
/** 
 * Public empty constructor 
 */
public AkkaJobActor(){
  super();
}

Fixed version (ground truth):
/** 
 * Public constructor 
 */
public AkkaJobActor(ActorRef jobsManager){
  super();
  this.jobsManager=jobsManager;
}
Program: 188536
Project: 188536
Buggy source:
private void handleJobStateUpdated(Object msg){
  Messages.JobStateUpdated message=(Messages.JobStateUpdated)msg;
  message.logProcessingStarted();
  Plugin<?> p=message.getPlugin() == null ? this.plugin : message.getPlugin();
  try {
    Job job=PluginHelper.getJob(p,super.getIndex());
    LOGGER.info("String_Node_Str",job.getName(),job.getId(),message.getState(),message.getStateDatails().orElse("String_Node_Str"));
  }
 catch (  NotFoundException|GenericException e) {
    LOGGER.warn("String_Node_Str",e.getMessage());
  }
  JobsHelper.updateJobState(p,super.getModel(),message.getState(),message.getStateDatails());
  if (Job.isFinalState(message.getState())) {
    jobCreator.tell("String_Node_Str",getSelf());
    getContext().stop(getSelf());
  }
  message.logProcessingEnded();
}

Fixed version (ground truth):
private void handleJobStateUpdated(Object msg){
  Messages.JobStateUpdated message=(Messages.JobStateUpdated)msg;
  message.logProcessingStarted();
  Plugin<?> p=message.getPlugin() == null ? this.plugin : message.getPlugin();
  try {
    Job job=PluginHelper.getJob(p,super.getIndex());
    LOGGER.info("String_Node_Str",job.getName(),job.getId(),message.getState(),message.getStateDatails().orElse("String_Node_Str"));
  }
 catch (  NotFoundException|GenericException e) {
    LOGGER.warn("String_Node_Str",e.getMessage());
  }
  JobsHelper.updateJobState(p,super.getModel(),message.getState(),message.getStateDatails());
  if (Job.isFinalState(message.getState())) {
    jobCreator.tell("String_Node_Str",getSelf());
    jobsManager.tell(new Messages.JobsManagerJobEnded(),getSelf());
    getContext().stop(getSelf());
  }
  message.logProcessingEnded();
}
Program: 188537
Project: 188537
Buggy source:
public AkkaJobStateInfoActor(Plugin<?> plugin,ActorRef jobCreator,int numberOfJobsWorkers){
  super();
  jobInfo=new JobInfo();
  this.plugin=plugin;
  this.jobCreator=jobCreator;
  LOGGER.debug("String_Node_Str",numberOfJobsWorkers);
  Props workersProps=new RoundRobinPool(numberOfJobsWorkers).props(Props.create(AkkaWorkerActor.class));
  workersRouter=getContext().actorOf(workersProps,"String_Node_Str");
  getContext().watch(workersRouter);
}

Fixed version (ground truth):
public AkkaJobStateInfoActor(Plugin<?> plugin,ActorRef jobCreator,ActorRef jobsManager,int numberOfJobsWorkers){
  super();
  jobInfo=new JobInfo();
  this.plugin=plugin;
  this.jobCreator=jobCreator;
  this.jobsManager=jobsManager;
  LOGGER.debug("String_Node_Str",numberOfJobsWorkers);
  Props workersProps=new RoundRobinPool(numberOfJobsWorkers).props(Props.create(AkkaWorkerActor.class));
  workersRouter=getContext().actorOf(workersProps,"String_Node_Str");
  getContext().watch(workersRouter);
}
Program: 188538
Project: 188538
Buggy source:
private Map<String,Integer> getIndexVersionsFromCode(Path indexConfigsFolder,List<String> collections){
  Map<String,Integer> ret=new HashMap<>();
  for (  String collection : collections) {
    Path schemaFile=indexConfigsFolder.resolve(collection).resolve("String_Node_Str").resolve("String_Node_Str");
    String version=XMLUtility.getStringFromFile(schemaFile,"String_Node_Str");
    try {
      ret.put(collection,Integer.parseInt(version));
    }
 catch (    NumberFormatException e) {
    }
  }
  return ret;
}

Fixed version (ground truth):
private Map<String,Integer> getIndexVersionsFromCode(Path indexConfigsFolder,List<String> collections){
  Map<String,Integer> ret=new HashMap<>();
  for (  String collection : collections) {
    Path schemaFile=indexConfigsFolder.resolve(collection).resolve("String_Node_Str").resolve("String_Node_Str");
    String version=XMLUtility.getStringFromFile(schemaFile,"String_Node_Str").replaceFirst("String_Node_Str","String_Node_Str");
    try {
      ret.put(collection,Integer.parseInt(version));
    }
 catch (    NumberFormatException e) {
    }
  }
  return ret;
}
Program: 188539
Project: 188539
Buggy source:
@UiHandler("String_Node_Str") void buttonRemoveHandler(ClickEvent e){
  Dialogs.showConfirmDialog(messages.representationRemoveTitle(),messages.representationRemoveMessage(),messages.dialogCancel(),messages.dialogYes(),new AsyncCallback<Boolean>(){
    @Override public void onSuccess(    Boolean confirmed){
      if (confirmed) {
        SelectedItemsList<IndexedRepresentation> selected=new SelectedItemsList<IndexedRepresentation>(Arrays.asList(repId),IndexedRepresentation.class.getName());
        BrowserService.Util.getInstance().deleteRepresentation(selected,new AsyncCallback<Void>(){
          @Override public void onSuccess(          Void result){
            Tools.newHistory(Browse.RESOLVER,aipId);
          }
          @Override public void onFailure(          Throwable caught){
            AsyncCallbackUtils.defaultFailureTreatment(caught);
          }
        }
);
      }
    }
    @Override public void onFailure(    Throwable caught){
    }
  }
);
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonRemoveHandler(ClickEvent e){
  Dialogs.showConfirmDialog(messages.representationRemoveTitle(),messages.representationRemoveMessage(),messages.dialogCancel(),messages.dialogYes(),new AsyncCallback<Boolean>(){
    @Override public void onSuccess(    Boolean confirmed){
      if (confirmed) {
        SelectedItems selected=(SelectedItems)filesList.getSelected();
        if (ClientSelectedItemsUtils.isEmpty(selected)) {
          selected=new SelectedItemsList<IndexedRepresentation>(Arrays.asList(repId),IndexedRepresentation.class.getName());
          BrowserService.Util.getInstance().deleteRepresentation(selected,new AsyncCallback<Void>(){
            @Override public void onSuccess(            Void result){
              Tools.newHistory(Browse.RESOLVER,aipId);
            }
            @Override public void onFailure(            Throwable caught){
              AsyncCallbackUtils.defaultFailureTreatment(caught);
            }
          }
);
        }
 else {
          BrowserService.Util.getInstance().deleteFile(selected,new AsyncCallback<Void>(){
            @Override public void onSuccess(            Void result){
              filesList.refresh();
            }
            @Override public void onFailure(            Throwable caught){
              AsyncCallbackUtils.defaultFailureTreatment(caught);
            }
          }
);
        }
      }
    }
    @Override public void onFailure(    Throwable caught){
    }
  }
);
}
Program: 188540
Project: 188540
Buggy source:
@UiHandler("String_Node_Str") void buttonNewProcessHandler(ClickEvent e){
  if (repId != null) {
    LastSelectedItemsSingleton selectedItems=LastSelectedItemsSingleton.getInstance();
    selectedItems.setSelectedItems(SelectedItemsList.create(IndexedRepresentation.class,repId));
    Tools.newHistory(CreateJob.RESOLVER,"String_Node_Str");
  }
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonNewProcessHandler(ClickEvent e){
  SelectedItems selected=(SelectedItems)filesList.getSelected();
  if (ClientSelectedItemsUtils.isEmpty(selected)) {
    selected=new SelectedItemsList<IndexedRepresentation>(Arrays.asList(repId),IndexedRepresentation.class.getName());
  }
  LastSelectedItemsSingleton selectedItems=LastSelectedItemsSingleton.getInstance();
  selectedItems.setSelectedItems(selected);
  Tools.newHistory(CreateJob.RESOLVER,"String_Node_Str");
}
Program: 188541
Project: 188541
Buggy source:
@Override public void onSuccess(Void result){
  Tools.newHistory(Browse.RESOLVER,aipId);
}

Fixed version (ground truth):
@Override public void onSuccess(Void result){
  filesList.refresh();
}
Program: 188543
Project: 188543
Buggy source:
public <T extends IsIndexed>List<String> suggest(Class<T> returnClass,String field,String query,User user,boolean allowPartial) throws GenericException {
  boolean justActive=true;
  return SolrUtils.suggest(getSolrClient(),returnClass,field,query,justActive,user,allowPartial);
}

Fixed version (ground truth):
public <T extends IsIndexed>List<String> suggest(Class<T> returnClass,String field,String query,User user,boolean allowPartial,boolean justActive) throws GenericException {
  return SolrUtils.suggest(getSolrClient(),returnClass,field,query,justActive,user,allowPartial);
}
Program: 188544
Project: 188544
Buggy source:
protected static <T extends IsIndexed>List<String> suggest(Class<T> returnClass,String field,String query,User user,boolean allowPartial) throws GenericException, NotFoundException {
  return RodaCoreFactory.getIndexService().suggest(returnClass,field,query,user,allowPartial);
}

Fixed version (ground truth):
protected static <T extends IsIndexed>List<String> suggest(Class<T> returnClass,String field,String query,User user,boolean allowPartial) throws GenericException, NotFoundException {
  boolean justActive=true;
  return RodaCoreFactory.getIndexService().suggest(returnClass,field,query,user,allowPartial,justActive);
}
Program: 188545
Project: 188545
Buggy source:
private <T extends Serializable>CloseableIterable<OptionalWithCause<T>> listFiles(Class<T> objectClass) throws RequestNotValidException, GenericException, NotFoundException, AuthorizationDeniedException {
  CloseableIterable<OptionalWithCause<AIP>> aips=listAIPs();
  Iterator<OptionalWithCause<AIP>> aipIter=aips.iterator();
  List<CloseableIterable<OptionalWithCause<T>>> files=new ArrayList<CloseableIterable<OptionalWithCause<T>>>();
  while (aipIter.hasNext()) {
    OptionalWithCause<AIP> aip=aipIter.next();
    if (aip.isPresent()) {
      for (      Representation representation : aip.get().getRepresentations()) {
        final CloseableIterable<Resource> resourcesIterable=storage.listResourcesUnderContainer(ModelUtils.getRepresentationDataStoragePath(aip.get().getId(),representation.getId()),true);
        CloseableIterable<OptionalWithCause<T>> fs=ResourceParseUtils.convert(getStorage(),resourcesIterable,objectClass);
        files.add(fs);
      }
    }
  }
  return CloseableIterables.concat(files);
}

Fixed version (ground truth):
private <T extends Serializable>CloseableIterable<OptionalWithCause<T>> listFiles(Class<T> objectClass) throws RequestNotValidException, GenericException, NotFoundException, AuthorizationDeniedException {
  CloseableIterable<OptionalWithCause<AIP>> aips=listAIPs();
  Iterator<OptionalWithCause<AIP>> aipIter=aips.iterator();
  List<CloseableIterable<OptionalWithCause<T>>> files=new ArrayList<CloseableIterable<OptionalWithCause<T>>>();
  while (aipIter.hasNext()) {
    OptionalWithCause<AIP> aip=aipIter.next();
    if (aip.isPresent()) {
      for (      Representation representation : aip.get().getRepresentations()) {
        StoragePath representationDataStoragePath=ModelUtils.getRepresentationDataStoragePath(aip.get().getId(),representation.getId());
        try {
          final CloseableIterable<Resource> resourcesIterable=storage.listResourcesUnderDirectory(representationDataStoragePath,true);
          CloseableIterable<OptionalWithCause<T>> fs=ResourceParseUtils.convert(getStorage(),resourcesIterable,objectClass);
          files.add(fs);
        }
 catch (        NotFoundException e) {
        }
      }
    }
  }
  return CloseableIterables.concat(files);
}
Program: 188546
Project: 188546
Buggy source:
@Override public List<String> getCategories(){
  return Arrays.asList(RodaConstants.PLUGIN_CATEGORY_VALIDATION);
}

Fixed version (ground truth):
@Override public List<String> getCategories(){
  return Arrays.asList(RodaConstants.PLUGIN_CATEGORY_MISC);
}
Program: 188547
Project: 188547
Buggy source:
@Override public List<String> getCategories(){
  return Arrays.asList(RodaConstants.PLUGIN_CATEGORY_VALIDATION);
}

Fixed version (ground truth):
@Override public List<String> getCategories(){
  return Arrays.asList(RodaConstants.PLUGIN_CATEGORY_MISC);
}
Program: 188549
Project: 188549
Buggy source:
public static <T extends IsRODAObject>SelectedItemsAll<T> create(Class<T> classToCreate){
  return new SelectedItemsAll<>(classToCreate.getName());
}

Fixed version (ground truth):
public static <T extends IsRODAObject>SelectedItemsAll<T> create(String classToCreate){
  return new SelectedItemsAll<>(classToCreate);
}
Program: 188550
Project: 188550
Buggy source:
protected static TransferredResource createTransferredResource(Path resourcePath,BasicFileAttributes attr,long size,Path basePath,Date lastScanDate){
  Path relativeToBase=basePath.relativize(resourcePath);
  TransferredResource tr=new TransferredResource();
  Date d=new Date(attr.creationTime().toMillis());
  tr.setCreationDate(d);
  tr.setFile(!Files.isDirectory(resourcePath));
  tr.setFullPath(resourcePath.toString());
  String id=relativeToBase.toString();
  tr.setId(id);
  tr.setUUID(getTransferredResourceUUID(relativeToBase));
  tr.setName(resourcePath.getFileName().toString());
  tr.setRelativePath(relativeToBase.toString());
  if (relativeToBase.getParent() != null) {
    String parentId=relativeToBase.getParent().toString();
    tr.setParentId(parentId);
    tr.setParentUUID(UUID.nameUUIDFromBytes(parentId.getBytes()).toString());
  }
  tr.setSize(size);
  List<String> ancestors=new ArrayList<String>();
  StringBuilder temp=new StringBuilder();
  Iterator<Path> pathIterator=relativeToBase.iterator();
  while (pathIterator.hasNext()) {
    temp.append(pathIterator.next().toString());
    ancestors.add(temp.toString());
    temp.append("String_Node_Str");
  }
  ancestors.remove(ancestors.size() - 1);
  tr.setAncestorsPaths(ancestors);
  tr.setLastScanDate(lastScanDate);
  return tr;
}

Fixed version (ground truth):
protected static TransferredResource createTransferredResource(Path resourcePath,BasicFileAttributes attr,long size,Path basePath,Date lastScanDate){
  Path relativeToBase=basePath.relativize(resourcePath);
  TransferredResource tr=new TransferredResource();
  Date d=new Date(attr.creationTime().toMillis());
  tr.setCreationDate(d);
  tr.setFile(!Files.isDirectory(resourcePath));
  tr.setFullPath(resourcePath.toString());
  String id=relativeToBase.toString();
  tr.setId(id);
  tr.setUUID(IdUtils.getTransferredResourceUUID(relativeToBase));
  tr.setName(resourcePath.getFileName().toString());
  tr.setRelativePath(relativeToBase.toString());
  if (relativeToBase.getParent() != null) {
    String parentId=relativeToBase.getParent().toString();
    tr.setParentId(parentId);
    tr.setParentUUID(UUID.nameUUIDFromBytes(parentId.getBytes()).toString());
  }
  tr.setSize(size);
  List<String> ancestors=new ArrayList<String>();
  StringBuilder temp=new StringBuilder();
  Iterator<Path> pathIterator=relativeToBase.iterator();
  while (pathIterator.hasNext()) {
    temp.append(pathIterator.next().toString());
    ancestors.add(temp.toString());
    temp.append("String_Node_Str");
  }
  ancestors.remove(ancestors.size() - 1);
  tr.setAncestorsPaths(ancestors);
  tr.setLastScanDate(lastScanDate);
  return tr;
}
Program: 188552
Project: 188552
Buggy source:
public static Report lastReport(User user,String id,String resourceOrSip,String acceptFormat) throws RODAException {
  final ControllerAssistant controllerAssistant=new ControllerAssistant(){
  }
;
  BrowserHelper.validateListingParams(acceptFormat);
  controllerAssistant.checkRoles(user);
  String start="String_Node_Str";
  String limit="String_Node_Str";
  Reports reportList;
  if (id == null || resourceOrSip == null) {
    reportList=BrowserHelper.listReports(start,limit);
  }
 else {
    if (RodaConstants.API_GET_REPORTS_ID_OBJECT_SIP.equals(resourceOrSip)) {
      reportList=BrowserHelper.listTransferredResourcesReportsWithSIP(id,start,limit);
    }
 else {
      reportList=BrowserHelper.listTransferredResourcesReports(id,start,limit);
    }
  }
  controllerAssistant.registerAction(user,id,LOG_ENTRY_STATE.SUCCESS,RodaConstants.API_QUERY_PARAM_ID,id,RodaConstants.API_GET_REPORTS_ID_OBJECT,resourceOrSip,RodaConstants.API_QUERY_KEY_START,start,RodaConstants.API_QUERY_KEY_LIMIT,limit);
  if (reportList.getReports().isEmpty()) {
    throw new RODAException();
  }
 else {
    return reportList.getReports().get(0);
  }
}

Fixed version (ground truth):
public static Report lastReport(User user,String id,String resourceOrSip,String acceptFormat) throws RODAException {
  final ControllerAssistant controllerAssistant=new ControllerAssistant(){
  }
;
  BrowserHelper.validateListingParams(acceptFormat);
  controllerAssistant.checkRoles(user);
  String start="String_Node_Str";
  String limit="String_Node_Str";
  Reports reportList;
  if (id == null || resourceOrSip == null) {
    reportList=BrowserHelper.listReports(start,limit);
  }
 else {
    if (RodaConstants.API_GET_REPORTS_ID_OBJECT_SIP.equals(resourceOrSip)) {
      reportList=BrowserHelper.listTransferredResourcesReportsWithSIP(id,start,limit);
    }
 else {
      if (RodaConstants.API_GET_REPORTS_ID_OBJECT_RESOURCE_PATH.equals(resourceOrSip)) {
        id=IdUtils.getTransferredResourceUUID(id);
      }
      reportList=BrowserHelper.listTransferredResourcesReports(id,start,limit);
    }
  }
  controllerAssistant.registerAction(user,id,LOG_ENTRY_STATE.SUCCESS,RodaConstants.API_QUERY_PARAM_ID,id,RodaConstants.API_GET_REPORTS_ID_OBJECT,resourceOrSip,RodaConstants.API_QUERY_KEY_START,start,RodaConstants.API_QUERY_KEY_LIMIT,limit);
  if (reportList.getReports().isEmpty()) {
    throw new RODAException();
  }
 else {
    return reportList.getReports().get(0);
  }
}
Program: 188553
Project: 188553
Buggy source:
@GET @Path("String_Node_Str") @ApiOperation(value="String_Node_Str",notes="String_Node_Str",response=Report.class) @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Report.class),@ApiResponse(code=404,message="String_Node_Str",response=ApiResponseMessage.class)}) public Response getTransferredResourceLastReport(@ApiParam(value="String_Node_Str") @QueryParam(RodaConstants.API_QUERY_PARAM_ID) String id,@ApiParam(value="String_Node_Str",allowableValues=RodaConstants.API_GET_REPORTS_ID_OBJECT,defaultValue=RodaConstants.API_GET_REPORTS_ID_OBJECT_RESOURCE) @QueryParam(RodaConstants.API_QUERY_PARAM_TYPE) String resourceOrSip,@ApiParam(value="String_Node_Str",allowableValues=RodaConstants.API_LIST_MEDIA_TYPES,defaultValue=RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_JSON) @QueryParam(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT) String acceptFormat) throws RODAException {
  String mediaType=ApiUtils.getMediaType(acceptFormat,request);
  User user=UserUtility.getApiUser(request);
  try {
    Report lastReport=Browser.lastReport(user,id,resourceOrSip,acceptFormat);
    return Response.ok(lastReport,mediaType).build();
  }
 catch (  RODAException e) {
    return Response.ok(new ApiResponseMessage(ApiResponseMessage.ERROR,"String_Node_Str"),mediaType).build();
  }
}

Fixed version (ground truth):
@GET @Path("String_Node_Str") @ApiOperation(value="String_Node_Str",notes="String_Node_Str",response=Report.class) @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Report.class),@ApiResponse(code=404,message="String_Node_Str",response=ApiResponseMessage.class)}) public Response getTransferredResourceLastReport(@ApiParam(value="String_Node_Str") @QueryParam(RodaConstants.API_QUERY_PARAM_ID) String id,@ApiParam(value="String_Node_Str",allowableValues=RodaConstants.API_GET_REPORTS_ID_OBJECT,defaultValue=RodaConstants.API_GET_REPORTS_ID_OBJECT_RESOURCE_PATH) @QueryParam(RodaConstants.API_QUERY_PARAM_TYPE) String resourceOrSip,@ApiParam(value="String_Node_Str",allowableValues=RodaConstants.API_LIST_MEDIA_TYPES,defaultValue=RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_JSON) @QueryParam(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT) String acceptFormat) throws RODAException {
  String mediaType=ApiUtils.getMediaType(acceptFormat,request);
  User user=UserUtility.getApiUser(request);
  try {
    Report lastReport=Browser.lastReport(user,id,resourceOrSip,acceptFormat);
    return Response.ok(lastReport,mediaType).build();
  }
 catch (  RODAException e) {
    return Response.ok(new ApiResponseMessage(ApiResponseMessage.ERROR,"String_Node_Str"),mediaType).build();
  }
}
Program: 188554
Project: 188554
Buggy source:
@GET @ApiOperation(value="String_Node_Str",notes="String_Node_Str",response=Reports.class,responseContainer="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Reports.class,responseContainer="String_Node_Str"),@ApiResponse(code=404,message="String_Node_Str",response=ApiResponseMessage.class)}) public Response getTransferredResourceReports(@ApiParam(value="String_Node_Str") @QueryParam(RodaConstants.API_QUERY_PARAM_ID) String id,@ApiParam(value="String_Node_Str",allowableValues=RodaConstants.API_GET_REPORTS_ID_OBJECT,defaultValue=RodaConstants.API_GET_REPORTS_ID_OBJECT_RESOURCE) @QueryParam(RodaConstants.API_QUERY_PARAM_TYPE) String resourceOrSip,@ApiParam(value="String_Node_Str",defaultValue="String_Node_Str") @QueryParam(RodaConstants.API_QUERY_KEY_START) String start,@ApiParam(value="String_Node_Str",defaultValue="String_Node_Str") @QueryParam(RodaConstants.API_QUERY_KEY_LIMIT) String limit,@ApiParam(value="String_Node_Str",allowableValues=RodaConstants.API_LIST_MEDIA_TYPES,defaultValue=RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_JSON) @QueryParam(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT) String acceptFormat) throws RODAException {
  String mediaType=ApiUtils.getMediaType(acceptFormat,request);
  User user=UserUtility.getApiUser(request);
  Reports reportList=Browser.listReports(user,id,resourceOrSip,start,limit,acceptFormat);
  return Response.ok(reportList,mediaType).build();
}

Fixed version (ground truth):
@GET @ApiOperation(value="String_Node_Str",notes="String_Node_Str",response=Reports.class,responseContainer="String_Node_Str") @ApiResponses(value={@ApiResponse(code=200,message="String_Node_Str",response=Reports.class,responseContainer="String_Node_Str"),@ApiResponse(code=404,message="String_Node_Str",response=ApiResponseMessage.class)}) public Response getTransferredResourceReports(@ApiParam(value="String_Node_Str") @QueryParam(RodaConstants.API_QUERY_PARAM_ID) String id,@ApiParam(value="String_Node_Str",allowableValues=RodaConstants.API_GET_REPORTS_ID_OBJECT,defaultValue=RodaConstants.API_GET_REPORTS_ID_OBJECT_RESOURCE_PATH) @QueryParam(RodaConstants.API_QUERY_PARAM_TYPE) String resourceOrSip,@ApiParam(value="String_Node_Str",defaultValue="String_Node_Str") @QueryParam(RodaConstants.API_QUERY_KEY_START) String start,@ApiParam(value="String_Node_Str",defaultValue="String_Node_Str") @QueryParam(RodaConstants.API_QUERY_KEY_LIMIT) String limit,@ApiParam(value="String_Node_Str",allowableValues=RodaConstants.API_LIST_MEDIA_TYPES,defaultValue=RodaConstants.API_QUERY_VALUE_ACCEPT_FORMAT_JSON) @QueryParam(RodaConstants.API_QUERY_KEY_ACCEPT_FORMAT) String acceptFormat) throws RODAException {
  String mediaType=ApiUtils.getMediaType(acceptFormat,request);
  User user=UserUtility.getApiUser(request);
  Reports reportList=Browser.listReports(user,id,resourceOrSip,start,limit,acceptFormat);
  return Response.ok(reportList,mediaType).build();
}
Program: 188556
Project: 188556
Buggy source:
private void processAIPPermissions(IndexService index,ModelService model,Job currentJob,AIP aip,Report reportItem){
  try {
    String jobCreatorUsername=currentJob.getUsername();
    if (aip.getParentId() != null) {
      try {
        AIP 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(RodaConstants.REPOSITORY_PERMISSIONS_AIP_CREATE_TOP)) {
        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 {
    String jobCreatorUsername=currentJob.getUsername();
    if (aip.getParentId() != null) {
      try {
        IndexedAIP parentAIP=index.retrieve(IndexedAIP.class,aip.getParentId());
        User user=index.retrieve(User.class,jobCreatorUsername);
        UserUtility.checkObjectPermissions(user,parentAIP,PermissionType.CREATE);
      }
 catch (      NotFoundException nfe) {
        reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(PARENT_AIP_NOT_FOUND);
      }
catch (      AuthorizationDeniedException e) {
        LOGGER.debug("String_Node_Str",jobCreatorUsername);
        reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(NO_PERMISSION_TO_CREATE_UNDER_AIP);
      }
    }
 else {
      RODAMember member=index.retrieve(RODAMember.class,jobCreatorUsername);
      if (member.getAllRoles().contains(RodaConstants.REPOSITORY_PERMISSIONS_AIP_CREATE_TOP)) {
        LOGGER.debug("String_Node_Str");
      }
 else {
        reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(NO_CREATE_TOP_LEVEL_AIP_PERMISSION);
        LOGGER.debug("String_Node_Str");
      }
    }
  }
 catch (  GenericException|NotFoundException e) {
    reportItem.setPluginState(PluginState.FAILURE).setPluginDetails(e.getMessage());
  }
}
Program: 188557
Project: 188557
Buggy source:
public boolean hasObjects(Class<? extends IsRODAObject> objectClass){
  try {
    if (!TransferredResource.class.equals(objectClass)) {
      StoragePath storagePath=ModelUtils.getContainerPath(objectClass);
      try {
        return RodaCoreFactory.getStorageService().countResourcesUnderContainer(storagePath,false).intValue() > 0;
      }
 catch (      NotFoundException e) {
      }
    }
    return false;
  }
 catch (  RODAException e) {
    return false;
  }
}

Fixed version (ground truth):
public boolean hasObjects(Class<? extends IsRODAObject> objectClass){
  try {
    if (LogEntry.class.equals(objectClass) || RODAMember.class.equals(objectClass)) {
      return true;
    }
 else     if (!TransferredResource.class.equals(objectClass)) {
      StoragePath storagePath=ModelUtils.getContainerPath(objectClass);
      try {
        return RodaCoreFactory.getStorageService().countResourcesUnderContainer(storagePath,false).intValue() > 0;
      }
 catch (      NotFoundException e) {
      }
    }
    return false;
  }
 catch (  RODAException e) {
    return false;
  }
}
Program: 188558
Project: 188558
Buggy source:
public <T extends Serializable>CloseableIterable<OptionalWithCause<T>> list(Class<T> objectClass) throws RequestNotValidException, GenericException, NotFoundException, AuthorizationDeniedException {
  if (Representation.class.equals(objectClass)) {
    return listRepresentations(objectClass);
  }
 else   if (File.class.equals(objectClass)) {
    return listFiles(objectClass);
  }
 else   if (TransferredResource.class.equals(objectClass)) {
    return RodaCoreFactory.getIndexService().listTransferredResource();
  }
 else {
    StoragePath containerPath=ModelUtils.getContainerPath(objectClass);
    final CloseableIterable<Resource> resourcesIterable=storage.listResourcesUnderContainer(containerPath,false);
    return ResourceParseUtils.convert(getStorage(),resourcesIterable,objectClass);
  }
}

Fixed version (ground truth):
public <T extends Serializable>CloseableIterable<OptionalWithCause<T>> list(Class<T> objectClass) throws RequestNotValidException, GenericException, NotFoundException, AuthorizationDeniedException {
  if (Representation.class.equals(objectClass)) {
    return listRepresentations(objectClass);
  }
 else   if (File.class.equals(objectClass)) {
    return listFiles(objectClass);
  }
 else   if (TransferredResource.class.equals(objectClass)) {
    return RodaCoreFactory.getIndexService().list(TransferredResource.class);
  }
 else   if (RODAMember.class.equals(objectClass)) {
    return RodaCoreFactory.getIndexService().list(RODAMember.class);
  }
 else   if (LogEntry.class.equals(objectClass)) {
    return RodaCoreFactory.getIndexService().list(LogEntry.class);
  }
 else {
    StoragePath containerPath=ModelUtils.getContainerPath(objectClass);
    final CloseableIterable<Resource> resourcesIterable=storage.listResourcesUnderContainer(containerPath,false);
    return ResourceParseUtils.convert(getStorage(),resourcesIterable,objectClass);
  }
}