Program: 22546
Project: 22546
Buggy source:
/** 
 * Edit the label of the field with the given label.
 * @param eObject The field to edit
 * @param label The label
 * @return The edited field
 */
public EObject editField(EObject eObject,String label){
  if (eObject instanceof Variable) {
    Variable field=(Variable)eObject;
    int indexOfTypeSeparator=label.indexOf(':');
    int indexOfValueSeparator=label.indexOf('=');
    int firstSeparator=label.length();
    if (indexOfTypeSeparator != -1 && indexOfTypeSeparator < firstSeparator) {
      firstSeparator=indexOfTypeSeparator;
    }
    if (indexOfValueSeparator != -1 && indexOfValueSeparator < firstSeparator) {
      firstSeparator=indexOfValueSeparator;
    }
    if (firstSeparator != -1) {
      String name=label.substring(0,firstSeparator);
      if (name.length() > 0) {
        field.setName(name);
      }
      if (indexOfValueSeparator == -1 || indexOfValueSeparator < indexOfTypeSeparator) {
        String typeName=label.substring(indexOfTypeSeparator + 1);
        Type type=this.findTypeByName(this.allRoots(field),typeName);
        field.setType(type);
      }
 else       if (indexOfValueSeparator > indexOfTypeSeparator) {
        String typeName=label.substring(indexOfTypeSeparator + 1,indexOfValueSeparator);
        Type type=this.findTypeByName(this.allRoots(field),typeName);
        field.setType(type);
      }
      if (indexOfTypeSeparator == -1 || indexOfTypeSeparator < indexOfValueSeparator) {
        String value=label.substring(indexOfValueSeparator + 1);
        field.setValue(value);
      }
 else       if (indexOfTypeSeparator > indexOfValueSeparator) {
        String value=label.substring(indexOfValueSeparator + 1,indexOfTypeSeparator);
        field.setValue(value);
      }
    }
 else     if (label.length() > 0) {
      field.setName(label);
    }
  }
  return eObject;
}

Fixed version (ground truth):
/** 
 * Edit the label of the field with the given label.
 * @param eObject The field to edit
 * @param label The label
 * @return The edited field
 */
public EObject editField(EObject eObject,String label){
  if (eObject instanceof Variable) {
    Variable field=(Variable)eObject;
    int indexOfTypeSeparator=label.indexOf(':');
    int indexOfValueSeparator=label.indexOf('=');
    int firstSeparator=label.length();
    if (indexOfTypeSeparator != -1 && indexOfTypeSeparator < firstSeparator) {
      firstSeparator=indexOfTypeSeparator;
    }
    if (indexOfValueSeparator != -1 && indexOfValueSeparator < firstSeparator) {
      firstSeparator=indexOfValueSeparator;
    }
    if (firstSeparator != -1) {
      String name=label.substring(0,firstSeparator);
      if (name.length() > 0) {
        field.setName(name);
      }
      if (indexOfTypeSeparator != -1 && (indexOfValueSeparator == -1 || indexOfValueSeparator < indexOfTypeSeparator)) {
        String typeName=label.substring(indexOfTypeSeparator + 1);
        Type type=this.findTypeByName(this.allRoots(field),typeName);
        field.setType(type);
      }
 else       if (indexOfTypeSeparator != -1 && indexOfValueSeparator > indexOfTypeSeparator) {
        String typeName=label.substring(indexOfTypeSeparator + 1,indexOfValueSeparator);
        Type type=this.findTypeByName(this.allRoots(field),typeName);
        field.setType(type);
      }
      if (indexOfValueSeparator != -1 && (indexOfTypeSeparator == -1 || indexOfTypeSeparator < indexOfValueSeparator)) {
        String value=label.substring(indexOfValueSeparator + 1);
        field.setValue(value);
      }
 else       if (indexOfValueSeparator != -1 && indexOfTypeSeparator > indexOfValueSeparator) {
        String value=label.substring(indexOfValueSeparator + 1,indexOfTypeSeparator);
        field.setValue(value);
      }
    }
 else     if (label.length() > 0) {
      field.setName(label);
    }
  }
  return eObject;
}