nus-yam/ex-repair huggingface dataset:
Program: 188559
Project: 188559
Buggy source:
/** 
 */
public static List<Class<? extends IsRODAObject>> getReindexObjectClasses(){
  List<Class<? extends IsRODAObject>> list=new ArrayList<>();
  list.add(TransferredResource.class);
  list.add(AIP.class);
  list.add(Format.class);
  list.add(Notification.class);
  list.add(Risk.class);
  list.add(LogEntry.class);
  list.add(RiskIncidence.class);
  list.add(Job.class);
  return list;
}

Fixed version (ground truth):
/** 
 */
public static List<Class<? extends IsRODAObject>> getReindexObjectClasses(){
  List<Class<? extends IsRODAObject>> list=new ArrayList<>();
  list.add(TransferredResource.class);
  list.add(AIP.class);
  list.add(RODAMember.class);
  list.add(Format.class);
  list.add(Notification.class);
  list.add(Risk.class);
  list.add(LogEntry.class);
  list.add(RiskIncidence.class);
  list.add(Job.class);
  return list;
}
Program: 188560
Project: 188560
Buggy source:
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<LogEntry> list) throws PluginException {
  Report pluginReport=PluginHelper.initPluginReport(this);
  try {
    SimpleJobPluginInfo jobPluginInfo=PluginHelper.getInitialJobInformation(this,0);
    jobPluginInfo.setSourceObjectsCount(0);
    PluginHelper.updateJobInformation(this,jobPluginInfo);
    pluginReport.setPluginState(PluginState.SUCCESS);
    Date firstDayToIndex=calculateFirstDayToIndex();
    reindexActionLogsStillNotInStorage(index,firstDayToIndex,pluginReport,jobPluginInfo);
    reindexActionLogsInStorage(index,model,firstDayToIndex,pluginReport,jobPluginInfo);
    jobPluginInfo.finalizeInfo();
    PluginHelper.updateJobInformation(this,jobPluginInfo);
  }
 catch (  JobException e) {
    LOGGER.error("String_Node_Str",e);
  }
  return pluginReport;
}

Fixed version (ground truth):
@Override public Report execute(IndexService index,ModelService model,StorageService storage,List<LogEntry> list) throws PluginException {
  Report pluginReport=PluginHelper.initPluginReport(this);
  try {
    SimpleJobPluginInfo jobPluginInfo=PluginHelper.getInitialJobInformation(this,list.size());
    jobPluginInfo.setSourceObjectsCount(0);
    PluginHelper.updateJobInformation(this,jobPluginInfo);
    pluginReport.setPluginState(PluginState.SUCCESS);
    Date firstDayToIndex=PluginHelper.calculateFirstDayToIndex(dontReindexOlderThanXDays);
    jobPluginInfo=PluginHelper.reindexActionLogsStillNotInStorage(index,firstDayToIndex,pluginReport,jobPluginInfo,dontReindexOlderThanXDays);
    jobPluginInfo=PluginHelper.reindexActionLogsInStorage(index,model,firstDayToIndex,pluginReport,jobPluginInfo,dontReindexOlderThanXDays);
    jobPluginInfo.finalizeInfo();
    PluginHelper.updateJobInformation(this,jobPluginInfo);
  }
 catch (  JobException e) {
    LOGGER.error("String_Node_Str",e);
  }
  return pluginReport;
}
Program: 188561
Project: 188561
Buggy source:
@Override public List<String> getCategories(){
  return Arrays.asList(RodaConstants.PLUGIN_CATEGORY_MANAGEMENT);
}

Fixed version (ground truth):
@Override public List<String> getCategories(){
  return Arrays.asList(RodaConstants.PLUGIN_CATEGORY_NOT_LISTABLE);
}
Program: 188563
Project: 188563
Buggy source:
@UiHandler("String_Node_Str") void buttonMoveItemHandler(ClickEvent e){
  final SelectedItems<IndexedAIP> selected=(SelectedItems<IndexedAIP>)getSelected();
  Filter filter;
  boolean showEmptyParentButton;
  filter=new Filter();
  filter=Filter.NULL;
  showEmptyParentButton=false;
  SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,mainSearch.isJustActive(),true);
  selectAipDialog.setEmptyParentButtonVisible(showEmptyParentButton);
  selectAipDialog.showAndCenter();
  selectAipDialog.addValueChangeHandler(new ValueChangeHandler<IndexedAIP>(){
    @Override public void onValueChange(    ValueChangeEvent<IndexedAIP> event){
      final IndexedAIP parentAIP=event.getValue();
      final String parentId=(parentAIP != null) ? parentAIP.getId() : null;
      BrowserService.Util.getInstance().moveAIPInHierarchy(selected,parentId,new LoadingAsyncCallback<IndexedAIP>(){
        @Override public void onSuccessImpl(        IndexedAIP result){
          if (result != null) {
            Tools.newHistory(Browse.RESOLVER,result.getId());
          }
 else {
            Tools.newHistory(Search.RESOLVER);
          }
        }
        @Override public void onFailureImpl(        Throwable caught){
          if (caught instanceof NotFoundException) {
            Toast.showError(messages.moveNoSuchObject(caught.getMessage()));
          }
 else {
            AsyncCallbackUtils.defaultFailureTreatment(caught);
          }
        }
      }
);
    }
  }
);
}

Fixed version (ground truth):
@UiHandler("String_Node_Str") void buttonMoveItemHandler(ClickEvent e){
  final SelectedItems<IndexedAIP> selected=(SelectedItems<IndexedAIP>)getSelected();
  Filter filter;
  boolean showEmptyParentButton;
  filter=new Filter();
  filter=Filter.ALL;
  showEmptyParentButton=false;
  SelectAipDialog selectAipDialog=new SelectAipDialog(messages.moveItemTitle(),filter,mainSearch.isJustActive(),true);
  selectAipDialog.setEmptyParentButtonVisible(showEmptyParentButton);
  selectAipDialog.showAndCenter();
  selectAipDialog.addValueChangeHandler(new ValueChangeHandler<IndexedAIP>(){
    @Override public void onValueChange(    ValueChangeEvent<IndexedAIP> event){
      final IndexedAIP parentAIP=event.getValue();
      final String parentId=(parentAIP != null) ? parentAIP.getId() : null;
      BrowserService.Util.getInstance().moveAIPInHierarchy(selected,parentId,new LoadingAsyncCallback<IndexedAIP>(){
        @Override public void onSuccessImpl(        IndexedAIP result){
          if (result != null) {
            Tools.newHistory(Browse.RESOLVER,result.getId());
          }
 else {
            Tools.newHistory(Search.RESOLVER);
          }
        }
        @Override public void onFailureImpl(        Throwable caught){
          if (caught instanceof NotFoundException) {
            Toast.showError(messages.moveNoSuchObject(caught.getMessage()));
          }
 else {
            AsyncCallbackUtils.defaultFailureTreatment(caught);
          }
        }
      }
);
    }
  }
);
}
Program: 188565
Project: 188565
Buggy source:
@Override public void onSelectionChange(SelectedItems<IndexedAIP> selected){
  boolean empty=SelectedItemsUtils.isEmpty(selected);
  if (empty) {
    moveItem.setEnabled(false);
    editPermissions.setEnabled(false);
  }
 else {
    moveItem.setEnabled(true);
    editPermissions.setEnabled(true);
  }
}

Fixed version (ground truth):
@Override public void onSelectionChange(SelectedItems<IndexedAIP> selected){
  boolean empty=SelectedItemsUtils.isEmpty(selected);
  moveItem.setEnabled(!empty);
  editPermissions.setEnabled(!empty);
}
Program: 188567
Project: 188567
Buggy source:
@Override public void onSuccess(Void result){
  Tools.newHistory(ShowRisk.RESOLVER,risk.getId());
}

Fixed version (ground truth):
@Override public void onSuccess(Void result){
  Tools.newHistory(RiskRegister.RESOLVER);
}
Program: 188571
Project: 188571
Buggy source:
private static void resetAdminAccess() throws GenericException {
  try {
    final String password=readPassword("String_Node_Str");
    final String passwordConfirmation=readPassword("String_Node_Str");
    if (password.equals(passwordConfirmation)) {
      RodaCoreFactory.ldapUtility.resetAdminAccess(password);
      System.out.println("String_Node_Str");
    }
 else {
      throw new GenericException("String_Node_Str");
    }
  }
 catch (  final IOException|LdapUtilityException e) {
    throw new GenericException(e.getMessage(),e);
  }
 finally {
    try {
      RodaCoreFactory.shutdown();
    }
 catch (    final Exception e) {
      e.printStackTrace(System.err);
    }
  }
}

Fixed version (ground truth):
private static void resetAdminAccess() throws GenericException {
  try {
    final String password=readPassword("String_Node_Str");
    final String passwordConfirmation=readPassword("String_Node_Str");
    if (password.equals(passwordConfirmation)) {
      RodaCoreFactory.ldapUtility.resetAdminAccess(password);
      try {
        indexUsersAndGroupsFromLDAP();
      }
 catch (      final Exception e) {
        LOGGER.warn("String_Node_Str" + e.getMessage(),e);
        System.err.println("String_Node_Str" + e.getMessage() + "String_Node_Str");
      }
      System.out.println("String_Node_Str");
    }
 else {
      throw new GenericException("String_Node_Str");
    }
  }
 catch (  final IOException|LdapUtilityException e) {
    throw new GenericException(e.getMessage(),e);
  }
 finally {
    try {
      RodaCoreFactory.shutdown();
    }
 catch (    final Exception e) {
      e.printStackTrace(System.err);
    }
  }
}
Program: 188572
Project: 188572
Buggy source:
/** 
 * Sets the groups to which a member belongs to.
 * @param session the session.
 * @param memberDN the DN of the member to change the groups for.
 * @param groups a list of groups that this member should belong to.
 * @throws LdapException if some error occurs.
 */
private void setMemberGroups(final CoreSession session,final String memberDN,final Set<String> groups) throws LdapException {
  final Set<String> newGroups=(groups == null) ? new HashSet<>() : new HashSet<>(groups);
  final Set<String> oldgroupDNs=getDNsOfGroupsContainingMember(session,memberDN);
  final Set<String> newgroupDNs=new HashSet<>();
  for (  String groupName : newGroups) {
    newgroupDNs.add(getGroupDN(groupName));
  }
  final Set<String> tempOldgroupDNs=new HashSet<>(oldgroupDNs);
  tempOldgroupDNs.removeAll(newgroupDNs);
  for (  String groupDN : tempOldgroupDNs) {
    removeMemberFromRoleOrGroup(session,groupDN,memberDN,UNIQUE_MEMBER);
  }
  newgroupDNs.removeAll(oldgroupDNs);
  if (this.rodaAdminDN.equals(memberDN)) {
    newgroupDNs.add(this.rodaAdministratorsDN);
  }
  for (  String groupDN : newgroupDNs) {
    addMemberToRoleOrGroup(session,groupDN,memberDN,UNIQUE_MEMBER);
  }
}

Fixed version (ground truth):
/** 
 * Sets the groups to which a member belongs to.
 * @param session the session.
 * @param memberDN the DN of the member to change the groups for.
 * @param groups a list of groups that this member should belong to.
 * @throws LdapException if some error occurs.
 */
private void setMemberGroups(final CoreSession session,final String memberDN,final Set<String> groups) throws LdapException {
  final Set<String> newGroups=(groups == null) ? new HashSet<>() : new HashSet<>(groups);
  final Set<String> oldgroupDNs=getDNsOfGroupsContainingMember(session,memberDN);
  final Set<String> newgroupDNs=new HashSet<>();
  for (  String groupName : newGroups) {
    newgroupDNs.add(getGroupDN(groupName));
  }
  final Set<String> tempOldgroupDNs=new HashSet<>(oldgroupDNs);
  tempOldgroupDNs.removeAll(newgroupDNs);
  for (  String groupDN : tempOldgroupDNs) {
    removeMemberFromRoleOrGroup(session,groupDN,memberDN,UNIQUE_MEMBER);
  }
  newgroupDNs.removeAll(oldgroupDNs);
  if (this.rodaAdminDN.equals(memberDN)) {
    newgroupDNs.add(this.rodaAdministratorsDN);
  }
  for (  String groupDN : newgroupDNs) {
    try {
      addMemberToRoleOrGroup(session,groupDN,memberDN,UNIQUE_MEMBER);
    }
 catch (    final LdapNoSuchObjectException e) {
      LOGGER.debug("String_Node_Str",groupDN);
    }
  }
}
Program: 188573
Project: 188573
Buggy source:
public void resetAdminAccess(final String password) throws LdapUtilityException, GenericException {
  try {
    final CoreSession session=this.service.getAdminSession();
    final String adminName=getFirstNameFromDN(this.rodaAdminDN);
    final String administratorsName=getFirstNameFromDN(this.rodaAdministratorsDN);
    User admin;
    try {
      admin=getUser(session,adminName);
    }
 catch (    final LdapNoSuchObjectException e) {
      admin=new User(adminName);
      admin=addUser(admin);
    }
    admin.setActive(true);
    modifyUser(session,admin,password,true,true);
    Group administrators;
    try {
      administrators=getGroup(session,administratorsName);
    }
 catch (    final LdapNoSuchObjectException e) {
      administrators=addGroup(new Group(administratorsName));
      administrators.setActive(true);
    }
    administrators.setDirectRoles(getRoles(session));
    administrators.addMemberUser(adminName);
    modifyGroup(administrators,true);
  }
 catch (  final UserAlreadyExistsException|EmailAlreadyExistsException|NotFoundException|IllegalOperationException|GroupAlreadyExistsException|LdapException e) {
    throw new LdapUtilityException(e.getMessage(),e);
  }
}

Fixed version (ground truth):
public void resetAdminAccess(final String password) throws LdapUtilityException, GenericException {
  try {
    final CoreSession session=this.service.getAdminSession();
    final String adminName=getFirstNameFromDN(this.rodaAdminDN);
    final String administratorsName=getFirstNameFromDN(this.rodaAdministratorsDN);
    User admin;
    try {
      admin=getUser(session,adminName);
    }
 catch (    final LdapNoSuchObjectException e) {
      admin=new User(adminName);
      admin=addUser(admin);
    }
    admin.setActive(true);
    modifyUser(session,admin,password,false,true);
    Group administrators;
    try {
      administrators=getGroup(session,administratorsName);
    }
 catch (    final LdapNoSuchObjectException e) {
      administrators=addGroup(new Group(administratorsName));
      administrators.setActive(true);
    }
    administrators.setDirectRoles(getRoles(session));
    administrators.addMemberUser(adminName);
    modifyGroup(administrators,true);
  }
 catch (  final UserAlreadyExistsException|EmailAlreadyExistsException|NotFoundException|IllegalOperationException|GroupAlreadyExistsException|LdapException e) {
    throw new LdapUtilityException(e.getMessage(),e);
  }
}
Program: 188574
Project: 188574
Buggy source:
private User getUserFromEntry(final Entry entry) throws LdapException {
  final User user=new User(getEntryAttributeAsString(entry,UID));
  user.setFullName(getEntryAttributeAsString(entry,CN));
  user.setActive("String_Node_Str".equalsIgnoreCase(getEntryAttributeAsString(entry,SHADOW_INACTIVE)));
  user.setEmail(entry.get(EMAIL).getString());
  user.setGuest(false);
  user.setExtra(getEntryAttributeAsString(entry,"String_Node_Str"));
  if (entry.get("String_Node_Str") != null) {
    final String infoStr=entry.get("String_Node_Str").getString();
    final String[] parts=infoStr.split("String_Node_Str");
    if (parts.length >= 1 && parts[0].trim().length() > 0) {
      user.setEmailConfirmationToken(parts[0].trim());
    }
    if (parts.length >= 2 && parts[1].trim().length() > 0) {
      user.setEmailConfirmationTokenExpirationDate(parts[1].trim());
    }
    if (parts.length >= 3 && parts[2].trim().length() > 0) {
      user.setResetPasswordToken(parts[2].trim());
    }
    if (parts.length >= 4 && parts[3].trim().length() > 0) {
      user.setResetPasswordTokenExpirationDate(parts[3].trim());
    }
  }
  return user;
}

Fixed version (ground truth):
private User getUserFromEntry(final Entry entry) throws LdapException {
  final User user=new User(getEntryAttributeAsString(entry,UID));
  user.setFullName(getEntryAttributeAsString(entry,CN));
  user.setActive("String_Node_Str".equalsIgnoreCase(getEntryAttributeAsString(entry,SHADOW_INACTIVE)));
  user.setEmail(getEntryAttributeAsString(entry,EMAIL));
  user.setGuest(false);
  user.setExtra(getEntryAttributeAsString(entry,"String_Node_Str"));
  if (entry.get("String_Node_Str") != null) {
    final String infoStr=entry.get("String_Node_Str").getString();
    final String[] parts=infoStr.split("String_Node_Str");
    if (parts.length >= 1 && parts[0].trim().length() > 0) {
      user.setEmailConfirmationToken(parts[0].trim());
    }
    if (parts.length >= 2 && parts[1].trim().length() > 0) {
      user.setEmailConfirmationTokenExpirationDate(parts[1].trim());
    }
    if (parts.length >= 3 && parts[2].trim().length() > 0) {
      user.setResetPasswordToken(parts[2].trim());
    }
    if (parts.length >= 4 && parts[3].trim().length() > 0) {
      user.setResetPasswordTokenExpirationDate(parts[3].trim());
    }
  }
  return user;
}
Program: 188575
Project: 188575
Buggy source:
public static List<String> getRodaConfigurationAsList(String... keyParts){
  return Arrays.asList(rodaConfiguration.getStringArray(getConfigurationKey(keyParts)));
}

Fixed version (ground truth):
public static List<String> getRodaConfigurationAsList(String... keyParts){
  String[] array=rodaConfiguration.getStringArray(getConfigurationKey(keyParts));
  List<String> res=Arrays.asList(array);
  List<String> clean=new ArrayList<String>();
  for (  String s : res) {
    if (s != null && !s.trim().equalsIgnoreCase("String_Node_Str")) {
      clean.add(s);
    }
  }
  return clean;
}
Program: 188576
Project: 188576
Buggy source:
/** 
 * For each role in roda-roles.properties create the role in LDAP if it don't exist already.
 * @param rodaConfig roda configuration
 * @throws GenericException if something unexpected happens creating roles.
 */
private static void createRoles(final Configuration rodaConfig) throws GenericException {
  final Iterator<String> keys=rodaConfig.getKeys("String_Node_Str");
  final Set<String> roles=new HashSet<>();
  while (keys.hasNext()) {
    roles.addAll(Arrays.asList(rodaConfig.getStringArray(keys.next())));
  }
  for (  final String role : roles) {
    try {
      RodaCoreFactory.ldapUtility.addRole(role);
      LOGGER.info("String_Node_Str",role);
    }
 catch (    final RoleAlreadyExistsException e) {
      LOGGER.info("String_Node_Str",role);
      LOGGER.trace(e.getMessage(),e);
    }
catch (    final LdapUtilityException e) {
      throw new GenericException("String_Node_Str" + role + "String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
/** 
 * For each role in roda-roles.properties create the role in LDAP if it don't exist already.
 * @param rodaConfig roda configuration
 * @throws GenericException if something unexpected happens creating roles.
 */
private static void createRoles(final Configuration rodaConfig) throws GenericException {
  final Iterator<String> keys=rodaConfig.getKeys("String_Node_Str");
  final Set<String> roles=new HashSet<>();
  while (keys.hasNext()) {
    roles.addAll(Arrays.asList(rodaConfig.getStringArray(keys.next())));
  }
  for (  final String role : roles) {
    try {
      if (!role.trim().equalsIgnoreCase("String_Node_Str")) {
        RodaCoreFactory.ldapUtility.addRole(role);
        LOGGER.info("String_Node_Str",role);
      }
    }
 catch (    final RoleAlreadyExistsException e) {
      LOGGER.info("String_Node_Str",role);
      LOGGER.trace(e.getMessage(),e);
    }
catch (    final LdapUtilityException e) {
      throw new GenericException("String_Node_Str" + role + "String_Node_Str",e);
    }
  }
}
Program: 188577
Project: 188577
Buggy source:
public static void checkRoles(final User user,final Class<?> invokingMethodInnerClass,final Class<?> classToReturn) throws AuthorizationDeniedException {
  final Method method=invokingMethodInnerClass.getEnclosingMethod();
  final String classParam=(classToReturn == null) ? "String_Node_Str" : "String_Node_Str" + classToReturn.getSimpleName() + "String_Node_Str";
  final String configKey=String.format("String_Node_Str",method.getDeclaringClass().getName(),method.getName(),classParam);
  final List<String> roles=RodaCoreFactory.getRodaConfigurationAsList(configKey);
  checkRoles(user,roles);
}

Fixed version (ground truth):
public static void checkRoles(final User user,final Class<?> invokingMethodInnerClass,final Class<?> classToReturn) throws AuthorizationDeniedException {
  final Method method=invokingMethodInnerClass.getEnclosingMethod();
  final String classParam=(classToReturn == null) ? "String_Node_Str" : "String_Node_Str" + classToReturn.getSimpleName() + "String_Node_Str";
  final String configKey=String.format("String_Node_Str",method.getDeclaringClass().getName(),method.getName(),classParam);
  if (RodaCoreFactory.getRodaConfiguration().containsKey(configKey)) {
    final List<String> roles=RodaCoreFactory.getRodaConfigurationAsList(configKey);
    checkRoles(user,roles);
  }
 else {
    LOGGER.error("String_Node_Str" + user.getName() + "String_Node_Str"+ configKey);
    throw new AuthorizationDeniedException("String_Node_Str" + configKey);
  }
}
Program: 188578
Project: 188578
Buggy source:
public User registerUser(User user,String password,boolean notify) throws GenericException, UserAlreadyExistsException, EmailAlreadyExistsException {
  try {
    user=UserUtility.resetGroupsAndRoles(user);
    User registeredUser=UserUtility.getLdapUtility().registerUser(user,password);
    if (notify) {
      notifyUserCreated(registeredUser);
    }
    return registeredUser;
  }
 catch (  LdapUtilityException e) {
    throw new GenericException("String_Node_Str",e);
  }
catch (  UserAlreadyExistsException e) {
    throw new UserAlreadyExistsException("String_Node_Str",e);
  }
catch (  EmailAlreadyExistsException e) {
    throw new EmailAlreadyExistsException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public User registerUser(User user,String password,boolean notify) throws GenericException, UserAlreadyExistsException, EmailAlreadyExistsException {
  try {
    User registeredUser=UserUtility.getLdapUtility().registerUser(user,password);
    if (notify) {
      notifyUserCreated(registeredUser);
    }
    return registeredUser;
  }
 catch (  LdapUtilityException e) {
    throw new GenericException("String_Node_Str",e);
  }
catch (  UserAlreadyExistsException e) {
    throw new UserAlreadyExistsException("String_Node_Str",e);
  }
catch (  EmailAlreadyExistsException e) {
    throw new EmailAlreadyExistsException("String_Node_Str",e);
  }
}
Program: 188580
Project: 188580
Buggy source:
public void refresh(){
  if (itemsSearchResultPanel != null && itemsSearchAdvancedFieldsPanel.isVisible()) {
    itemsSearchResultPanel.refresh();
  }
  if (representationsSearchResultPanel != null && representationsSearchAdvancedFieldsPanel.isVisible()) {
    representationsSearchResultPanel.refresh();
  }
  if (filesSearchResultPanel != null && filesSearchAdvancedFieldsPanel.isVisible()) {
    filesSearchResultPanel.refresh();
  }
}

Fixed version (ground truth):
public void refresh(){
  if (itemsSearchResultPanel != null && itemsSearchResultPanel.hasElementsSelected()) {
    itemsSearchResultPanel.refresh();
  }
 else   if (representationsSearchResultPanel != null && representationsSearchResultPanel.hasElementsSelected()) {
    representationsSearchResultPanel.refresh();
  }
 else   if (filesSearchResultPanel != null && filesSearchResultPanel.hasElementsSelected()) {
    filesSearchResultPanel.refresh();
  }
}
Program: 188581
Project: 188581
Buggy source:
public SelectedItems<?> getSelected(){
  SelectedItems<?> selected=null;
  if (itemsSearchResultPanel != null && itemsSearchAdvancedFieldsPanel.isVisible()) {
    selected=itemsSearchResultPanel.getSelected();
  }
  if (representationsSearchResultPanel != null && representationsSearchAdvancedFieldsPanel.isVisible()) {
    selected=representationsSearchResultPanel.getSelected();
  }
  if (filesSearchResultPanel != null && filesSearchAdvancedFieldsPanel.isVisible()) {
    selected=filesSearchResultPanel.getSelected();
  }
  if (selected == null) {
    selected=new SelectedItemsList<>();
  }
  return selected;
}

Fixed version (ground truth):
public SelectedItems<?> getSelected(){
  SelectedItems<?> selected=null;
  if (itemsSearchResultPanel != null && itemsSearchResultPanel.hasElementsSelected()) {
    selected=itemsSearchResultPanel.getSelected();
  }
 else   if (representationsSearchResultPanel != null && representationsSearchResultPanel.hasElementsSelected()) {
    selected=representationsSearchResultPanel.getSelected();
  }
 else   if (filesSearchResultPanel != null && filesSearchResultPanel.hasElementsSelected()) {
    selected=filesSearchResultPanel.getSelected();
  }
  if (selected == null) {
    selected=new SelectedItemsList<>();
  }
  return selected;
}
Program: 188585
Project: 188585
Buggy source:
@Test public void testMessageIndex() throws ConfigurationException, RODAException {
  Notification notification=new Notification();
  notification.setSubject("String_Node_Str");
  notification.setBody("String_Node_Str");
  notification.setSentOn(new Date());
  notification.setFromUser("String_Node_Str");
  notification.setRecipientUsers(Arrays.asList("String_Node_Str"));
  try {
    model.createNotification(notification,new EmailNotificationProcessor("String_Node_Str"));
    Assert.fail("String_Node_Str");
  }
 catch (  GenericException e) {
  }
  index.commit(Notification.class);
  Notification message2=model.retrieveNotification(notification.getId());
  assertNotNull(message2);
  assertEquals(notification.getId(),message2.getId());
  assertEquals(notification.getSubject(),message2.getSubject());
  IndexResult<Notification> find=index.find(Notification.class,null,null,new Sublist(0,10));
  assertEquals(1,find.getTotalCount());
  Notification message3=index.retrieve(Notification.class,notification.getId());
  assertNotNull(message3);
  assertEquals(notification.getId(),message3.getId());
  assertEquals(message3.getSubject(),message3.getSubject());
  message3.setSubject("String_Node_Str");
  model.updateNotification(message3);
  Notification message4=index.retrieve(Notification.class,notification.getId());
  assertNotNull(message4);
  assertEquals(notification.getId(),message4.getId());
  assertEquals(message4.getSubject(),"String_Node_Str");
  model.deleteNotification(notification.getId());
}

Fixed version (ground truth):
@Test public void testMessageIndex() throws ConfigurationException, RODAException {
  Notification notification=new Notification();
  notification.setSubject("String_Node_Str");
  notification.setBody("String_Node_Str");
  notification.setSentOn(new Date());
  notification.setFromUser("String_Node_Str");
  notification.setRecipientUsers(Arrays.asList("String_Node_Str"));
  Notification n=model.createNotification(notification,new EmailNotificationProcessor("String_Node_Str"));
  Assert.assertEquals(n.getState(),NOTIFICATION_STATE.FAILED);
  index.commit(Notification.class);
  Notification message2=model.retrieveNotification(notification.getId());
  assertNotNull(message2);
  assertEquals(notification.getId(),message2.getId());
  assertEquals(notification.getSubject(),message2.getSubject());
  IndexResult<Notification> find=index.find(Notification.class,null,null,new Sublist(0,10));
  assertEquals(1,find.getTotalCount());
  Notification message3=index.retrieve(Notification.class,notification.getId());
  assertNotNull(message3);
  assertEquals(notification.getId(),message3.getId());
  assertEquals(message3.getSubject(),message3.getSubject());
  message3.setSubject("String_Node_Str");
  model.updateNotification(message3);
  Notification message4=index.retrieve(Notification.class,notification.getId());
  assertNotNull(message4);
  assertEquals(notification.getId(),message4.getId());
  assertEquals(message4.getSubject(),"String_Node_Str");
  model.deleteNotification(notification.getId());
}
Program: 188586
Project: 188586
Buggy source:
/** 
 */
public Notification createNotification(Notification notification,NotificationProcessor processor) throws GenericException {
  try {
    notification.setId(UUID.randomUUID().toString());
    notification.setAcknowledgeToken(UUID.randomUUID().toString());
    notification=processor.processNotification(this,notification);
    notification.setState(Notification.NOTIFICATION_STATE.COMPLETED);
  }
 catch (  RODAException e) {
    notification.setState(Notification.NOTIFICATION_STATE.FAILED);
    LOGGER.error("String_Node_Str",e);
  }
  try {
    String notificationAsJson=JsonUtils.getJsonFromObject(notification);
    StoragePath notificationPath=ModelUtils.getNotificationStoragePath(notification.getId());
    storage.createBinary(notificationPath,new StringContentPayload(notificationAsJson),false);
    notifyNotificationCreatedOrUpdated(notification);
  }
 catch (  RODAException e) {
    LOGGER.error("String_Node_Str",e);
    throw new GenericException(e);
  }
  return notification;
}

Fixed version (ground truth):
/** 
 * @throws AuthorizationDeniedException
 */
public Notification createNotification(Notification notification,NotificationProcessor processor) throws GenericException, AuthorizationDeniedException {
  try {
    notification.setId(UUID.randomUUID().toString());
    notification.setAcknowledgeToken(UUID.randomUUID().toString());
    notification=processor.processNotification(this,notification);
    notification.setState(Notification.NOTIFICATION_STATE.COMPLETED);
  }
 catch (  RODAException e) {
    notification.setState(Notification.NOTIFICATION_STATE.FAILED);
  }
  try {
    String notificationAsJson=JsonUtils.getJsonFromObject(notification);
    StoragePath notificationPath=ModelUtils.getNotificationStoragePath(notification.getId());
    storage.createBinary(notificationPath,new StringContentPayload(notificationAsJson),false);
    notifyNotificationCreatedOrUpdated(notification);
  }
 catch (  NotFoundException|RequestNotValidException|AlreadyExistsException e) {
    LOGGER.error("String_Node_Str",e);
    throw new GenericException(e);
  }
  return notification;
}
Program: 188587
Project: 188587
Buggy source:
public void acknowledgeNotification(String notificationId,String token) throws RequestNotValidException, 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()) {
      if (recipient.equals(emailToken)) {
        DateFormat df=DateFormat.getDateTimeInstance();
        String ackDate=df.format(new Date());
        notification.addAcknowledgedUser(recipient,ackDate);
        notification.setAcknowledged(true);
        this.updateNotification(notification);
      }
    }
  }
}
Program: 188588
Project: 188588
Buggy source:
public void deleteNotification(String notificationId) throws GenericException, NotFoundException, AuthorizationDeniedException, RequestNotValidException {
  StoragePath notificationPath=ModelUtils.getNotificationStoragePath(notificationId);
  storage.deleteResource(notificationPath);
  notifyNotificationDeleted(notificationId);
}

Fixed version (ground truth):
public void deleteNotification(String notificationId) throws GenericException, NotFoundException, AuthorizationDeniedException {
  try {
    StoragePath notificationPath=ModelUtils.getNotificationStoragePath(notificationId);
    storage.deleteResource(notificationPath);
    notifyNotificationDeleted(notificationId);
  }
 catch (  RequestNotValidException e) {
    LOGGER.error("String_Node_Str",e);
    throw new GenericException(e);
  }
}
Program: 188589
Project: 188589
Buggy source:
public Notification updateNotification(Notification notification) throws GenericException {
  try {
    String notificationAsJson=JsonUtils.getJsonFromObject(notification);
    StoragePath notificationPath=ModelUtils.getNotificationStoragePath(notification.getId());
    storage.updateBinaryContent(notificationPath,new StringContentPayload(notificationAsJson),false,true);
  }
 catch (  GenericException|RequestNotValidException|AuthorizationDeniedException|NotFoundException e) {
    LOGGER.error("String_Node_Str",e);
  }
  notifyNotificationCreatedOrUpdated(notification);
  return notification;
}

Fixed version (ground truth):
public Notification updateNotification(Notification notification) throws GenericException, NotFoundException, AuthorizationDeniedException {
  try {
    String notificationAsJson=JsonUtils.getJsonFromObject(notification);
    StoragePath notificationPath=ModelUtils.getNotificationStoragePath(notification.getId());
    storage.updateBinaryContent(notificationPath,new StringContentPayload(notificationAsJson),false,true);
  }
 catch (  GenericException|RequestNotValidException e) {
    LOGGER.error("String_Node_Str",e);
    throw new GenericException(e);
  }
  notifyNotificationCreatedOrUpdated(notification);
  return notification;
}
Program: 188590
Project: 188590
Buggy source:
public Notification retrieveNotification(String notificationId) throws RequestNotValidException, GenericException, NotFoundException, AuthorizationDeniedException {
  StoragePath notificationPath=ModelUtils.getNotificationStoragePath(notificationId);
  Binary binary=storage.getBinary(notificationPath);
  Notification ret;
  InputStream inputStream=null;
  try {
    inputStream=binary.getContent().createInputStream();
    ret=JsonUtils.getObjectFromJson(inputStream,Notification.class);
  }
 catch (  IOException e) {
    throw new GenericException("String_Node_Str",e);
  }
 finally {
    IOUtils.closeQuietly(inputStream);
  }
  return ret;
}

Fixed version (ground truth):
public Notification retrieveNotification(String notificationId) throws GenericException, NotFoundException, AuthorizationDeniedException {
  InputStream inputStream=null;
  Notification ret;
  try {
    StoragePath notificationPath=ModelUtils.getNotificationStoragePath(notificationId);
    Binary binary=storage.getBinary(notificationPath);
    inputStream=binary.getContent().createInputStream();
    ret=JsonUtils.getObjectFromJson(inputStream,Notification.class);
  }
 catch (  IOException|RequestNotValidException e) {
    throw new GenericException("String_Node_Str",e);
  }
 finally {
    IOUtils.closeQuietly(inputStream);
  }
  return ret;
}
Program: 188591
Project: 188591
Buggy source:
private static Notification sendEmailVerification(String servletPath,User user) throws GenericException {
  try {
    Notification notification=new Notification();
    notification.setSubject("String_Node_Str");
    notification.setFromUser("String_Node_Str");
    notification.setRecipientUsers(Arrays.asList(user.getEmail()));
    String token=user.getEmailConfirmationToken();
    String username=user.getName();
    String verificationURL=servletPath + "String_Node_Str";
    String verificationCompleteURL=verificationURL + "String_Node_Str" + URLEncoder.encode(username,RodaConstants.DEFAULT_ENCODING)+ "String_Node_Str"+ token;
    Map<String,Object> scopes=new HashMap<String,Object>();
    scopes.put("String_Node_Str",username);
    scopes.put("String_Node_Str",token);
    scopes.put("String_Node_Str",verificationURL);
    scopes.put("String_Node_Str",verificationCompleteURL);
    return RodaCoreFactory.getModelService().createNotification(notification,new EmailNotificationProcessor(RodaConstants.VERIFICATION_EMAIL_TEMPLATE,scopes));
  }
 catch (  UnsupportedEncodingException e) {
    throw new GenericException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private static Notification sendEmailVerification(String servletPath,User user) throws GenericException {
  try {
    Notification notification=new Notification();
    notification.setSubject("String_Node_Str");
    notification.setFromUser("String_Node_Str");
    notification.setRecipientUsers(Arrays.asList(user.getEmail()));
    String token=user.getEmailConfirmationToken();
    String username=user.getName();
    String verificationURL=servletPath + "String_Node_Str";
    String verificationCompleteURL=verificationURL + "String_Node_Str" + URLEncoder.encode(username,RodaConstants.DEFAULT_ENCODING)+ "String_Node_Str"+ token;
    Map<String,Object> scopes=new HashMap<String,Object>();
    scopes.put("String_Node_Str",username);
    scopes.put("String_Node_Str",token);
    scopes.put("String_Node_Str",verificationURL);
    scopes.put("String_Node_Str",verificationCompleteURL);
    return RodaCoreFactory.getModelService().createNotification(notification,new EmailNotificationProcessor(RodaConstants.VERIFICATION_EMAIL_TEMPLATE,scopes));
  }
 catch (  UnsupportedEncodingException|AuthorizationDeniedException e) {
    throw new GenericException("String_Node_Str",e);
  }
}
Program: 188594
Project: 188594
Buggy source:
public static List<String> validate(Set<MetadataValue> values,FlowPanel extra){
  List<String> errors=new ArrayList<String>();
  if (values != null) {
    for (    MetadataValue mv : values) {
      String value=mv.get("String_Node_Str");
      boolean mandatory=(mv.get("String_Node_Str") != null && mv.get("String_Node_Str").equalsIgnoreCase("String_Node_Str")) ? true : false;
      if (mandatory && (value == null || value.trim().equalsIgnoreCase("String_Node_Str"))) {
        String labels=mv.get("String_Node_Str");
        errors.add(messages.isAMandatoryField(labels));
      }
    }
  }
  if (errors.size() > 0) {
    extra.clear();
    create(extra,values,true);
  }
  return errors;
}

Fixed version (ground truth):
public static List<String> validate(Set<MetadataValue> values,FlowPanel extra){
  List<String> errors=new ArrayList<String>();
  if (values != null) {
    for (    MetadataValue mv : values) {
      String value=mv.get("String_Node_Str");
      boolean mandatory=(mv.get("String_Node_Str") != null && mv.get("String_Node_Str").equalsIgnoreCase("String_Node_Str")) ? true : false;
      if (mandatory && (value == null || value.trim().equalsIgnoreCase("String_Node_Str"))) {
        if (mv.get("String_Node_Str").equalsIgnoreCase("String_Node_Str")) {
          GWT.log("String_Node_Str");
        }
        String labels=mv.get("String_Node_Str");
        errors.add(messages.isAMandatoryField(labels));
        mv.set("String_Node_Str",messages.mandatoryField());
      }
 else {
        if (mv.get("String_Node_Str").equalsIgnoreCase("String_Node_Str")) {
          GWT.log("String_Node_Str");
        }
        mv.set("String_Node_Str",null);
      }
    }
  }
  extra.clear();
  create(extra,values,true);
  return errors;
}
Program: 188596
Project: 188596
Buggy source:
public static Report lastReport(User user,String id,String resourceOrSip,String acceptFormat) throws AuthorizationDeniedException, GenericException, NotFoundException, RequestNotValidException {
  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);
  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 {
      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: 188597
Project: 188597
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);
  Report lastReport=Browser.lastReport(user,id,resourceOrSip,acceptFormat);
  return Response.ok(lastReport,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) @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: 188598
Project: 188598
Buggy source:
@Override public void onValueChange(ValueChangeEvent<String> event){
  String value=event.getValue();
  try {
    Date date=dateTimeFormat.parse(value.trim());
    mvDate.setValue(date);
  }
 catch (  IllegalArgumentException iae) {
    mvDate.getTextBox().setValue(value);
  }
}

Fixed version (ground truth):
@Override public void onValueChange(ValueChangeEvent<String> event){
  String value=event.getValue();
  try {
    Date date=dateTimeFormat.parse(value.trim());
    mvDate.setValue(date);
    mv.set("String_Node_Str",value);
  }
 catch (  IllegalArgumentException iae) {
    if (event.getValue() == null || event.getValue().trim().equalsIgnoreCase("String_Node_Str")) {
      mv.set("String_Node_Str",null);
    }
    mvDate.getTextBox().setValue(value);
  }
}
Program: 188601
Project: 188601
Buggy source:
public static UserExtraBundle retrieveUserExtraBundle(String name){
  String template=null;
  InputStream templateStream=RodaCoreFactory.getConfigurationFileAsStream(RodaConstants.USERS_TEMPLATE_FOLDER + "String_Node_Str");
  try {
    template=IOUtils.toString(templateStream,StandardCharsets.UTF_8);
  }
 catch (  IOException e1) {
    LOGGER.error("String_Node_Str");
  }
  Set<MetadataValue> values=new HashSet<>();
  if (template != null) {
    values=ServerTools.transform(template);
  }
  try {
    User user=UserUtility.getLdapUtility().getUser(name);
    String userExtra=user.getExtra();
    if (values != null) {
      for (      MetadataValue mv : values) {
        String xpathRaw=mv.get("String_Node_Str");
        if (xpathRaw != null && xpathRaw.length() > 0) {
          String[] xpaths=xpathRaw.split("String_Node_Str");
          String value;
          List<String> allValues=new ArrayList<>();
          for (          String xpath : xpaths) {
            allValues.addAll(ServerTools.applyXpath(userExtra,xpath));
          }
          boolean allEqual=allValues.stream().allMatch(s -> s.trim().equals(allValues.get(0).trim()));
          if (allEqual && !allValues.isEmpty()) {
            value=allValues.get(0);
          }
 else {
            value=String.join("String_Node_Str",allValues);
          }
          mv.set("String_Node_Str",value.trim());
        }
      }
    }
  }
 catch (  LdapUtilityException e) {
  }
  return new UserExtraBundle(name,values);
}

Fixed version (ground truth):
public static UserExtraBundle retrieveUserExtraBundle(String name){
  String template=null;
  InputStream templateStream=RodaCoreFactory.getConfigurationFileAsStream(RodaConstants.USERS_TEMPLATE_FOLDER + "String_Node_Str");
  try {
    template=IOUtils.toString(templateStream,StandardCharsets.UTF_8);
  }
 catch (  IOException e1) {
    LOGGER.error("String_Node_Str");
  }
  Set<MetadataValue> values=new HashSet<>();
  if (template != null) {
    values=ServerTools.transform(template);
  }
  try {
    User user=UserUtility.getLdapUtility().getUser(name);
    String userExtra=user.getExtra();
    if (values != null && userExtra != null) {
      for (      MetadataValue mv : values) {
        String xpathRaw=mv.get("String_Node_Str");
        if (xpathRaw != null && xpathRaw.length() > 0) {
          String[] xpaths=xpathRaw.split("String_Node_Str");
          String value;
          List<String> allValues=new ArrayList<>();
          for (          String xpath : xpaths) {
            allValues.addAll(ServerTools.applyXpath(userExtra,xpath));
          }
          boolean allEqual=allValues.stream().allMatch(s -> s.trim().equals(allValues.get(0).trim()));
          if (allEqual && !allValues.isEmpty()) {
            value=allValues.get(0);
          }
 else {
            value=String.join("String_Node_Str",allValues);
          }
          mv.set("String_Node_Str",value.trim());
        }
      }
    }
  }
 catch (  LdapUtilityException e) {
  }
  return new UserExtraBundle(name,values);
}
Program: 188602
Project: 188602
Buggy source:
public CreateJob(Class<T> classToReceive,final List<PluginType> pluginType){
  if (classToReceive.getName().equals(TransferredResource.class.getName())) {
    this.selected=IngestTransfer.getInstance().getSelected();
  }
 else {
    this.selected=Search.getInstance().getSelected();
  }
  initWidget(uiBinder.createAndBindUi(this));
  BrowserService.Util.getInstance().retrievePluginsInfo(pluginType,new AsyncCallback<List<PluginInfo>>(){
    @Override public void onFailure(    Throwable caught){
    }
    @Override public void onSuccess(    List<PluginInfo> pluginsInfo){
      init(pluginsInfo);
    }
  }
);
}

Fixed version (ground truth):
public CreateJob(Class<T> classToReceive,final List<PluginType> pluginType){
  if (classToReceive.getName().equals(TransferredResource.class.getName())) {
    this.selected=IngestTransfer.getInstance().getSelected();
    isIngest=true;
  }
 else {
    this.selected=Search.getInstance().getSelected();
    isIngest=false;
  }
  initWidget(uiBinder.createAndBindUi(this));
  boolean isEmpty=updateObjectList();
  if (isEmpty && isIngest) {
    Tools.newHistory(IngestTransfer.RESOLVER);
  }
  BrowserService.Util.getInstance().retrievePluginsInfo(pluginType,new AsyncCallback<List<PluginInfo>>(){
    @Override public void onFailure(    Throwable caught){
    }
    @Override public void onSuccess(    List<PluginInfo> pluginsInfo){
      init(pluginsInfo);
    }
  }
);
}