nus-yam/ex-repair huggingface dataset:
Program: 60653
Project: 60653
Buggy source:
/** 
 * Get all loggers.
 * @return LoggerTOs
 */
public List<LoggerTO> getLoggers() throws SyncopeClientCompositeErrorException {
  List<LoggerTO> loggers=Arrays.asList(restTemplate.getForObject(baseURL + "String_Node_Str",LoggerTO[].class));
  return loggers;
}

Fixed version (ground truth):
/** 
 * Get all loggers.
 * @return LoggerTOs
 */
public List<LoggerTO> getLoggers(){
  return Arrays.asList(restTemplate.getForObject(baseURL + "String_Node_Str",LoggerTO[].class));
}
Program: 60654
Project: 60654
Buggy source:
public boolean setLoggerLevel(final String name,final String level){
  boolean result;
  try {
    restTemplate.postForObject(baseURL + "String_Node_Str",null,LoggerTO.class,name,level);
    result=true;
  }
 catch (  SyncopeClientCompositeErrorException e) {
    LOG.error("String_Node_Str",e);
    result=false;
  }
  return result;
}

Fixed version (ground truth):
public boolean setLoggerLevel(final String name,final LoggerLevel level){
  boolean result;
  try {
    restTemplate.postForObject(baseURL + "String_Node_Str",null,LoggerTO.class,name,level);
    result=true;
  }
 catch (  SyncopeClientCompositeErrorException e) {
    LOG.error("String_Node_Str",e);
    result=false;
  }
  return result;
}
Program: 60655
Project: 60655
Buggy source:
public final void updateResourceSchemaNames(final ResourceTO resourceTO){
  try {
    resourceSchemaNames=(resourceTO != null && resourceTO.getConnectorId() != null) ? connectorRestClient.getSchemaNames(resourceTO.getName()) : Collections.EMPTY_LIST;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
    resourceSchemaNames=Collections.EMPTY_LIST;
  }
}

Fixed version (ground truth):
public final void updateResourceSchemaNames(final ResourceTO resourceTO){
  try {
    resourceSchemaNames=(resourceTO != null && resourceTO.getConnectorId() != null) ? restClient.getSchemaNames(resourceTO.getName()) : Collections.EMPTY_LIST;
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
    resourceSchemaNames=Collections.EMPTY_LIST;
  }
}
Program: 60656
Project: 60656
Buggy source:
/** 
 * Get all Connectors.
 * @return ResourceTOs
 */
public List<ResourceTO> getAllResources(){
  List<ResourceTO> resources=null;
  try {
    resources=Arrays.asList(restTemplate.getForObject(baseURL + "String_Node_Str",ResourceTO[].class));
  }
 catch (  SyncopeClientCompositeErrorException e) {
    LOG.error("String_Node_Str",e);
  }
  return resources;
}

Fixed version (ground truth):
public List<ResourceTO> getAllResources(){
  List<ResourceTO> resources=null;
  try {
    resources=Arrays.asList(restTemplate.getForObject(baseURL + "String_Node_Str",ResourceTO[].class));
  }
 catch (  SyncopeClientCompositeErrorException e) {
    LOG.error("String_Node_Str",e);
  }
  return resources;
}
Program: 60657
Project: 60657
Buggy source:
/** 
 * Load an already existent resource by its name.
 * @param name (e.g.:surname)
 * @return ResourceTO
 */
public ResourceTO read(final String name){
  ResourceTO resourceTO=null;
  try {
    resourceTO=restTemplate.getForObject(baseURL + "String_Node_Str" + name+ "String_Node_Str",ResourceTO.class);
  }
 catch (  SyncopeClientCompositeErrorException e) {
    LOG.error("String_Node_Str",e);
  }
  return resourceTO;
}

Fixed version (ground truth):
public ResourceTO read(final String name){
  ResourceTO resourceTO=null;
  try {
    resourceTO=restTemplate.getForObject(baseURL + "String_Node_Str" + name+ "String_Node_Str",ResourceTO.class);
  }
 catch (  SyncopeClientCompositeErrorException e) {
    LOG.error("String_Node_Str",e);
  }
  return resourceTO;
}
Program: 60658
Project: 60658
Buggy source:
/** 
 * Create new resource.
 * @param resourceTO
 */
public void create(final ResourceTO resourceTO){
  restTemplate.postForObject(baseURL + "String_Node_Str",resourceTO,ResourceTO.class);
}

Fixed version (ground truth):
public void create(final ResourceTO resourceTO){
  restTemplate.postForObject(baseURL + "String_Node_Str",resourceTO,ResourceTO.class);
}
Program: 60659
Project: 60659
Buggy source:
/** 
 * Update an already existent resource.
 * @param schemaTO updated
 */
public void update(final ResourceTO resourceTO){
  restTemplate.postForObject(baseURL + "String_Node_Str",resourceTO,ResourceTO.class);
}

Fixed version (ground truth):
public void update(final ResourceTO resourceTO){
  restTemplate.postForObject(baseURL + "String_Node_Str",resourceTO,ResourceTO.class);
}
Program: 60660
Project: 60660
Buggy source:
/** 
 * Delete an already existent resource by its name.
 * @param name
 */
public void delete(final String name){
  restTemplate.delete(baseURL + "String_Node_Str",name);
}

Fixed version (ground truth):
public void delete(final String name){
  restTemplate.delete(baseURL + "String_Node_Str",name);
}
Program: 60663
Project: 60663
Buggy source:
private static void populate(final Map<String,AttributeTO> updatedAttrs,final Map<String,AttributeTO> originalAttrs,final AbstractAttributableMod result){
  for (  Map.Entry<String,AttributeTO> entry : updatedAttrs.entrySet()) {
    AttributeMod attrMod=new AttributeMod();
    attrMod.setSchema(entry.getKey());
    Set<String> updatedValues=new HashSet<String>(entry.getValue().getValues());
    Set<String> originalValues=originalAttrs.containsKey(entry.getKey()) ? new HashSet<String>(originalAttrs.get(entry.getKey()).getValues()) : Collections.EMPTY_SET;
    updatedValues.removeAll(originalValues);
    updatedValues.remove("String_Node_Str");
    if (!entry.getValue().isReadonly()) {
      attrMod.setValuesToBeAdded(new ArrayList<String>(updatedValues));
      if (!attrMod.isEmpty()) {
        result.addAttributeToBeRemoved(attrMod.getSchema());
      }
    }
    originalValues.removeAll(entry.getValue().getValues());
    attrMod.setValuesToBeRemoved(new ArrayList<String>(originalValues));
    if (!attrMod.isEmpty()) {
      result.addAttributeToBeUpdated(attrMod);
    }
  }
}

Fixed version (ground truth):
private static void populate(final Map<String,AttributeTO> updatedAttrs,final Map<String,AttributeTO> originalAttrs,final AbstractAttributableMod result){
  for (  Map.Entry<String,AttributeTO> entry : updatedAttrs.entrySet()) {
    AttributeMod attrMod=new AttributeMod();
    attrMod.setSchema(entry.getKey());
    Set<String> updatedValues=new HashSet<String>(entry.getValue().getValues());
    Set<String> originalValues=originalAttrs.containsKey(entry.getKey()) ? new HashSet<String>(originalAttrs.get(entry.getKey()).getValues()) : Collections.EMPTY_SET;
    updatedValues.remove("String_Node_Str");
    if (!entry.getValue().isReadonly()) {
      attrMod.setValuesToBeAdded(new ArrayList<String>(updatedValues));
      if (!attrMod.isEmpty()) {
        result.addAttributeToBeRemoved(attrMod.getSchema());
      }
    }
    attrMod.setValuesToBeRemoved(new ArrayList<String>(originalValues));
    if (!attrMod.isEmpty()) {
      result.addAttributeToBeUpdated(attrMod);
    }
  }
}
Program: 60664
Project: 60664
Buggy source:
public void setValues(List values){
  this.values=values;
}

Fixed version (ground truth):
public void setValues(final List values){
  this.values=values;
}
Program: 60671
Project: 60671
Buggy source:
/** 
 * Create new connector.
 * @param schemaTO
 */
public void create(ConnInstanceTO connectorTO){
  restTemplate.postForObject(baseURL + "String_Node_Str",connectorTO,ConnInstanceTO.class);
}

Fixed version (ground truth):
/** 
 * Create new connector.
 * @param schemaTO
 */
public void create(ConnInstanceTO connectorTO){
  filterProperties(connectorTO.getConfiguration());
  restTemplate.postForObject(baseURL + "String_Node_Str",connectorTO,ConnInstanceTO.class);
}
Program: 60672
Project: 60672
Buggy source:
public void update(ConnInstanceTO connectorTO){
  restTemplate.postForObject(baseURL + "String_Node_Str",connectorTO,ConnInstanceTO.class);
}

Fixed version (ground truth):
public void update(ConnInstanceTO connectorTO){
  filterProperties(connectorTO.getConfiguration());
  restTemplate.postForObject(baseURL + "String_Node_Str",connectorTO,ConnInstanceTO.class);
}
Program: 60673
Project: 60673
Buggy source:
public AjaxNumberFieldPanel(final String id,final String name,final IModel<Number> model,final boolean active){
  super(id,name,model,active);
  field=new TextField<Number>("String_Node_Str",model);
  add(field.setLabel(new Model(name)).setOutputMarkupId(true));
  if (active) {
    field.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
      private static final long serialVersionUID=-1107858522700306810L;
      @Override protected void onUpdate(      AjaxRequestTarget art){
      }
    }
);
  }
}

Fixed version (ground truth):
public AjaxNumberFieldPanel(final String id,final String name,final IModel<Number> model,final Class reference,final boolean active){
  super(id,name,model,active);
  field=new TextField<Number>("String_Node_Str",model,reference);
  add(field.setLabel(new Model(name)).setOutputMarkupId(true));
  if (active) {
    field.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
      private static final long serialVersionUID=-1107858522700306810L;
      @Override protected void onUpdate(      AjaxRequestTarget art){
      }
    }
);
  }
}
Program: 60674
Project: 60674
Buggy source:
public AjaxPasswordFieldPanel(final String id,final String name,final IModel<String> model,final boolean active){
  super(id,name,model,active);
  field=new PasswordTextField("String_Node_Str",model);
  add(field.setLabel(new Model(name)).setOutputMarkupId(true));
  if (active) {
    field.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
      private static final long serialVersionUID=-1107858522700306810L;
      @Override protected void onUpdate(      final AjaxRequestTarget art){
      }
    }
);
  }
}

Fixed version (ground truth):
public AjaxPasswordFieldPanel(final String id,final String name,final IModel<String> model,final boolean active){
  super(id,name,model,active);
  field=new PasswordTextField("String_Node_Str",model);
  field.setRequired(false);
  add(field.setLabel(new Model(name)).setOutputMarkupId(true));
  if (active) {
    field.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
      private static final long serialVersionUID=-1107858522700306810L;
      @Override protected void onUpdate(      final AjaxRequestTarget art){
      }
    }
);
  }
}
Program: 60676
Project: 60676
Buggy source:
public UserDataProvider(final UserRestClient restClient,final int rows,final boolean filtered){
  super();
  this.restClient=restClient;
  this.filtered=filtered;
  this.rows=rows;
  setSort("String_Node_Str",SortOrder.ASCENDING);
  comparator=new SortableUserProviderComparator(this);
}

Fixed version (ground truth):
public UserDataProvider(final UserRestClient restClient,final int paginatorRows,final boolean filtered){
  super();
  this.restClient=restClient;
  this.filtered=filtered;
  this.paginatorRows=paginatorRows;
  setSort("String_Node_Str",SortOrder.ASCENDING);
  comparator=new SortableUserProviderComparator(this);
}
Program: 60677
Project: 60677
Buggy source:
@Override public Iterator<UserTO> iterator(final int first,final int count){
  final List<UserTO> users;
  if (filtered) {
    users=filter == null ? Collections.EMPTY_LIST : restClient.search(filter,(first / rows) + 1,rows);
  }
 else {
    users=restClient.list((first / rows) + 1,rows);
  }
  Collections.sort(users,comparator);
  return users.iterator();
}

Fixed version (ground truth):
@Override public Iterator<UserTO> iterator(final int first,final int count){
  final List<UserTO> users;
  if (filtered) {
    users=filter == null ? Collections.EMPTY_LIST : restClient.search(filter,(first / paginatorRows) + 1,paginatorRows);
  }
 else {
    users=restClient.list((first / paginatorRows) + 1,paginatorRows);
  }
  Collections.sort(users,comparator);
  return users.iterator();
}
Program: 60678
Project: 60678
Buggy source:
@Override public Iterator<T> iterator(final int first,final int count){
  final List<T> tasks=new ArrayList<T>();
  for (  T task : (List<T>)restClient.listTasks(reference,(first / paginatorRows) + 1,count)) {
    if (task instanceof SchedTaskTO && ((SchedTaskTO)task).getLastExec() == null && task.getExecutions() != null && !task.getExecutions().isEmpty()) {
      Collections.sort(task.getExecutions(),new Comparator<TaskExecTO>(){
        @Override public int compare(        final TaskExecTO left,        final TaskExecTO right){
          return left.getStartDate().compareTo(right.getStartDate());
        }
      }
);
      ((SchedTaskTO)task).setLastExec(task.getExecutions().get(task.getExecutions().size() - 1).getStartDate());
    }
    tasks.add(task);
  }
  Collections.sort(tasks,comparator);
  return tasks.iterator();
}

Fixed version (ground truth):
@Override public Iterator<T> iterator(final int first,final int count){
  final List<T> tasks=new ArrayList<T>();
  for (  T task : (List<T>)restClient.listTasks(reference,(first / paginatorRows) + 1,paginatorRows)) {
    if (task instanceof SchedTaskTO && ((SchedTaskTO)task).getLastExec() == null && task.getExecutions() != null && !task.getExecutions().isEmpty()) {
      Collections.sort(task.getExecutions(),new Comparator<TaskExecTO>(){
        @Override public int compare(        final TaskExecTO left,        final TaskExecTO right){
          return left.getStartDate().compareTo(right.getStartDate());
        }
      }
);
      ((SchedTaskTO)task).setLastExec(task.getExecutions().get(task.getExecutions().size() - 1).getStartDate());
    }
    tasks.add(task);
  }
  Collections.sort(tasks,comparator);
  return tasks.iterator();
}
Program: 60681
Project: 60681
Buggy source:
private void updateResultTable(final boolean create){
  rows=preferences.getPaginatorRows(getRequest(),Constants.PREF_USERS_PAGINATOR_ROWS);
  dataProvider=new UserDataProvider(userRestClient,rows,filtered);
  dataProvider.setSearchCond(filter);
  final int page=resultTable != null ? (create ? resultTable.getPageCount() - 1 : resultTable.getCurrentPage()) : 0;
  resultTable=new AjaxFallbackDefaultDataTable<UserTO>("String_Node_Str",getColumns(),dataProvider,rows);
  resultTable.setCurrentPage(page);
  resultTable.setOutputMarkupId(true);
  container.addOrReplace(resultTable);
}

Fixed version (ground truth):
private void updateResultTable(final boolean create){
  rows=preferences.getPaginatorRows(getRequest(),Constants.PREF_USERS_PAGINATOR_ROWS);
  dataProvider=new UserDataProvider(userRestClient,rows,filtered);
  dataProvider.setSearchCond(filter);
  final int currentPage=resultTable != null ? (create ? resultTable.getPageCount() - 1 : resultTable.getCurrentPage()) : 0;
  resultTable=new AjaxFallbackDefaultDataTable<UserTO>("String_Node_Str",getColumns(),dataProvider,rows);
  resultTable.setCurrentPage(currentPage);
  resultTable.setOutputMarkupId(true);
  container.addOrReplace(resultTable);
}
Program: 60683
Project: 60683
Buggy source:
@Override public void onEvent(IEvent<?> event){
  if (event.getPayload() instanceof EventDataWrapper) {
    final EventDataWrapper data=(EventDataWrapper)event.getPayload();
    final AjaxRequestTarget target=data.getTarget();
    updateResultTable(data.isCreate());
    target.add(container);
  }
}

Fixed version (ground truth):
@Override public void onEvent(final IEvent<?> event){
  if (event.getPayload() instanceof EventDataWrapper) {
    final EventDataWrapper data=(EventDataWrapper)event.getPayload();
    final AjaxRequestTarget target=data.getTarget();
    updateResultTable(data.isCreate());
    target.add(container);
  }
}
Program: 60688
Project: 60688
Buggy source:
@Override public Object getDisplayValue(final Boolean object){
  return object ? getString(ConnParameterType.OVERRIDABLE.name()) : getString(ConnParameterType.NOT_OVERRIDABLE.name());
}

Fixed version (ground truth):
@Override public Object getDisplayValue(final ConnBundleTO object){
  return object.getBundleName() + "String_Node_Str" + object.getVersion();
}
Program: 60689
Project: 60689
Buggy source:
@Override public String getIdValue(final Boolean object,final int index){
  return String.valueOf(object);
}

Fixed version (ground truth):
@Override public String getIdValue(final ConnBundleTO object,final int index){
  return object.getBundleName() + "String_Node_Str" + object.getVersion();
}
Program: 60690
Project: 60690
Buggy source:
@Override public FieldPanel setNewModel(final List<String> list){
  setNewModel(new Model(){
    private static final long serialVersionUID=527651414610325237L;
    final DateFormat formatter=new SimpleDateFormat(datePattern);
    @Override public Serializable getObject(){
      Date date=null;
      if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0))) {
        try {
          date=formatter.parse(list.get(0));
        }
 catch (        ParseException e) {
          LOG.error("String_Node_Str",e);
        }
      }
      return date;
    }
    @Override public void setObject(    Serializable object){
      if (object != null) {
        list.clear();
        list.add((String)formatter.format((Date)object));
      }
    }
  }
);
  return this;
}

Fixed version (ground truth):
@Override public FieldPanel setNewModel(final List<Serializable> list){
  setNewModel(new Model(){
    private static final long serialVersionUID=527651414610325237L;
    final DateFormat formatter=new SimpleDateFormat(datePattern);
    @Override public Serializable getObject(){
      Date date=null;
      if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0).toString())) {
        try {
          date=formatter.parse(list.get(0).toString());
        }
 catch (        ParseException e) {
          LOG.error("String_Node_Str",e);
        }
      }
      return date;
    }
    @Override public void setObject(    Serializable object){
      if (object != null) {
        list.clear();
        list.add((String)formatter.format((Date)object));
      }
    }
  }
);
  return this;
}
Program: 60691
Project: 60691
Buggy source:
@Override public Serializable getObject(){
  Date date=null;
  if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0))) {
    try {
      date=formatter.parse(list.get(0));
    }
 catch (    ParseException e) {
      LOG.error("String_Node_Str",e);
    }
  }
  return date;
}

Fixed version (ground truth):
@Override public Serializable getObject(){
  Date date=null;
  if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0).toString())) {
    try {
      date=formatter.parse(list.get(0).toString());
    }
 catch (    ParseException e) {
      LOG.error("String_Node_Str",e);
    }
  }
  return date;
}
Program: 60692
Project: 60692
Buggy source:
@Override public FieldPanel setNewModel(final List<String> list){
  setNewModel(new Model(){
    private static final long serialVersionUID=527651414610325237L;
    final DateFormat formatter=SyncopeSession.get().getDateFormat();
    @Override public Serializable getObject(){
      Date date=null;
      if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0))) {
        try {
          date=formatter.parse(list.get(0));
        }
 catch (        ParseException e) {
          LOG.error("String_Node_Str",e);
        }
      }
      return date;
    }
    @Override public void setObject(    Serializable object){
      if (object != null) {
        list.clear();
        list.add((String)formatter.format((Date)object));
      }
    }
  }
);
  return this;
}

Fixed version (ground truth):
@Override public FieldPanel setNewModel(final List<Serializable> list){
  setNewModel(new Model(){
    private static final long serialVersionUID=527651414610325237L;
    final DateFormat formatter=SyncopeSession.get().getDateFormat();
    @Override public Serializable getObject(){
      Date date=null;
      if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0).toString())) {
        try {
          date=formatter.parse(list.get(0).toString());
        }
 catch (        ParseException e) {
          LOG.error("String_Node_Str",e);
        }
      }
      return date;
    }
    @Override public void setObject(    Serializable object){
      if (object != null) {
        list.clear();
        list.add((String)formatter.format((Date)object));
      }
    }
  }
);
  return this;
}
Program: 60693
Project: 60693
Buggy source:
@Override public Serializable getObject(){
  Date date=null;
  if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0))) {
    try {
      date=formatter.parse(list.get(0));
    }
 catch (    ParseException e) {
      LOG.error("String_Node_Str",e);
    }
  }
  return date;
}

Fixed version (ground truth):
@Override public Serializable getObject(){
  Date date=null;
  if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0).toString())) {
    try {
      date=formatter.parse(list.get(0).toString());
    }
 catch (    ParseException e) {
      LOG.error("String_Node_Str",e);
    }
  }
  return date;
}
Program: 60694
Project: 60694
Buggy source:
public FieldPanel setNewModel(final List<String> list){
  setNewModel(new Model(){
    private static final long serialVersionUID=1088212074765051906L;
    @Override public Serializable getObject(){
      return list != null && !list.isEmpty() ? list.get(0) : null;
    }
    @Override public void setObject(    Serializable object){
      list.clear();
      if (object != null) {
        list.add(object.toString());
      }
    }
  }
);
  return this;
}

Fixed version (ground truth):
public FieldPanel setNewModel(final List<Serializable> list){
  setNewModel(new Model(){
    private static final long serialVersionUID=1088212074765051906L;
    @Override public Serializable getObject(){
      return list != null && !list.isEmpty() ? list.get(0) : null;
    }
    @Override public void setObject(    Serializable object){
      list.clear();
      if (object != null) {
        list.add(object);
      }
    }
  }
);
  return this;
}
Program: 60695
Project: 60695
Buggy source:
@Override public void setObject(Serializable object){
  list.clear();
  if (object != null) {
    list.add(object.toString());
  }
}

Fixed version (ground truth):
@Override public void setObject(Serializable object){
  list.clear();
  if (object != null) {
    list.add(object);
  }
}
Program: 60696
Project: 60696
Buggy source:
public DateFormat getDateFormat(){
  String language="String_Node_Str";
  if (getLocale() != null) {
    language=getLocale().getLanguage();
  }
  DateFormat formatter;
  if ("String_Node_Str".equals(language)) {
    formatter=new SimpleDateFormat(Constants.ITALIAN_DATE_FORMAT);
  }
 else {
    formatter=new SimpleDateFormat(Constants.ENGLISH_DATE_FORMAT);
  }
  return formatter;
}

Fixed version (ground truth):
public SimpleDateFormat getDateFormat(){
  String language="String_Node_Str";
  if (getLocale() != null) {
    language=getLocale().getLanguage();
  }
  SimpleDateFormat formatter;
  if ("String_Node_Str".equals(language)) {
    formatter=new SimpleDateFormat(Constants.ITALIAN_DATE_FORMAT);
  }
 else {
    formatter=new SimpleDateFormat(Constants.ENGLISH_DATE_FORMAT);
  }
  return formatter;
}
Program: 60702
Project: 60702
Buggy source:
/** 
 * Get schema names.
 * @return List of schema names.
 */
public List<String> getSchemaNames(final String kind){
  final List<String> schemasNames=new ArrayList<String>();
  try {
    final List<SchemaTO> userSchemas=Arrays.asList(restTemplate.getForObject(baseURL + "String_Node_Str" + kind+ "String_Node_Str",SchemaTO[].class));
    for (    SchemaTO schemaTO : userSchemas) {
      schemasNames.add(schemaTO.getName());
    }
  }
 catch (  SyncopeClientCompositeErrorException e) {
    LOG.error("String_Node_Str",e);
  }
  return schemasNames;
}

Fixed version (ground truth):
/** 
 * Get schema names.
 * @return List of schema names.
 */
public List<String> getSchemaNames(final String kind){
  final List<String> schemaNames=new ArrayList<String>();
  try {
    final List<SchemaTO> userSchemas=Arrays.asList(restTemplate.getForObject(baseURL + "String_Node_Str" + kind+ "String_Node_Str",SchemaTO[].class));
    for (    SchemaTO schemaTO : userSchemas) {
      schemaNames.add(schemaTO.getName());
    }
  }
 catch (  SyncopeClientCompositeErrorException e) {
    LOG.error("String_Node_Str",e);
  }
  return schemaNames;
}
Program: 60703
Project: 60703
Buggy source:
@Override protected void onUpdate(AjaxRequestTarget art){
}

Fixed version (ground truth):
@Override protected void onUpdate(final AjaxRequestTarget target){
}
Program: 60704
Project: 60704
Buggy source:
public AjaxCheckBoxPanel(final String id,final String name,final IModel<Boolean> model,final boolean active){
  super(id,name,model,active);
  field=new CheckBox("String_Node_Str",model);
  add(field.setLabel(new Model(name)).setOutputMarkupId(true));
  if (active) {
    field.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
      private static final long serialVersionUID=-1107858522700306810L;
      @Override protected void onUpdate(      AjaxRequestTarget art){
      }
    }
);
  }
}

Fixed version (ground truth):
public AjaxCheckBoxPanel(final String id,final String name,final IModel<Boolean> model,final boolean active){
  super(id,name,model,active);
  field=new CheckBox("String_Node_Str",model);
  add(field.setLabel(new Model(name)).setOutputMarkupId(true));
  if (active) {
    field.add(new AjaxFormComponentUpdatingBehavior("String_Node_Str"){
      private static final long serialVersionUID=-1107858522700306810L;
      @Override protected void onUpdate(      final AjaxRequestTarget target){
      }
    }
);
  }
}
Program: 60705
Project: 60705
Buggy source:
@Override public FieldPanel setNewModel(final List<Serializable> list){
  setNewModel(new Model(){
    private static final long serialVersionUID=527651414610325237L;
    final DateFormat formatter=new SimpleDateFormat(datePattern);
    @Override public Serializable getObject(){
      Date date=null;
      if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0).toString())) {
        try {
          date=formatter.parse(list.get(0).toString());
        }
 catch (        ParseException e) {
          LOG.error("String_Node_Str",e);
        }
      }
      return date;
    }
    @Override public void setObject(    Serializable object){
      if (object != null) {
        list.clear();
        list.add((String)formatter.format((Date)object));
      }
    }
  }
);
  return this;
}

Fixed version (ground truth):
@Override public FieldPanel setNewModel(final List<Serializable> list){
  setNewModel(new Model(){
    private static final long serialVersionUID=527651414610325237L;
    private final DateFormat formatter=new SimpleDateFormat(datePattern);
    @Override public Serializable getObject(){
      Date date=null;
      if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0).toString())) {
        try {
          date=formatter.parse(list.get(0).toString());
        }
 catch (        ParseException e) {
          LOG.error("String_Node_Str",e);
        }
      }
      return date;
    }
    @Override public void setObject(    final Serializable object){
      if (object != null) {
        list.clear();
        list.add((String)formatter.format((Date)object));
      }
    }
  }
);
  return this;
}
Program: 60706
Project: 60706
Buggy source:
@Override public void setObject(Serializable object){
  if (object != null) {
    list.clear();
    list.add((String)formatter.format((Date)object));
  }
}

Fixed version (ground truth):
@Override public void setObject(final Serializable object){
  if (object != null) {
    list.clear();
    list.add((String)formatter.format((Date)object));
  }
}
Program: 60707
Project: 60707
Buggy source:
public void setBooleanValue(Boolean booleanValue){
  if (booleanValue == null) {
    this.booleanValue=null;
  }
 else {
    this.booleanValue=getBooleanAsInteger(booleanValue);
  }
}

Fixed version (ground truth):
public void setBooleanValue(final Boolean booleanValue){
  this.booleanValue=booleanValue == null ? null : getBooleanAsInteger(booleanValue);
}
Program: 60708
Project: 60708
Buggy source:
public void setDateValue(Date dateValue){
  this.dateValue=dateValue;
}

Fixed version (ground truth):
public void setDateValue(final Date dateValue){
  this.dateValue=dateValue == null ? null : new Date(dateValue.getTime());
}
Program: 60709
Project: 60709
Buggy source:
public void setLongValue(Long longValue){
  this.longValue=longValue;
}

Fixed version (ground truth):
public void setLongValue(final Long longValue){
  this.longValue=longValue;
}
Program: 60710
Project: 60710
Buggy source:
public void setStringValue(String stringValue){
  this.stringValue=stringValue;
}

Fixed version (ground truth):
public void setStringValue(final String stringValue){
  this.stringValue=stringValue;
}
Program: 60711
Project: 60711
Buggy source:
public Boolean getBooleanValue(){
  if (booleanValue == null) {
    return null;
  }
  return isBooleanAsInteger(booleanValue);
}

Fixed version (ground truth):
public Boolean getBooleanValue(){
  return booleanValue == null ? null : isBooleanAsInteger(booleanValue);
}
Program: 60712
Project: 60712
Buggy source:
public void setDoubleValue(Double doubleValue){
  this.doubleValue=doubleValue;
}

Fixed version (ground truth):
public void setDoubleValue(final Double doubleValue){
  this.doubleValue=doubleValue;
}
Program: 60713
Project: 60713
Buggy source:
public Date getDateValue(){
  return dateValue;
}

Fixed version (ground truth):
public Date getDateValue(){
  return dateValue == null ? null : new Date(dateValue.getTime());
}
Program: 60714
Project: 60714
Buggy source:
public void setStartDate(Date startDate){
  if (startDate != null) {
    this.startDate=new Date(startDate.getTime());
  }
}

Fixed version (ground truth):
public void setStartDate(final Date startDate){
  this.startDate=startDate == null ? null : new Date(startDate.getTime());
}
Program: 60715
Project: 60715
Buggy source:
public void setEndDate(Date endDate){
  if (endDate != null) {
    this.endDate=new Date(endDate.getTime());
  }
}

Fixed version (ground truth):
public void setEndDate(final Date endDate){
  this.endDate=endDate == null ? null : new Date(endDate.getTime());
}
Program: 60716
Project: 60716
Buggy source:
/** 
 * @param password the password to be set
 */
public void setPassword(final String password,final CipherAlgorithm cipherAlgoritm,final int historySize){
  clearPassword=password;
  try {
    this.password=encodePassword(password,cipherAlgoritm);
    this.cipherAlgorithm=cipherAlgoritm;
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",t);
    this.password=null;
  }
}

Fixed version (ground truth):
public void setPassword(final String password,final CipherAlgorithm cipherAlgoritm,final int historySize){
  clearPassword=password;
  try {
    this.password=encodePassword(password,cipherAlgoritm);
    this.cipherAlgorithm=cipherAlgoritm;
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",t);
    this.password=null;
  }
}
Program: 60717
Project: 60717
Buggy source:
@Override public <T extends AbstractVirAttr>boolean addVirtualAttribute(T virtualAttribute){
  return virtualAttributes.add((UVirAttr)virtualAttribute);
}

Fixed version (ground truth):
@Override public <T extends AbstractVirAttr>boolean addVirtualAttribute(final T virtualAttribute){
  return virtualAttributes.add((UVirAttr)virtualAttribute);
}
Program: 60718
Project: 60718
Buggy source:
public Date getTokenExpireTime(){
  return tokenExpireTime;
}

Fixed version (ground truth):
public Date getTokenExpireTime(){
  return tokenExpireTime == null ? null : new Date(tokenExpireTime.getTime());
}
Program: 60719
Project: 60719
Buggy source:
public Membership getMembership(Long syncopeRoleId){
  Membership result=null;
  Membership membership;
  for (Iterator<Membership> itor=getMemberships().iterator(); result == null && itor.hasNext(); ) {
    membership=itor.next();
    if (membership.getSyncopeRole() != null && syncopeRoleId.equals(membership.getSyncopeRole().getId())) {
      result=membership;
    }
  }
  return result;
}

Fixed version (ground truth):
public Membership getMembership(final Long syncopeRoleId){
  Membership result=null;
  Membership membership;
  for (Iterator<Membership> itor=getMemberships().iterator(); result == null && itor.hasNext(); ) {
    membership=itor.next();
    if (membership.getSyncopeRole() != null && syncopeRoleId.equals(membership.getSyncopeRole().getId())) {
      result=membership;
    }
  }
  return result;
}
Program: 60720
Project: 60720
Buggy source:
public void setCreationDate(final Date creationDate){
  this.creationDate=creationDate;
}

Fixed version (ground truth):
public void setCreationDate(final Date creationDate){
  this.creationDate=creationDate == null ? null : new Date(creationDate.getTime());
}
Program: 60721
Project: 60721
Buggy source:
public boolean addMembership(Membership membership){
  return memberships.contains(membership) || memberships.add(membership);
}

Fixed version (ground truth):
public boolean addMembership(final Membership membership){
  return memberships.contains(membership) || memberships.add(membership);
}
Program: 60722
Project: 60722
Buggy source:
public boolean removeMembership(Membership membership){
  return memberships == null || memberships.remove(membership);
}

Fixed version (ground truth):
public boolean removeMembership(final Membership membership){
  return memberships.remove(membership);
}
Program: 60723
Project: 60723
Buggy source:
@Override public void setDerivedAttributes(List<? extends AbstractDerAttr> derivedAttributes){
  this.derivedAttributes=(List<UDerAttr>)derivedAttributes;
}

Fixed version (ground truth):
@Override public void setDerivedAttributes(final List<? extends AbstractDerAttr> derivedAttributes){
  this.derivedAttributes=(List<UDerAttr>)derivedAttributes;
}
Program: 60724
Project: 60724
Buggy source:
public void setChangePwdDate(final Date changePwdDate){
  this.changePwdDate=changePwdDate;
}

Fixed version (ground truth):
public void setChangePwdDate(final Date changePwdDate){
  this.changePwdDate=changePwdDate == null ? null : new Date(changePwdDate.getTime());
}
Program: 60725
Project: 60725
Buggy source:
public void setLastLoginDate(final Date lastLoginDate){
  this.lastLoginDate=lastLoginDate;
}

Fixed version (ground truth):
public void setLastLoginDate(final Date lastLoginDate){
  this.lastLoginDate=lastLoginDate == null ? null : new Date(lastLoginDate.getTime());
}
Program: 60726
Project: 60726
Buggy source:
public boolean verifyPasswordHistory(final String password,final int size){
  try {
    boolean res=false;
    if (size != 0) {
      res=passwordHistory.subList(size >= passwordHistory.size() ? 0 : passwordHistory.size() - size,passwordHistory.size()).contains(cipherAlgorithm != null ? encodePassword(password,cipherAlgorithm) : password);
    }
    return res;
  }
 catch (  Throwable t) {
    LOG.error("String_Node_Str",t);
    return false;
  }
}

Fixed version (ground truth):
public boolean verifyPasswordHistory(final String password,final int size){
  boolean res=false;
  if (size > 0) {
    try {
      res=passwordHistory.subList(size >= passwordHistory.size() ? 0 : passwordHistory.size() - size,passwordHistory.size()).contains(cipherAlgorithm != null ? encodePassword(password,cipherAlgorithm) : password);
    }
 catch (    Throwable t) {
      LOG.error("String_Node_Str",t);
    }
  }
  return res;
}
Program: 60727
Project: 60727
Buggy source:
@Override public void setAttributes(List<? extends AbstractAttr> attributes){
  this.attributes=(List<UAttr>)attributes;
}

Fixed version (ground truth):
@Override public void setAttributes(final List<? extends AbstractAttr> attributes){
  this.attributes=(List<UAttr>)attributes;
}
Program: 60728
Project: 60728
Buggy source:
@Override public void setVirtualAttributes(List<? extends AbstractVirAttr> virtualAttributes){
  this.virtualAttributes=(List<UVirAttr>)virtualAttributes;
}

Fixed version (ground truth):
@Override public void setVirtualAttributes(final List<? extends AbstractVirAttr> virtualAttributes){
  this.virtualAttributes=(List<UVirAttr>)virtualAttributes;
}
Program: 60729
Project: 60729
Buggy source:
public Date getCreationDate(){
  return creationDate;
}

Fixed version (ground truth):
public Date getCreationDate(){
  return creationDate == null ? null : new Date(creationDate.getTime());
}
Program: 60730
Project: 60730
Buggy source:
public void setMemberships(List<Membership> memberships){
  this.memberships.clear();
  if (memberships != null && !memberships.isEmpty()) {
    this.memberships.addAll(memberships);
  }
}

Fixed version (ground truth):
public void setMemberships(final List<Membership> memberships){
  this.memberships.clear();
  if (memberships != null && !memberships.isEmpty()) {
    this.memberships.addAll(memberships);
  }
}
Program: 60731
Project: 60731
Buggy source:
@Override public <T extends AbstractVirAttr>boolean removeVirtualAttribute(T virtualAttribute){
  return virtualAttributes.remove((UVirAttr)virtualAttribute);
}

Fixed version (ground truth):
@Override public <T extends AbstractVirAttr>boolean removeVirtualAttribute(final T virtualAttribute){
  return virtualAttributes.remove((UVirAttr)virtualAttribute);
}
Program: 60732
Project: 60732
Buggy source:
@Override public <T extends AbstractAttr>boolean removeAttribute(T attribute){
  return attributes.remove((UAttr)attribute);
}

Fixed version (ground truth):
@Override public <T extends AbstractAttr>boolean removeAttribute(final T attribute){
  return attributes.remove((UAttr)attribute);
}
Program: 60733
Project: 60733
Buggy source:
public Date getLastLoginDate(){
  return lastLoginDate;
}

Fixed version (ground truth):
public Date getLastLoginDate(){
  return lastLoginDate == null ? null : new Date(lastLoginDate.getTime());
}
Program: 60734
Project: 60734
Buggy source:
private String encodePassword(final String password,final CipherAlgorithm cipherAlgoritm) throws NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, NoSuchPaddingException, UnsupportedEncodingException {
  String encodedPassword=null;
  if (password != null) {
    if (cipherAlgoritm == null || cipherAlgoritm == CipherAlgorithm.AES) {
      final byte[] cleartext=password.getBytes("String_Node_Str");
      final Cipher cipher=Cipher.getInstance(CipherAlgorithm.AES.getAlgorithm());
      cipher.init(Cipher.ENCRYPT_MODE,keySpec);
      byte[] encoded=cipher.doFinal(cleartext);
      encodedPassword=new String(Base64.encode(encoded));
    }
 else {
      MessageDigest algorithm=MessageDigest.getInstance(cipherAlgoritm.getAlgorithm());
      algorithm.reset();
      algorithm.update(password.getBytes());
      byte[] messageDigest=algorithm.digest();
      StringBuilder hexString=new StringBuilder();
      for (int i=0; i < messageDigest.length; i++) {
        String hex=Integer.toHexString(0xff & messageDigest[i]);
        if (hex.length() == 1) {
          hexString.append('0');
        }
        hexString.append(hex);
      }
      encodedPassword=hexString.toString();
    }
  }
  return encodedPassword;
}

Fixed version (ground truth):
private String encodePassword(final String password,final CipherAlgorithm cipherAlgoritm) throws UnsupportedEncodingException, NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException {
  String encodedPassword=null;
  if (password != null) {
    if (cipherAlgoritm == null || cipherAlgoritm == CipherAlgorithm.AES) {
      final byte[] cleartext=password.getBytes("String_Node_Str");
      final Cipher cipher=Cipher.getInstance(CipherAlgorithm.AES.getAlgorithm());
      cipher.init(Cipher.ENCRYPT_MODE,keySpec);
      byte[] encoded=cipher.doFinal(cleartext);
      encodedPassword=new String(Base64.encode(encoded));
    }
 else {
      MessageDigest algorithm=MessageDigest.getInstance(cipherAlgoritm.getAlgorithm());
      algorithm.reset();
      algorithm.update(password.getBytes());
      byte[] messageDigest=algorithm.digest();
      StringBuilder hexString=new StringBuilder();
      for (int i=0; i < messageDigest.length; i++) {
        String hex=Integer.toHexString(0xff & messageDigest[i]);
        if (hex.length() == 1) {
          hexString.append('0');
        }
        hexString.append(hex);
      }
      encodedPassword=hexString.toString();
    }
  }
  return encodedPassword;
}
Program: 60735
Project: 60735
Buggy source:
@Override public <T extends AbstractAttr>boolean addAttribute(T attribute){
  return attributes.add((UAttr)attribute);
}

Fixed version (ground truth):
@Override public <T extends AbstractAttr>boolean addAttribute(final T attribute){
  return attributes.add((UAttr)attribute);
}
Program: 60736
Project: 60736
Buggy source:
public Date getChangePwdDate(){
  return changePwdDate;
}

Fixed version (ground truth):
public Date getChangePwdDate(){
  return changePwdDate == null ? null : new Date(changePwdDate.getTime());
}
Program: 60737
Project: 60737
Buggy source:
public SyncopeUser(){
  super();
  memberships=new ArrayList<Membership>();
  attributes=new ArrayList<UAttr>();
  derivedAttributes=new ArrayList<UDerAttr>();
  virtualAttributes=new ArrayList<UVirAttr>();
  passwordHistory=new ArrayList<String>();
  failedLogins=0;
  suspended=0;
}

Fixed version (ground truth):
public SyncopeUser(){
  super();
  memberships=new ArrayList<Membership>();
  attributes=new ArrayList<UAttr>();
  derivedAttributes=new ArrayList<UDerAttr>();
  virtualAttributes=new ArrayList<UVirAttr>();
  passwordHistory=new ArrayList<String>();
  failedLogins=0;
  suspended=getBooleanAsInteger(Boolean.FALSE);
}
Program: 60738
Project: 60738
Buggy source:
@Override public <T extends AbstractDerAttr>boolean addDerivedAttribute(T derivedAttribute){
  return derivedAttributes.add((UDerAttr)derivedAttribute);
}

Fixed version (ground truth):
@Override public <T extends AbstractDerAttr>boolean addDerivedAttribute(final T derivedAttribute){
  return derivedAttributes.add((UDerAttr)derivedAttribute);
}
Program: 60739
Project: 60739
Buggy source:
private CipherAlgorithm getCipherAlgoritm(){
  CipherAlgorithm cipherAlgoritm;
  try {
    cipherAlgoritm=CipherAlgorithm.valueOf(confDAO.find("String_Node_Str").getValue());
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    cipherAlgoritm=CipherAlgorithm.AES;
  }
  return cipherAlgoritm;
}

Fixed version (ground truth):
private CipherAlgorithm getCipherAlgoritm(){
  return CipherAlgorithm.valueOf(confDAO.find("String_Node_Str","String_Node_Str").getValue());
}
Program: 60741
Project: 60741
Buggy source:
public boolean removeMapping(SchemaMapping mapping){
  return mappings == null || mappings.remove(mapping);
}

Fixed version (ground truth):
public boolean removeMapping(SchemaMapping mapping){
  return mappings.remove(mapping);
}
Program: 60742
Project: 60742
Buggy source:
public void setMappings(List<SchemaMapping> mappings){
  this.mappings.clear();
  if (mappings != null) {
    this.mappings.addAll(mappings);
  }
}

Fixed version (ground truth):
public void setMappings(List<SchemaMapping> mappings){
  for (  SchemaMapping mapping : this.mappings) {
    mapping.setResource(null);
  }
  this.mappings.clear();
  if (mappings != null) {
    this.mappings.addAll(mappings);
  }
}
Program: 60743
Project: 60743
Buggy source:
@PreAuthorize("String_Node_Str") @RequestMapping(method=RequestMethod.POST,value="String_Node_Str") public List<String> getSchemaNames(@RequestBody final ResourceTO resourceTO) throws NotFoundException {
  return getSchemaNames(resourceDataBinder.getResource(resourceTO),false);
}

Fixed version (ground truth):
@PreAuthorize("String_Node_Str") @RequestMapping(method=RequestMethod.POST,value="String_Node_Str") public List<String> getSchemaNames(@RequestBody final ResourceTO resourceTO) throws NotFoundException {
  return getSchemaNames(resourceDataBinder.create(resourceTO),false);
}
Program: 60744
Project: 60744
Buggy source:
@PreAuthorize("String_Node_Str") @RequestMapping(method=RequestMethod.POST,value="String_Node_Str") public List<String> getAllSchemaNames(@RequestBody final ResourceTO resourceTO) throws NotFoundException {
  return getSchemaNames(resourceDataBinder.getResource(resourceTO),true);
}

Fixed version (ground truth):
@PreAuthorize("String_Node_Str") @RequestMapping(method=RequestMethod.POST,value="String_Node_Str") public List<String> getAllSchemaNames(@RequestBody final ResourceTO resourceTO) throws NotFoundException {
  return getSchemaNames(resourceDataBinder.create(resourceTO),true);
}
Program: 60745
Project: 60745
Buggy source:
@PreAuthorize("String_Node_Str") @RequestMapping(method=RequestMethod.POST,value="String_Node_Str") public ResourceTO create(final HttpServletResponse response,final @RequestBody ResourceTO resourceTO) throws SyncopeClientCompositeErrorException, NotFoundException {
  LOG.debug("String_Node_Str",resourceTO);
  if (resourceTO == null) {
    LOG.error("String_Node_Str");
    throw new NotFoundException("String_Node_Str");
  }
  SyncopeClientCompositeErrorException scce=new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
  LOG.debug("String_Node_Str");
  if (resourceTO.getName() != null && resourceDAO.find(resourceTO.getName()) != null) {
    SyncopeClientException ex=new SyncopeClientException(SyncopeClientExceptionType.DuplicateUniqueValue);
    ex.addElement(resourceTO.getName());
    scce.addException(ex);
    throw scce;
  }
  ExternalResource resource=binder.getResource(resourceTO);
  if (resource == null) {
    LOG.error("String_Node_Str");
    SyncopeClientException ex=new SyncopeClientException(SyncopeClientExceptionType.Unknown);
    scce.addException(ex);
    throw scce;
  }
  resource=resourceDAO.save(resource);
  response.setStatus(HttpServletResponse.SC_CREATED);
  return binder.getResourceTO(resource);
}

Fixed version (ground truth):
@PreAuthorize("String_Node_Str") @RequestMapping(method=RequestMethod.POST,value="String_Node_Str") public ResourceTO create(final HttpServletResponse response,final @RequestBody ResourceTO resourceTO) throws SyncopeClientCompositeErrorException, NotFoundException {
  LOG.debug("String_Node_Str",resourceTO);
  if (resourceTO == null) {
    LOG.error("String_Node_Str");
    throw new NotFoundException("String_Node_Str");
  }
  SyncopeClientCompositeErrorException scce=new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
  LOG.debug("String_Node_Str");
  if (resourceTO.getName() != null && resourceDAO.find(resourceTO.getName()) != null) {
    SyncopeClientException ex=new SyncopeClientException(SyncopeClientExceptionType.DuplicateUniqueValue);
    ex.addElement(resourceTO.getName());
    scce.addException(ex);
    throw scce;
  }
  ExternalResource resource=binder.create(resourceTO);
  if (resource == null) {
    LOG.error("String_Node_Str");
    SyncopeClientException ex=new SyncopeClientException(SyncopeClientExceptionType.Unknown);
    scce.addException(ex);
    throw scce;
  }
  resource=resourceDAO.save(resource);
  response.setStatus(HttpServletResponse.SC_CREATED);
  return binder.getResourceTO(resource);
}