nus-yam/ex-repair huggingface dataset:
Program: 37343
Project: 37343
Buggy source:
/** 
 * Validates a user input based on the field's value transformer and its validation rules. Also considers the   {@code required} flag. This methoddirectly updates the  {@code valid} property.
 * @return Returns whether the user input is a valid value or not.
 */
public boolean validate(){
  String newValue=userInput.getValue();
  if (!validateRequired(newValue)) {
    if (isI18N() && requiredErrorKey.get() != null) {
      errorMessageKeys.setAll(requiredErrorKey.get());
    }
 else     if (requiredError.get() != null) {
      errorMessages.setAll(requiredError.get());
    }
    valid.set(false);
    return false;
  }
  V transformedValue;
  try {
    transformedValue=valueTransformer.transform(newValue);
  }
 catch (  Exception e) {
    if (isI18N() && !formatErrorKey.get().isEmpty()) {
      errorMessageKeys.setAll(formatErrorKey.get());
    }
 else     if (!formatError.get().isEmpty()) {
      errorMessages.setAll(formatError.get());
    }
    valid.set(false);
    return false;
  }
  List<String> errorMessages=validators.stream().map(v -> v.validate(transformedValue)).filter(r -> !r.getResult()).map(ValidationResult::getErrorMessage).collect(Collectors.toList());
  if (isI18N()) {
    errorMessageKeys.setAll(errorMessages);
  }
 else {
    this.errorMessages.setAll(errorMessages);
  }
  if (errorMessages.size() > 0) {
    valid.set(false);
    return false;
  }
  valid.set(true);
  return true;
}

Fixed version (ground truth):
/** 
 * Validates a user input based on the field's value transformer and its validation rules. Also considers the   {@code required} flag. This methoddirectly updates the  {@code valid} property.
 * @return Returns whether the user input is a valid value or not.
 */
public boolean validate(){
  String newValue=userInput.getValue();
  if (!validateRequired(newValue)) {
    if (isI18N() && !requiredErrorKey.get().isEmpty()) {
      errorMessageKeys.setAll(requiredErrorKey.get());
    }
 else     if (!requiredError.get().isEmpty()) {
      errorMessages.setAll(requiredError.get());
    }
    valid.set(false);
    return false;
  }
  V transformedValue;
  try {
    transformedValue=valueTransformer.transform(newValue);
  }
 catch (  Exception e) {
    if (isI18N() && !formatErrorKey.get().isEmpty()) {
      errorMessageKeys.setAll(formatErrorKey.get());
    }
 else     if (!formatError.get().isEmpty()) {
      errorMessages.setAll(formatError.get());
    }
    valid.set(false);
    return false;
  }
  List<String> errorMessages=validators.stream().map(v -> v.validate(transformedValue)).filter(r -> !r.getResult()).map(ValidationResult::getErrorMessage).collect(Collectors.toList());
  if (isI18N()) {
    errorMessageKeys.setAll(errorMessages);
  }
 else {
    this.errorMessages.setAll(errorMessages);
  }
  if (errorMessages.size() > 0) {
    valid.set(false);
    return false;
  }
  valid.set(true);
  return true;
}
Program: 37344
Project: 37344
Buggy source:
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> bind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  persistentSelection.unbindBidirectional(selectionBinding);
  return this;
}

Fixed version (ground truth):
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> bind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  persistentSelection.bindBidirectional(selectionBinding);
  return this;
}
Program: 37345
Project: 37345
Buggy source:
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> bind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  selection.bindBidirectional(selectionBinding);
  selectionBinding.addListener(externalBindingListener);
  return this;
}

Fixed version (ground truth):
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> bind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  selection.bindBidirectional(selectionBinding);
  return this;
}
Program: 37346
Project: 37346
Buggy source:
/** 
 * Unbinds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be unbound with.
 * @param selectionBinding The selection property to be unbound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> unbind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.unbindBidirectional(itemsBinding);
  selection.unbindBidirectional(selectionBinding);
  selectionBinding.removeListener(externalBindingListener);
  return this;
}

Fixed version (ground truth):
/** 
 * Unbinds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be unbound with.
 * @param selectionBinding The selection property to be unbound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> unbind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.unbindBidirectional(itemsBinding);
  selection.unbindBidirectional(selectionBinding);
  return this;
}
Program: 37347
Project: 37347
Buggy source:
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> bind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  selection.bindBidirectional(selectionBinding);
  selectionBinding.addListener(externalBindingListener);
  return this;
}

Fixed version (ground truth):
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> bind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  selection.bindBidirectional(selectionBinding);
  return this;
}
Program: 37348
Project: 37348
Buggy source:
/** 
 * Unbinds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be unbound with.
 * @param selectionBinding The selection property to be unbound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> unbind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.unbindBidirectional(itemsBinding);
  selection.unbindBidirectional(selectionBinding);
  selectionBinding.removeListener(externalBindingListener);
  return this;
}

Fixed version (ground truth):
/** 
 * Unbinds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be unbound with.
 * @param selectionBinding The selection property to be unbound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> unbind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.unbindBidirectional(itemsBinding);
  selection.unbindBidirectional(selectionBinding);
  return this;
}
Program: 37349
Project: 37349
Buggy source:
/** 
 * The constructor of   {@code MultiSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The list of indices of items that are to be selected.
 */
MultiSelectionField(ListProperty<V> items,List<Integer> selection){
  super(items);
  selection.forEach(i -> {
    if (i < this.items.size() && i >= 0) {
      this.selection.add(this.items.get(i));
    }
  }
);
  persistentSelection.addAll(this.selection.getValue());
  changed.bind(Bindings.createBooleanBinding(() -> !persistentSelection.equals(this.selection),persistentSelection,this.selection));
  this.persistentSelection.addListener((observable,oldValue,newValue) -> {
    if (validate()) {
      this.selection.setValue(newValue);
    }
  }
);
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.clear();
    persistentSelection.clear();
  }
);
  renderer=new SimpleListViewControl<>();
}

Fixed version (ground truth):
/** 
 * The constructor of   {@code MultiSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The list of indices of items that are to be selected.
 */
MultiSelectionField(ListProperty<V> items,List<Integer> selection){
  super(items);
  selection.forEach(i -> {
    if (i < this.items.size() && i >= 0) {
      this.selection.add(this.items.get(i));
    }
  }
);
  persistentSelection.addAll(this.selection.getValue());
  changed.bind(Bindings.createBooleanBinding(() -> !persistentSelection.equals(this.selection),this.selection,persistentSelection));
  this.persistentSelection.addListener((observable,oldValue,newValue) -> {
    if (validate()) {
      this.selection.setValue(newValue);
    }
  }
);
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.clear();
    persistentSelection.clear();
  }
);
  renderer=new SimpleListViewControl<>();
}
Program: 37350
Project: 37350
Buggy source:
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> bind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  persistentSelection.bindBidirectional(selectionBinding);
  return this;
}

Fixed version (ground truth):
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> bind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  selection.bindBidirectional(selectionBinding);
  return this;
}
Program: 37351
Project: 37351
Buggy source:
/** 
 * Unbinds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be unbound with.
 * @param selectionBinding The selection property to be unbound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> unbind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.unbindBidirectional(itemsBinding);
  persistentSelection.unbindBidirectional(selectionBinding);
  return this;
}

Fixed version (ground truth):
/** 
 * Unbinds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be unbound with.
 * @param selectionBinding The selection property to be unbound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> unbind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.unbindBidirectional(itemsBinding);
  selection.unbindBidirectional(selectionBinding);
  return this;
}
Program: 37352
Project: 37352
Buggy source:
/** 
 * {@inheritDoc}
 */
boolean validateRequired(){
  return !isRequired() || selection.size() > 0;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
boolean validateRequired(){
  return !isRequired() || (isRequired() && selection.size() > 0);
}
Program: 37353
Project: 37353
Buggy source:
/** 
 * The constructor of   {@code SingleSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The index of the item that is to be selected.
 */
SingleSelectionField(ListProperty<V> items,int selection){
  super(items);
  if (selection < items.size() && selection >= 0) {
    this.selection.set(this.items.get(selection));
    persistentSelection.setValue(this.selection.getValue());
  }
  changed.bind(Bindings.createBooleanBinding(() -> persistentSelection.get() == null ? this.selection.get() != null : !persistentSelection.get().equals(this.selection.get()),persistentSelection,this.selection));
  this.persistentSelection.addListener((observable,oldValue,newValue) -> {
    if (validate()) {
      this.selection.setValue(newValue);
    }
  }
);
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.setValue(null);
    persistentSelection.setValue(null);
  }
);
  renderer=new SimpleComboBoxControl<>();
}

Fixed version (ground truth):
/** 
 * The constructor of   {@code SingleSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The index of the item that is to be selected.
 */
SingleSelectionField(ListProperty<V> items,int selection){
  super(items);
  if (selection < items.size() && selection >= 0) {
    this.selection.set(this.items.get(selection));
    persistentSelection.setValue(this.selection.getValue());
  }
  changed.bind(Bindings.createBooleanBinding(() -> persistentSelection.get() == null ? this.selection.get() != null : !persistentSelection.get().equals(this.selection.get()),this.selection,persistentSelection));
  this.persistentSelection.addListener((observable,oldValue,newValue) -> {
    if (validate()) {
      this.selection.setValue(newValue);
    }
  }
);
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.setValue(null);
    persistentSelection.setValue(null);
  }
);
  renderer=new SimpleComboBoxControl<>();
}
Program: 37354
Project: 37354
Buggy source:
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> bind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  persistentSelection.bindBidirectional(selectionBinding);
  return this;
}

Fixed version (ground truth):
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> bind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  selection.bindBidirectional(selectionBinding);
  return this;
}
Program: 37355
Project: 37355
Buggy source:
/** 
 * Unbinds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be unbound with.
 * @param selectionBinding The selection property to be unbound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> unbind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.unbindBidirectional(itemsBinding);
  persistentSelection.unbindBidirectional(selectionBinding);
  return this;
}

Fixed version (ground truth):
/** 
 * Unbinds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be unbound with.
 * @param selectionBinding The selection property to be unbound with.
 * @return Returns the current field to allow for chaining.
 */
public SingleSelectionField<V> unbind(ListProperty<V> itemsBinding,ObjectProperty<V> selectionBinding){
  items.unbindBidirectional(itemsBinding);
  selection.unbindBidirectional(selectionBinding);
  return this;
}
Program: 37356
Project: 37356
Buggy source:
/** 
 * {@inheritDoc}
 */
boolean validateRequired(){
  return !isRequired() || selection.get() != null;
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
boolean validateRequired(){
  return !isRequired() || (isRequired() && selection.get() != null);
}
Program: 37357
Project: 37357
Buggy source:
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> bind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  persistentSelection.unbindBidirectional(selectionBinding);
  return this;
}

Fixed version (ground truth):
/** 
 * Binds the given items and selection property with the corresponding fields.
 * @param itemsBinding The items property to be bound with.
 * @param selectionBinding The selection property to be bound with.
 * @return Returns the current field to allow for chaining.
 */
public MultiSelectionField<V> bind(ListProperty<V> itemsBinding,ListProperty<V> selectionBinding){
  items.bindBidirectional(itemsBinding);
  persistentSelection.bindBidirectional(selectionBinding);
  return this;
}
Program: 37358
Project: 37358
Buggy source:
/** 
 * The constructor of   {@code MultiSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The list of indices of items that are to be selected.
 */
MultiSelectionField(ListProperty<V> items,List<Integer> selection){
  super(items);
  selection.forEach(i -> {
    if (i < this.items.size() && i >= 0) {
      this.selection.add(this.items.get(i));
    }
  }
);
  persistentSelection.addAll(this.selection.getValue());
  changed.bind(Bindings.createBooleanBinding(() -> !persistentSelection.equals(this.selection),this.selection,persistentSelection));
  this.persistentSelection.addListener((observable,oldValue,newValue) -> {
    if (validate()) {
      this.selection.setValue(newValue);
    }
  }
);
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.clear();
    persistentSelection.clear();
  }
);
  renderer=new SimpleListViewControl<>();
}

Fixed version (ground truth):
/** 
 * The constructor of   {@code MultiSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The list of indices of items that are to be selected.
 */
MultiSelectionField(ListProperty<V> items,List<Integer> selection){
  super(items);
  selection.forEach(i -> {
    if (i < this.items.size() && i >= 0) {
      this.selection.add(this.items.get(i));
    }
  }
);
  persistentSelection.addAll(this.selection.getValue());
  changed.bind(Bindings.createBooleanBinding(() -> !persistentSelection.equals(this.selection),this.selection,persistentSelection));
  this.selection.addListener((observable,oldValue,newValue) -> validate());
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.clear();
    persistentSelection.clear();
  }
);
  renderer=new SimpleListViewControl<>();
}
Program: 37359
Project: 37359
Buggy source:
/** 
 * The constructor of   {@code SingleSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The index of the item that is to be selected.
 */
SingleSelectionField(ListProperty<V> items,int selection){
  super(items);
  if (selection < items.size() && selection >= 0) {
    this.selection.set(this.items.get(selection));
    persistentSelection.setValue(this.selection.getValue());
  }
  changed.bind(Bindings.createBooleanBinding(() -> persistentSelection.get() == null ? this.selection.get() != null : !persistentSelection.get().equals(this.selection.get()),this.selection,persistentSelection));
  this.persistentSelection.addListener((observable,oldValue,newValue) -> {
    if (validate()) {
      this.selection.setValue(newValue);
    }
  }
);
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.setValue(null);
    persistentSelection.setValue(null);
  }
);
  renderer=new SimpleComboBoxControl<>();
}

Fixed version (ground truth):
/** 
 * The constructor of   {@code SingleSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The index of the item that is to be selected.
 */
SingleSelectionField(ListProperty<V> items,int selection){
  super(items);
  if (selection < items.size() && selection >= 0) {
    this.selection.set(this.items.get(selection));
    persistentSelection.setValue(this.selection.getValue());
  }
  changed.bind(Bindings.createBooleanBinding(() -> persistentSelection.get() == null ? this.selection.get() != null : !persistentSelection.get().equals(this.selection.get()),this.selection,persistentSelection));
  this.selection.addListener((observable,oldValue,newValue) -> validate());
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.setValue(null);
    persistentSelection.setValue(null);
  }
);
  renderer=new SimpleComboBoxControl<>();
}
Program: 37360
Project: 37360
Buggy source:
/** 
 * The constructor of   {@code SingleSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The index of the item that is to be selected.
 */
SingleSelectionField(ListProperty<V> items,int selection){
  super(items);
  if (selection < items.size() && selection >= 0) {
    this.selection.set(this.items.get(selection));
    persistentSelection.setValue(this.selection.getValue());
  }
  changed.bind(Bindings.createBooleanBinding(() -> persistentSelection.get() == null ? this.selection.get() != null : !persistentSelection.get().equals(this.selection.get()),persistentSelection,this.selection));
  this.selection.addListener((observable,oldValue,newValue) -> validate());
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.setValue(null);
    persistentSelection.setValue(null);
  }
);
  renderer=new SimpleComboBoxControl<>();
}

Fixed version (ground truth):
/** 
 * The constructor of   {@code SingleSelectionField}.
 * @param items The property that is used to store the items of the field.
 * @param selection The index of the item that is to be selected.
 */
SingleSelectionField(ListProperty<V> items,int selection){
  super(items);
  if (selection < items.size() && selection >= 0) {
    this.selection.set(this.items.get(selection));
    persistentSelection.setValue(this.selection.getValue());
  }
  changed.bind(Bindings.createBooleanBinding(() -> persistentSelection.get() == null ? this.selection.get() != null : !persistentSelection.get().equals(this.selection.get()),persistentSelection,this.selection));
  this.selection.addListener((observable,oldValue,newValue) -> {
    if (validate()) {
      this.selection.setValue(newValue);
    }
  }
);
  items.addListener((observable,oldValue,newValue) -> {
    this.selection.setValue(null);
    persistentSelection.setValue(null);
  }
);
  renderer=new SimpleComboBoxControl<>();
}
Program: 37361
Project: 37361
Buggy source:
/** 
 * Attach to an existing debuggee VM.
 * @param vmManager the virtual machine manager
 * @param hostName the machine where the debuggee VM is launched on
 * @param port the debug port that the debuggee VM exposed
 * @param attachTimeout the timeout when attaching to the debuggee VM
 * @return an instance of IDebugSession
 * @throws IOException when unable to attach.
 * @throws IllegalConnectorArgumentsException when one of the connector arguments is invalid.
 */
public static IDebugSession attach(VirtualMachineManager vmManager,String hostName,int port,int attachTimeout) throws IOException, IllegalConnectorArgumentsException {
  List<AttachingConnector> connectors=vmManager.attachingConnectors();
  AttachingConnector connector=connectors.get(0);
  Map<String,Argument> arguments=connector.defaultArguments();
  arguments.get(HOSTNAME).setValue(hostName);
  arguments.get(PORT).setValue(String.valueOf(port));
  arguments.get(TIMEOUT).setValue(String.valueOf(attachTimeout));
  return new DebugSession(connector.attach(arguments));
}

Fixed version (ground truth):
/** 
 * Attach to an existing debuggee VM.
 * @param vmManager the virtual machine manager
 * @param hostName the machine where the debuggee VM is launched on
 * @param port the debug port that the debuggee VM exposed
 * @param attachTimeout the timeout when attaching to the debuggee VM
 * @return an instance of IDebugSession
 * @throws IOException when unable to attach.
 * @throws IllegalConnectorArgumentsException when one of the connector arguments is invalid.
 */
public static IDebugSession attach(VirtualMachineManager vmManager,String hostName,int port,int attachTimeout) throws IOException, IllegalConnectorArgumentsException {
  List<AttachingConnector> connectors=vmManager.attachingConnectors();
  AttachingConnector connector=connectors.get(0);
  final String SUN_ATTACH_CONNECTOR="String_Node_Str";
  for (  AttachingConnector con : connectors) {
    if (con.getClass().getName().equals(SUN_ATTACH_CONNECTOR)) {
      connector=con;
      break;
    }
  }
  Map<String,Argument> arguments=connector.defaultArguments();
  arguments.get(HOSTNAME).setValue(hostName);
  arguments.get(PORT).setValue(String.valueOf(port));
  arguments.get(TIMEOUT).setValue(String.valueOf(attachTimeout));
  return new DebugSession(connector.attach(arguments));
}
Program: 37362
Project: 37362
Buggy source:
private void ensureDebugTarget(VirtualMachine vm,ThreadReference thread,int depth){
  if (debugTarget == null) {
    if (project == null) {
      String projectName=(String)options.get(Constants.PROJECT_NAME);
      if (StringUtils.isBlank(projectName)) {
        findJavaProjectByStackFrame(thread,depth);
      }
 else {
        IJavaProject javaProject=JdtUtils.getJavaProject(projectName);
        if (javaProject == null) {
          throw new IllegalStateException(String.format("String_Node_Str",projectName));
        }
        project=javaProject;
      }
    }
    if (launch == null) {
      launch=createILaunchMock(project);
    }
    debugTarget=new JDIDebugTarget(launch,vm,"String_Node_Str",false,false,null,false){
      @Override protected synchronized void initialize(){
      }
    }
;
  }
}

Fixed version (ground truth):
private void ensureDebugTarget(VirtualMachine vm,ThreadReference thread,int depth){
  if (debugTarget == null) {
    if (project == null) {
      String projectName=(String)options.get(Constants.PROJECT_NAME);
      if (StringUtils.isBlank(projectName)) {
        project=findJavaProjectByStackFrame(thread,depth);
      }
 else {
        IJavaProject javaProject=JdtUtils.getJavaProject(projectName);
        if (javaProject == null) {
          throw new IllegalStateException(String.format("String_Node_Str",projectName));
        }
        project=javaProject;
      }
    }
    if (launch == null) {
      launch=createILaunchMock(project);
    }
    debugTarget=new JDIDebugTarget(launch,vm,"String_Node_Str",false,false,null,false){
      @Override protected synchronized void initialize(){
      }
    }
;
  }
}
Program: 37363
Project: 37363
Buggy source:
/** 
 * Prepare a list of java project candidates in workspace which contains the main class.
 * @param mainclass the main class specified by launch.json for finding project candidates
 */
private void initializeProjectCandidates(String mainclass){
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  List<IJavaProject> projects=Arrays.stream(root.getProjects()).map(JdtUtils::getJavaProject).filter(p -> {
    try {
      return p != null && p.hasBuildState();
    }
 catch (    Exception e) {
    }
    return false;
  }
).collect(Collectors.toList());
  if (projects.size() > 1 && StringUtils.isNotBlank(mainclass)) {
    projects=Arrays.stream(root.getProjects()).map(JdtUtils::getJavaProject).filter(p -> {
      try {
        return p.findType(mainclass) != null;
      }
 catch (      JavaModelException e) {
      }
      return false;
    }
).collect(Collectors.toList());
    visitedClassNames.add(mainclass);
  }
  if (projects.size() == 1) {
    project=projects.get(0);
  }
  projectCandidates=projects;
}

Fixed version (ground truth):
/** 
 * Prepare a list of java project candidates in workspace which contains the main class.
 * @param mainclass the main class specified by launch.json for finding project candidates
 */
private void initializeProjectCandidates(String mainclass){
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  projectCandidates=Arrays.stream(root.getProjects()).map(JdtUtils::getJavaProject).filter(p -> {
    try {
      return p != null && p.hasBuildState();
    }
 catch (    Exception e) {
    }
    return false;
  }
).collect(Collectors.toList());
  if (StringUtils.isNotBlank(mainclass)) {
    filterProjectCandidatesByClass(mainclass);
  }
}
Program: 37364
Project: 37364
Buggy source:
private void findJavaProjectByStackFrame(ThreadReference thread,int depth){
  if (projectCandidates == null) {
    initializeProjectCandidates((String)options.get(Constants.MAIN_CLASS));
    if (project != null) {
      return;
    }
  }
  if (projectCandidates.size() == 0) {
    logger.severe("String_Node_Str");
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    StackFrame sf=thread.frame(depth);
    String typeName=sf.location().method().declaringType().name();
    List<IJavaProject> validProjects=visitedClassNames.contains(typeName) ? projectCandidates : projectCandidates.stream().filter(p -> {
      try {
        return !visitedClassNames.contains(typeName) && p.findType(typeName) != null;
      }
 catch (      Exception e) {
      }
      return false;
    }
).collect(Collectors.toList());
    visitedClassNames.add(typeName);
    if (validProjects.size() == 1) {
      project=validProjects.get(0);
    }
 else     if (validProjects.size() == 0) {
      logger.severe("String_Node_Str");
      throw new IllegalStateException("String_Node_Str");
    }
 else {
      projectCandidates=validProjects;
      logger.severe("String_Node_Str");
      throw new IllegalStateException("String_Node_Str");
    }
  }
 catch (  Exception ex) {
  }
  logger.severe("String_Node_Str");
  throw new IllegalStateException("String_Node_Str");
}

Fixed version (ground truth):
private IJavaProject findJavaProjectByStackFrame(ThreadReference thread,int depth){
  if (projectCandidates == null) {
    initializeProjectCandidates((String)options.get(Constants.MAIN_CLASS));
  }
  if (projectCandidates.size() == 0) {
    logger.severe("String_Node_Str");
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    StackFrame sf=thread.frame(depth);
    String typeName=sf.location().method().declaringType().name();
    filterProjectCandidatesByClass(typeName);
  }
 catch (  Exception ex) {
    logger.severe("String_Node_Str" + ex.getMessage());
    throw new IllegalStateException("String_Node_Str");
  }
  if (projectCandidates.size() == 1) {
    return projectCandidates.get(0);
  }
  if (projectCandidates.size() == 0) {
    logger.severe("String_Node_Str");
    throw new IllegalStateException("String_Node_Str");
  }
 else {
    logger.severe("String_Node_Str");
    throw new IllegalStateException("String_Node_Str");
  }
}
Program: 37365
Project: 37365
Buggy source:
private static String getFileURI(IResource resource){
  URI uri=resource.getLocationURI();
  if (uri != null) {
    String uriString=uri.toString();
    return uriString.replaceFirst("String_Node_Str","String_Node_Str");
  }
  return null;
}

Fixed version (ground truth):
private static String getFileURI(IResource resource){
  URI uri=resource.getLocationURI();
  if (uri != null) {
    String uriString=uri.toASCIIString();
    return uriString.replaceFirst("String_Node_Str","String_Node_Str");
  }
  return null;
}
Program: 37366
Project: 37366
Buggy source:
@Override public void setExceptionBreakpoints(boolean notifyCaught,boolean notifyUncaught){
  EventRequestManager manager=vm.eventRequestManager();
  ArrayList<ExceptionRequest> legacy=new ArrayList<>(manager.exceptionRequests());
  manager.deleteEventRequests(legacy);
  if (notifyCaught || notifyUncaught) {
    ExceptionRequest request=manager.createExceptionRequest(null,notifyCaught,notifyUncaught);
    request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
    request.enable();
  }
}

Fixed version (ground truth):
@Override public void setExceptionBreakpoints(boolean notifyCaught,boolean notifyUncaught){
  EventRequestManager manager=vm.eventRequestManager();
  ArrayList<ExceptionRequest> legacy=new ArrayList<>(manager.exceptionRequests());
  manager.deleteEventRequests(legacy);
  if (notifyCaught || notifyUncaught) {
    vm.allThreads();
    ExceptionRequest request=manager.createExceptionRequest(null,notifyCaught,notifyUncaught);
    request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
    request.enable();
  }
}
Program: 37369
Project: 37369
Buggy source:
private static CompletableFuture<Location> step(ThreadReference thread,IEventHub eventHub,int stepSize,int stepDepth){
  CompletableFuture<Location> future=new CompletableFuture<>();
  StepRequest request=thread.virtualMachine().eventRequestManager().createStepRequest(thread,stepSize,stepDepth);
  eventHub.stepEvents().filter(debugEvent -> request.equals(debugEvent.event.request())).take(1).subscribe(debugEvent -> {
    StepEvent event=(StepEvent)debugEvent.event;
    future.complete(event.location());
    thread.virtualMachine().eventRequestManager().deleteEventRequest(request);
  }
);
  request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
  request.addCountFilter(1);
  request.enable();
  thread.resume();
  return future;
}

Fixed version (ground truth):
private static CompletableFuture<Location> step(ThreadReference thread,IEventHub eventHub,int stepSize,int stepDepth){
  CompletableFuture<Location> future=new CompletableFuture<>();
  StepRequest request=thread.virtualMachine().eventRequestManager().createStepRequest(thread,stepSize,stepDepth);
  eventHub.stepEvents().filter(debugEvent -> request.equals(debugEvent.event.request())).take(1).subscribe(debugEvent -> {
    StepEvent event=(StepEvent)debugEvent.event;
    future.complete(event.location());
    deleteEventRequestSafely(thread.virtualMachine().eventRequestManager(),request);
  }
);
  request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
  request.addCountFilter(1);
  request.enable();
  thread.resume();
  return future;
}
Program: 37372
Project: 37372
Buggy source:
/** 
 * Decode the encoded string to the original string array by the rules defined in encodeArrayArgument.
 * @param argument the encoded string
 * @return the original string array argument
 */
public static String[] decodeArrayArgument(String argument){
  if (argument == null) {
    return new String[0];
  }
  List<String> result=new ArrayList<>();
  String[] splits=argument.split("String_Node_Str");
  for (  String split : splits) {
    try {
      result.add(URLDecoder.decode(split,StandardCharsets.UTF_8.name()));
    }
 catch (    UnsupportedEncodingException e) {
    }
  }
  return result.toArray(new String[0]);
}

Fixed version (ground truth):
/** 
 * Decode the encoded string to the original string array by the rules defined in encodeArrayArgument.
 * @param argument the encoded string
 * @return the original string array argument
 */
public static String[] decodeArrayArgument(String argument){
  if (argument == null) {
    return null;
  }
  List<String> result=new ArrayList<>();
  String[] splits=argument.split("String_Node_Str");
  for (  String split : splits) {
    try {
      result.add(URLDecoder.decode(split,StandardCharsets.UTF_8.name()));
    }
 catch (    UnsupportedEncodingException e) {
    }
  }
  return result.toArray(new String[0]);
}
Program: 37374
Project: 37374
Buggy source:
@Override public CompletableFuture<List<String>> redefineClasses(){
  return CompletableFuture.supplyAsync(() -> {
    List<String> classNames=new ArrayList();
synchronized (this) {
      classNames.addAll(deltaClassNames);
      doHotCodeReplace(deltaResources,deltaClassNames);
      deltaResources.clear();
      deltaClassNames.clear();
    }
    return classNames;
  }
);
}

Fixed version (ground truth):
@Override public CompletableFuture<List<String>> redefineClasses(){
  return CompletableFuture.supplyAsync(() -> {
    List<String> classNames=new ArrayList<>();
synchronized (this) {
      classNames.addAll(deltaClassNames);
      doHotCodeReplace(deltaResources,deltaClassNames);
      deltaResources.clear();
      deltaClassNames.clear();
    }
    return classNames;
  }
);
}
Program: 37375
Project: 37375
Buggy source:
private boolean containsObsoleteMethods() throws DebugException {
  List<ThreadReference> threads=currentDebugSession.getAllThreads();
  for (  ThreadReference thread : threads) {
    if (!thread.isSuspended()) {
      continue;
    }
    List<StackFrame> frames=getStackFrames(thread,false);
    if (frames == null || frames.isEmpty()) {
      continue;
    }
    for (    StackFrame frame : frames) {
      if (StackFrameUtility.isObsolete(frame)) {
        return true;
      }
    }
  }
  return false;
}

Fixed version (ground truth):
private boolean containsObsoleteMethods() throws DebugException {
  List<ThreadReference> threads=currentDebugSession.getAllThreads();
  for (  ThreadReference thread : threads) {
    if (!thread.isSuspended()) {
      continue;
    }
    List<StackFrame> frames=getStackFrames(thread,true);
    if (frames == null || frames.isEmpty()) {
      continue;
    }
    for (    StackFrame frame : frames) {
      if (StackFrameUtility.isObsolete(frame)) {
        return true;
      }
    }
  }
  return false;
}
Program: 37376
Project: 37376
Buggy source:
@Override public void setExceptionBreakpoints(boolean notifyCaught,boolean notifyUncaught){
  EventRequestManager manager=vm.eventRequestManager();
  ArrayList<ExceptionRequest> legacy=new ArrayList<>(manager.exceptionRequests());
  manager.deleteEventRequests(legacy);
  ExceptionRequest request=manager.createExceptionRequest(null,notifyCaught,notifyUncaught);
  request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
  request.enable();
}

Fixed version (ground truth):
@Override public void setExceptionBreakpoints(boolean notifyCaught,boolean notifyUncaught){
  EventRequestManager manager=vm.eventRequestManager();
  ArrayList<ExceptionRequest> legacy=new ArrayList<>(manager.exceptionRequests());
  manager.deleteEventRequests(legacy);
  if (notifyCaught || notifyUncaught) {
    ExceptionRequest request=manager.createExceptionRequest(null,notifyCaught,notifyUncaught);
    request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
    request.enable();
  }
}
Program: 37377
Project: 37377
Buggy source:
/** 
 * Pop a StackFrame from its thread.
 * @param frame the StackFrame will be popped
 * @return true if succeeded
 */
public static boolean pop(StackFrame frame){
  try {
    frame.thread().popFrames(frame);
  }
 catch (  IncompatibleThreadStateException e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Pop a StackFrame from its thread.
 * @param frame the StackFrame will be popped
 */
public static void pop(StackFrame frame) throws DebugException {
  try {
    frame.thread().popFrames(frame);
  }
 catch (  IncompatibleThreadStateException|InvalidStackFrameException e) {
    throw new DebugException(e.getMessage(),e);
  }
}
Program: 37378
Project: 37378
Buggy source:
/** 
 * Get java project from type.
 * @param typeFullyQualifiedName fully qualified name of type
 * @return java project
 * @throws CoreException CoreException
 */
private static List<IJavaProject> getJavaProjectFromType(String typeFullyQualifiedName) throws CoreException {
  SearchPattern pattern=SearchPattern.createPattern(typeFullyQualifiedName,IJavaSearchConstants.TYPE,IJavaSearchConstants.DECLARATIONS,SearchPattern.R_EXACT_MATCH);
  IJavaSearchScope scope=SearchEngine.createWorkspaceScope();
  ArrayList<IJavaProject> projects=new ArrayList<>();
  SearchRequestor requestor=new SearchRequestor(){
    @Override public void acceptSearchMatch(    SearchMatch match){
      Object element=match.getElement();
      if (element instanceof IJavaElement) {
        projects.add(((IJavaElement)element).getJavaProject());
      }
    }
  }
;
  SearchEngine searchEngine=new SearchEngine();
  searchEngine.search(pattern,new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},scope,requestor,null);
  return projects;
}

Fixed version (ground truth):
/** 
 * Get java project from type.
 * @param typeFullyQualifiedName fully qualified name of type
 * @return java project
 * @throws CoreException CoreException
 */
private static List<IJavaProject> getJavaProjectFromType(String typeFullyQualifiedName) throws CoreException {
  SearchPattern pattern=SearchPattern.createPattern(typeFullyQualifiedName,IJavaSearchConstants.TYPE,IJavaSearchConstants.DECLARATIONS,SearchPattern.R_EXACT_MATCH);
  IJavaSearchScope scope=SearchEngine.createWorkspaceScope();
  ArrayList<IJavaProject> projects=new ArrayList<>();
  SearchRequestor requestor=new SearchRequestor(){
    @Override public void acceptSearchMatch(    SearchMatch match){
      Object element=match.getElement();
      if (element instanceof IJavaElement) {
        projects.add(((IJavaElement)element).getJavaProject());
      }
    }
  }
;
  SearchEngine searchEngine=new SearchEngine();
  searchEngine.search(pattern,new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},scope,requestor,null);
  return projects.stream().distinct().collect(Collectors.toList());
}
Program: 37379
Project: 37379
Buggy source:
@Override public Object getProperty(Object key){
  return this.propertyMap.get(key);
}

Fixed version (ground truth):
@Override public Object getProperty(Object key){
  return propertyMap.get(key);
}
Program: 37380
Project: 37380
Buggy source:
private List<BreakpointRequest> createBreakpointRequests(List<ReferenceType> refTypes,int lineNumber,int hitCount){
  List<Location> locations=collectLocations(refTypes,lineNumber);
  List<Location> existingLocations=new ArrayList<Location>(requests.size());
  Observable.fromIterable(requests).filter(request -> request instanceof BreakpointRequest).map(request -> ((BreakpointRequest)request).location()).toList().subscribe(list -> {
    existingLocations.addAll(list);
  }
);
  List<Location> newLocations=new ArrayList<Location>(locations.size());
  Observable.fromIterable(locations).filter(location -> !existingLocations.contains(location)).toList().subscribe(list -> {
    newLocations.addAll(list);
  }
);
  List<BreakpointRequest> newRequests=new ArrayList<BreakpointRequest>(newLocations.size());
  newLocations.forEach(location -> {
    BreakpointRequest request=vm.eventRequestManager().createBreakpointRequest(location);
    request.setSuspendPolicy(BreakpointRequest.SUSPEND_EVENT_THREAD);
    if (hitCount > 0) {
      request.addCountFilter(hitCount);
    }
    request.enable();
    newRequests.add(request);
  }
);
  return newRequests;
}

Fixed version (ground truth):
private List<BreakpointRequest> createBreakpointRequests(List<ReferenceType> refTypes,int lineNumber,int hitCount){
  List<Location> locations=collectLocations(refTypes,lineNumber);
  List<Location> existingLocations=new ArrayList<>(requests.size());
  Observable.fromIterable(requests).filter(request -> request instanceof BreakpointRequest).map(request -> ((BreakpointRequest)request).location()).toList().subscribe(list -> {
    existingLocations.addAll(list);
  }
);
  List<Location> newLocations=new ArrayList<>(locations.size());
  Observable.fromIterable(locations).filter(location -> !existingLocations.contains(location)).toList().subscribe(list -> {
    newLocations.addAll(list);
  }
);
  List<BreakpointRequest> newRequests=new ArrayList<>(newLocations.size());
  newLocations.forEach(location -> {
    try {
      BreakpointRequest request=vm.eventRequestManager().createBreakpointRequest(location);
      request.setSuspendPolicy(BreakpointRequest.SUSPEND_EVENT_THREAD);
      if (hitCount > 0) {
        request.addCountFilter(hitCount);
      }
      request.enable();
      newRequests.add(request);
    }
 catch (    VMDisconnectedException ex) {
    }
  }
);
  return newRequests;
}
Program: 37381
Project: 37381
Buggy source:
@Override public void putProperty(Object key,Object value){
  this.propertyMap.put(key,value);
}

Fixed version (ground truth):
@Override public void putProperty(Object key,Object value){
  propertyMap.put(key,value);
}
Program: 37383
Project: 37383
Buggy source:
private static List<Location> collectLocations(List<ReferenceType> refTypes,int lineNumber){
  List<Location> locations=new ArrayList<Location>();
  refTypes.forEach(refType -> {
    locations.addAll(collectLocations(refType,lineNumber));
    locations.addAll(collectLocations(refType.nestedTypes(),lineNumber));
  }
);
  return locations;
}

Fixed version (ground truth):
private static List<Location> collectLocations(List<ReferenceType> refTypes,int lineNumber){
  List<Location> locations=new ArrayList<>();
  try {
    refTypes.forEach(refType -> {
      locations.addAll(collectLocations(refType,lineNumber));
      locations.addAll(collectLocations(refType.nestedTypes(),lineNumber));
    }
);
  }
 catch (  VMDisconnectedException ex) {
  }
  return locations;
}
Program: 37384
Project: 37384
Buggy source:
@Override public void resume(){
  for (  ThreadReference tr : DebugUtility.getAllThreadsSafely(this)) {
    while (tr.suspendCount() > 1) {
      tr.resume();
    }
  }
  vm.resume();
}

Fixed version (ground truth):
@Override public void resume(){
  for (  ThreadReference tr : DebugUtility.getAllThreadsSafely(this)) {
    while (!tr.isCollected() && tr.suspendCount() > 1) {
      tr.resume();
    }
  }
  vm.resume();
}
Program: 37385
Project: 37385
Buggy source:
@Override public IBreakpoint createBreakpoint(String className,int lineNumber,int hitCount){
  return new Breakpoint(this.vm,this.eventHub(),className,lineNumber,hitCount);
}

Fixed version (ground truth):
@Override public IBreakpoint createBreakpoint(String className,int lineNumber,int hitCount){
  return new Breakpoint(vm,this.eventHub(),className,lineNumber,hitCount);
}
Program: 37386
Project: 37386
Buggy source:
@Override public void setExceptionBreakpoints(boolean notifyCaught,boolean notifyUncaught){
  EventRequestManager manager=vm.eventRequestManager();
  ArrayList<ExceptionRequest> legacy=new ArrayList<ExceptionRequest>(manager.exceptionRequests());
  manager.deleteEventRequests(legacy);
  ExceptionRequest request=manager.createExceptionRequest(null,notifyCaught,notifyUncaught);
  request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
  request.enable();
}

Fixed version (ground truth):
@Override public void setExceptionBreakpoints(boolean notifyCaught,boolean notifyUncaught){
  EventRequestManager manager=vm.eventRequestManager();
  ArrayList<ExceptionRequest> legacy=new ArrayList<>(manager.exceptionRequests());
  manager.deleteEventRequests(legacy);
  ExceptionRequest request=manager.createExceptionRequest(null,notifyCaught,notifyUncaught);
  request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
  request.enable();
}