nus-yam/ex-repair huggingface dataset:
Program: 61216
Project: 61216
Buggy source:
@Override protected void onSubmit(AjaxRequestTarget target,Form form){
  UserTO userTO=(UserTO)form.getDefaultModelObject();
  boolean res=false;
  try {
    userTO.setResources(getResourcesSet(resourcesPalette.getModelCollection()));
    userTO.setAttributes(getUserAttributesSet());
    userTO.setMemberships(getMembershipsSet());
    if (createFlag) {
      usersRestClient.createUser(userTO);
    }
 else {
      setupUserMod(userTO);
      if (userMod != null) {
        res=usersRestClient.updateUser(userMod);
        if (!res)         error(getString("String_Node_Str"));
        Users callerPage=(Users)basePage;
        callerPage.setOperationResult(true);
      }
    }
    window.close(target);
  }
 catch (  Exception e) {
    error(getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
@Override protected void onSubmit(AjaxRequestTarget target,Form form){
  UserTO userTO=(UserTO)form.getDefaultModelObject();
  boolean res=false;
  try {
    userTO.setResources(getResourcesSet(resourcesPalette.getModelCollection()));
    userTO.setAttributes(getUserAttributesList());
    userTO.setMemberships(getMembershipsSet());
    if (createFlag) {
      usersRestClient.createUser(userTO);
    }
 else {
      setupUserMod(userTO);
      if (userMod != null) {
        res=usersRestClient.updateUser(userMod);
        if (!res)         error(getString("String_Node_Str"));
        Users callerPage=(Users)basePage;
        callerPage.setOperationResult(true);
      }
    }
    window.close(target);
  }
 catch (  Exception e) {
    error(getString("String_Node_Str") + "String_Node_Str" + e.getMessage());
  }
}
Program: 61218
Project: 61218
Buggy source:
/** 
 * Build a DateFieldPanel.
 * @param component id
 * @param label name
 * @param IModel<?> object
 * @param required flag
 * @param readonly flag
 */
public DateFieldPanel(String id,String name,IModel<?> model,boolean required,boolean readonly){
  super(id,model);
  if (required) {
    add(new Label("String_Node_Str","String_Node_Str"));
  }
 else {
    add(new Label("String_Node_Str","String_Node_Str"));
  }
  UpdatingTextField dateField=new UpdatingTextField("String_Node_Str",model,Date.class);
  dateField.setRequired(required);
  dateField.setEnabled(!readonly);
  dateField.setLabel(new Model(name));
  dateField.add(new DatePicker());
  add(dateField);
}

Fixed version (ground truth):
/** 
 * Build a DateFieldPanel.
 * @param component id
 * @param label name
 * @param IModel<Date> date object
 * @param schema attribute's date pattern
 * @param required flag
 * @param readonly flag
 */
public DateFieldPanel(String id,String name,IModel<Date> model,final String datePattern,boolean required,boolean readonly){
  super(id,model);
  if (required) {
    add(new Label("String_Node_Str","String_Node_Str"));
  }
 else {
    add(new Label("String_Node_Str","String_Node_Str"));
  }
  Fragment datePanel=null;
  if (!datePattern.contains("String_Node_Str")) {
    datePanel=new Fragment("String_Node_Str","String_Node_Str",this);
    DateTextField field=new DateTextField("String_Node_Str",model,datePattern);
    field.add(getDatePicker());
    field.setRequired(required);
    field.setEnabled(!readonly);
    field.setLabel(new Model(name));
    datePanel.add(field);
  }
 else {
    datePanel=new Fragment("String_Node_Str","String_Node_Str",this);
    DateTimeField field=new DateTimeField("String_Node_Str",model);
    field.setRequired(required);
    field.setEnabled(!readonly);
    field.setLabel(new Model(name));
    datePanel.add(field);
  }
  add(datePanel);
}
Program: 61224
Project: 61224
Buggy source:
/** 
 * Build a DateFieldPanel.
 * @param component id
 * @param label name
 * @param IModel<Date> date object
 * @param schema attribute's date pattern
 * @param required flag
 * @param readonly flag
 */
public DateFieldPanel(String id,String name,IModel<Date> model,final String datePattern,boolean required,boolean readonly){
  super(id,model);
  if (required) {
    add(new Label("String_Node_Str","String_Node_Str"));
  }
 else {
    add(new Label("String_Node_Str","String_Node_Str"));
  }
  Fragment datePanel=null;
  if (!datePattern.contains("String_Node_Str")) {
    datePanel=new Fragment("String_Node_Str","String_Node_Str",this);
    DateTextField field=new DateTextField("String_Node_Str",model,datePattern);
    field.add(getDatePicker());
    field.setRequired(required);
    field.setEnabled(!readonly);
    field.setLabel(new Model(name));
    datePanel.add(field);
  }
 else {
    datePanel=new Fragment("String_Node_Str","String_Node_Str",this);
    DateTimeField field=new DateTimeField("String_Node_Str",model);
    field.setRequired(required);
    field.setEnabled(!readonly);
    field.setLabel(new Model(name));
    datePanel.add(field);
  }
  add(datePanel);
}

Fixed version (ground truth):
/** 
 * @param id wicket id
 * @param name component name
 * @param model model object
 * @param datePattern schema attribute date pattern defined for it
 * @param required TRUE if it is required, FALSE otherwise
 * @param readonly TRUE if it can't be valued, FALSE otherwise
 * @param form form where it will be included
 */
public DateFieldPanel(String id,String name,IModel<Date> model,final String datePattern,boolean required,boolean readonly,Form form){
  super(id,model);
  if (required) {
    add(new Label("String_Node_Str","String_Node_Str"));
  }
 else {
    add(new Label("String_Node_Str","String_Node_Str"));
  }
  Fragment datePanel=null;
  if (!datePattern.contains("String_Node_Str")) {
    datePanel=new Fragment("String_Node_Str","String_Node_Str",this);
    DateTextField field=new DateTextField("String_Node_Str",model,datePattern);
    field.add(getDatePicker());
    field.setEnabled(!readonly);
    field.setLabel(new Model(name));
    datePanel.add(field);
  }
 else {
    datePanel=new Fragment("String_Node_Str","String_Node_Str",this);
    DateTimeField field=new DateTimeField("String_Node_Str",model);
    field.setEnabled(!readonly);
    field.setLabel(new Model(name));
    datePanel.add(field);
    if (required)     form.add(new DateTimeFormValidator(field));
  }
  add(datePanel);
}
Program: 61225
Project: 61225
Buggy source:
public SchemaTO(){
  derivedSchemas=new HashSet<String>();
}

Fixed version (ground truth):
public SchemaTO(){
  mandatoryCondition="String_Node_Str";
  derivedSchemas=new HashSet<String>();
}
Program: 61226
Project: 61226
Buggy source:
/** 
 * @see http://commons.apache.org/jexl/reference/index.html
 * @return
 */
public String getValue(Collection<? extends AbstractAttribute> attributes){
  Expression jexlExpression=jexlEngine.createExpression(getDerivedSchema().getExpression());
  JexlContext jexlContext=new MapContext();
  List<? extends AbstractAttributeValue> attributeValues=null;
  String expressionValue=null;
  AbstractAttribute attribute=null;
  AbstractAttributeValue attributeValue=null;
  for (Iterator<? extends AbstractAttribute> itor=attributes.iterator(); itor.hasNext(); ) {
    attribute=itor.next();
    attributeValues=attribute.getValues();
    if (attributeValues.isEmpty() || !getDerivedSchema().getSchemas().contains(attribute.getSchema())) {
      expressionValue="String_Node_Str";
    }
 else {
      attributeValue=attributeValues.iterator().next();
      expressionValue=attributeValue.getValueAsString();
    }
    jexlContext.set(attribute.getSchema().getName(),expressionValue);
  }
  return jexlExpression.evaluate(jexlContext).toString();
}

Fixed version (ground truth):
/** 
 * @see http://commons.apache.org/jexl/reference/index.html
 * @param attributes the set of attributes against which evaluate thisderived attribute
 * @return the value of this derived attribute
 */
public String getValue(final Collection<? extends AbstractAttribute> attributes){
  JexlContext jexlContext=new MapContext();
  List<? extends AbstractAttributeValue> attributeValues=null;
  String expressionValue=null;
  AbstractAttribute attribute=null;
  AbstractAttributeValue attributeValue=null;
  for (Iterator<? extends AbstractAttribute> itor=attributes.iterator(); itor.hasNext(); ) {
    attribute=itor.next();
    attributeValues=attribute.getValues();
    if (attributeValues.isEmpty() || !getDerivedSchema().getSchemas().contains(attribute.getSchema())) {
      expressionValue="String_Node_Str";
    }
 else {
      attributeValue=attributeValues.iterator().next();
      expressionValue=attributeValue.getValueAsString();
    }
    jexlContext.set(attribute.getSchema().getName(),expressionValue);
  }
  ConfigurableApplicationContext context=ApplicationContextManager.getApplicationContext();
  JexlEngine jexlEngine=(JexlEngine)context.getBean("String_Node_Str");
  String result=null;
  try {
    Expression jexlExpression=jexlEngine.createExpression(getDerivedSchema().getExpression());
    result=jexlExpression.evaluate(jexlContext).toString();
  }
 catch (  JexlException e) {
    LOG.error("String_Node_Str" + getDerivedSchema().getExpression(),e);
  }
  return result;
}
Program: 61227
Project: 61227
Buggy source:
public AbstractSchema(){
  type=SchemaValueType.String;
  virtual=getBooleanAsCharacter(false);
  mandatory=getBooleanAsCharacter(false);
  multivalue=getBooleanAsCharacter(false);
  uniquevalue=getBooleanAsCharacter(false);
  readonly=getBooleanAsCharacter(false);
}

Fixed version (ground truth):
public AbstractSchema(){
  super();
  type=SchemaValueType.String;
  virtual=getBooleanAsCharacter(false);
  mandatoryCondition=Boolean.FALSE.toString();
  multivalue=getBooleanAsCharacter(false);
  uniquevalue=getBooleanAsCharacter(false);
  readonly=getBooleanAsCharacter(false);
}
Program: 61228
Project: 61228
Buggy source:
public SchemaMapping(){
  super();
  accountid=getBooleanAsCharacter(false);
  password=getBooleanAsCharacter(false);
  nullable=getBooleanAsCharacter(true);
}

Fixed version (ground truth):
public SchemaMapping(){
  super();
  accountid=getBooleanAsCharacter(false);
  password=getBooleanAsCharacter(false);
  mandatoryCondition=Boolean.FALSE.toString();
}
Program: 61229
Project: 61229
Buggy source:
private <T extends AbstractSchema>boolean evaluateMandatoryCondition(final Set<TargetResource> resources,final List<? extends AbstractAttribute> attributes,final String schemaName,final Class<T> referenceSchema){
  boolean result=resources == null || resources.isEmpty() ? false : true;
  TargetResource resource;
  for (Iterator<TargetResource> itor=resources.iterator(); itor.hasNext() && result; ) {
    resource=itor.next();
    result&=evaluateMandatoryCondition(resource.getName(),attributes,schemaName,referenceSchema);
  }
  return result;
}

Fixed version (ground truth):
private <T extends AbstractSchema>boolean evaluateMandatoryCondition(final Set<TargetResource> resources,final List<? extends AbstractAttribute> attributes,final String schemaName,final Class<T> referenceSchema){
  boolean result=false;
  TargetResource resource;
  for (Iterator<TargetResource> itor=resources.iterator(); itor.hasNext() && !result; ) {
    resource=itor.next();
    if (resource.isForceMandatoryConstraint()) {
      result|=evaluateMandatoryCondition(resource.getName(),attributes,schemaName,referenceSchema);
    }
  }
  return result;
}
Program: 61230
Project: 61230
Buggy source:
@Override public void removeMapping(Long mappingId){
  SchemaMapping mapping=findMapping(mappingId);
  if (mapping == null) {
    return;
  }
  String schemaName=mapping.getSchemaName();
  SchemaType schemaType=mapping.getSchemaType();
  try {
    schemaType.getSchemaType().asSubclass(AbstractSchema.class);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + schemaType.getClassName());
    }
    AbstractSchema schema=find(schemaName,schemaType.getSchemaType());
    if (schema != null) {
      schema.removeMapping(mapping);
    }
  }
 catch (  ClassCastException e) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + schemaType.getClassName());
    }
  }
  TargetResource resource=resourceDAO.find(mapping.getResource().getName());
  if (resource != null) {
    resource.removeMapping(mapping);
  }
  mapping.setResource(null);
  entityManager.remove(mapping);
}

Fixed version (ground truth):
@Override public void removeMapping(Long mappingId){
  SchemaMapping mapping=findMapping(mappingId);
  if (mapping == null) {
    return;
  }
  String schemaName=mapping.getSchemaName();
  SchemaType schemaType=mapping.getSchemaType();
  try {
    schemaType.getSchemaClass().asSubclass(AbstractSchema.class);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + schemaType.getClassName());
    }
    AbstractSchema schema=find(schemaName,schemaType.getSchemaClass());
    if (schema != null) {
      schema.removeMapping(mapping);
    }
  }
 catch (  ClassCastException e) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + schemaType.getClassName());
    }
  }
  TargetResource resource=resourceDAO.find(mapping.getResource().getName());
  if (resource != null) {
    resource.removeMapping(mapping);
  }
  mapping.setResource(null);
  entityManager.remove(mapping);
}
Program: 61235
Project: 61235
Buggy source:
public void setBooleanValue(Boolean booleanValue){
  if (booleanValue == null) {
    this.booleanValue=null;
  }
 else   if (booleanValue == Boolean.TRUE) {
    this.booleanValue='T';
  }
 else {
    this.booleanValue='F';
  }
}

Fixed version (ground truth):
public void setBooleanValue(Boolean booleanValue){
  if (booleanValue == null) {
    this.booleanValue=null;
  }
 else {
    this.booleanValue=getBooleanAsCharacter(booleanValue);
  }
}
Program: 61236
Project: 61236
Buggy source:
public Boolean getBooleanValue(){
  if (booleanValue == null) {
    return null;
  }
  return booleanValue == 'T' ? Boolean.TRUE : Boolean.FALSE;
}

Fixed version (ground truth):
public Boolean getBooleanValue(){
  if (booleanValue == null) {
    return null;
  }
  return isBooleanAsCharacter(booleanValue);
}
Program: 61237
Project: 61237
Buggy source:
public boolean isMultivalue(){
  return multivalue != null && multivalue == 'T';
}

Fixed version (ground truth):
public boolean isMultivalue(){
  return isBooleanAsCharacter(multivalue);
}
Program: 61238
Project: 61238
Buggy source:
public void setMandatory(boolean mandatory){
  this.mandatory=mandatory ? 'T' : 'F';
}

Fixed version (ground truth):
public void setMandatory(boolean mandatory){
  this.mandatory=getBooleanAsCharacter(mandatory);
}
Program: 61239
Project: 61239
Buggy source:
public boolean addMapping(SchemaMapping mapping){
  if (this.mappings == null)   this.mappings=new ArrayList<SchemaMapping>();
  return this.mappings.contains(mapping) || this.mappings.add(mapping);
}

Fixed version (ground truth):
public boolean addMapping(SchemaMapping mapping){
  if (this.mappings == null) {
    this.mappings=new ArrayList<SchemaMapping>();
  }
  return this.mappings.contains(mapping) || this.mappings.add(mapping);
}
Program: 61240
Project: 61240
Buggy source:
public void setMultivalue(boolean multivalue){
  this.multivalue=multivalue ? 'T' : 'F';
}

Fixed version (ground truth):
public void setMultivalue(boolean multivalue){
  this.multivalue=getBooleanAsCharacter(multivalue);
}
Program: 61241
Project: 61241
Buggy source:
public boolean isUniquevalue(){
  return uniquevalue != null && uniquevalue == 'T';
}

Fixed version (ground truth):
public boolean isUniquevalue(){
  return isBooleanAsCharacter(uniquevalue);
}
Program: 61242
Project: 61242
Buggy source:
public void setVirtual(boolean virtual){
  this.virtual=virtual ? 'T' : 'F';
}

Fixed version (ground truth):
public void setVirtual(boolean virtual){
  this.virtual=getBooleanAsCharacter(virtual);
}
Program: 61243
Project: 61243
Buggy source:
public boolean isMandatory(){
  return mandatory != null && mandatory == 'T';
}

Fixed version (ground truth):
public boolean isMandatory(){
  return isBooleanAsCharacter(mandatory);
}
Program: 61244
Project: 61244
Buggy source:
public List<SchemaMapping> getMappings(){
  if (this.mappings == null)   this.mappings=new ArrayList<SchemaMapping>();
  return this.mappings;
}

Fixed version (ground truth):
public List<SchemaMapping> getMappings(){
  if (this.mappings == null) {
    this.mappings=new ArrayList<SchemaMapping>();
  }
  return this.mappings;
}
Program: 61245
Project: 61245
Buggy source:
public AbstractSchema(){
  type=SchemaValueType.String;
  virtual='F';
  mandatory='F';
  multivalue='F';
  uniquevalue='F';
}

Fixed version (ground truth):
public AbstractSchema(){
  type=SchemaValueType.String;
  virtual=getBooleanAsCharacter(false);
  mandatory=getBooleanAsCharacter(false);
  multivalue=getBooleanAsCharacter(false);
  uniquevalue=getBooleanAsCharacter(false);
  readonly=getBooleanAsCharacter(false);
}
Program: 61246
Project: 61246
Buggy source:
public boolean isVirtual(){
  return virtual != null && virtual == 'T';
}

Fixed version (ground truth):
public boolean isVirtual(){
  return isBooleanAsCharacter(virtual);
}
Program: 61247
Project: 61247
Buggy source:
public void setUniquevalue(boolean uniquevalue){
  this.uniquevalue=uniquevalue ? 'T' : 'F';
}

Fixed version (ground truth):
public void setUniquevalue(boolean uniquevalue){
  this.uniquevalue=getBooleanAsCharacter(uniquevalue);
}
Program: 61248
Project: 61248
Buggy source:
public void setPassword(boolean password){
  this.password=password ? 'T' : 'F';
}

Fixed version (ground truth):
public void setPassword(boolean password){
  this.password=getBooleanAsCharacter(password);
}
Program: 61249
Project: 61249
Buggy source:
public boolean isPassword(){
  return password != null && password == 'T';
}

Fixed version (ground truth):
public boolean isPassword(){
  return isBooleanAsCharacter(password);
}
Program: 61250
Project: 61250
Buggy source:
public SchemaMapping(){
  accountid='F';
  password='F';
  nullable='T';
}

Fixed version (ground truth):
public SchemaMapping(){
  super();
  accountid=getBooleanAsCharacter(false);
  password=getBooleanAsCharacter(false);
  nullable=getBooleanAsCharacter(true);
}
Program: 61251
Project: 61251
Buggy source:
public boolean isAccountid(){
  return accountid != null && accountid == 'T';
}

Fixed version (ground truth):
public boolean isAccountid(){
  return isBooleanAsCharacter(accountid);
}
Program: 61252
Project: 61252
Buggy source:
public void setNullable(boolean nullable){
  this.nullable=nullable ? 'T' : 'F';
}

Fixed version (ground truth):
public void setNullable(boolean nullable){
  this.nullable=getBooleanAsCharacter(nullable);
}
Program: 61253
Project: 61253
Buggy source:
public boolean isNullable(){
  return nullable != null && nullable == 'T';
}

Fixed version (ground truth):
public boolean isNullable(){
  return isBooleanAsCharacter(nullable);
}
Program: 61254
Project: 61254
Buggy source:
public void setAccountid(boolean accountid){
  this.accountid=accountid ? 'T' : 'F';
}

Fixed version (ground truth):
public void setAccountid(boolean accountid){
  this.accountid=getBooleanAsCharacter(accountid);
}
Program: 61255
Project: 61255
Buggy source:
public void setForceMandatoryConstraint(boolean forceMandatoryConstraint){
  this.forceMandatoryConstraint=forceMandatoryConstraint ? 'T' : 'F';
}

Fixed version (ground truth):
public void setForceMandatoryConstraint(boolean forceMandatoryConstraint){
  this.forceMandatoryConstraint=getBooleanAsCharacter(forceMandatoryConstraint);
}
Program: 61256
Project: 61256
Buggy source:
public TargetResource(){
  this.forceMandatoryConstraint='F';
}

Fixed version (ground truth):
public TargetResource(){
  this.forceMandatoryConstraint=getBooleanAsCharacter(false);
}
Program: 61257
Project: 61257
Buggy source:
public boolean isForceMandatoryConstraint(){
  return forceMandatoryConstraint != null && forceMandatoryConstraint == 'T';
}

Fixed version (ground truth):
public boolean isForceMandatoryConstraint(){
  return isBooleanAsCharacter(forceMandatoryConstraint);
}
Program: 61258
Project: 61258
Buggy source:
public boolean isInheritDerivedAttributes(){
  return inheritDerivedAttributes != null && inheritDerivedAttributes == 'T';
}

Fixed version (ground truth):
public boolean isInheritDerivedAttributes(){
  return isBooleanAsCharacter(inheritDerivedAttributes);
}
Program: 61259
Project: 61259
Buggy source:
public SyncopeRole(){
  memberships=new ArrayList<Membership>();
  entitlements=new HashSet<Entitlement>();
  attributes=new ArrayList<RoleAttribute>();
  derivedAttributes=new ArrayList<RoleDerivedAttribute>();
  inheritAttributes='F';
  inheritDerivedAttributes='F';
}

Fixed version (ground truth):
public SyncopeRole(){
  memberships=new ArrayList<Membership>();
  entitlements=new HashSet<Entitlement>();
  attributes=new ArrayList<RoleAttribute>();
  derivedAttributes=new ArrayList<RoleDerivedAttribute>();
  inheritAttributes=getBooleanAsCharacter(false);
  inheritDerivedAttributes=getBooleanAsCharacter(false);
}
Program: 61260
Project: 61260
Buggy source:
public boolean isInheritAttributes(){
  return inheritAttributes != null && inheritAttributes == 'T';
}

Fixed version (ground truth):
public boolean isInheritAttributes(){
  return isBooleanAsCharacter(inheritAttributes);
}
Program: 61261
Project: 61261
Buggy source:
public void setInheritDerivedAttributes(boolean inheritDerivedAttributes){
  this.inheritDerivedAttributes=inheritDerivedAttributes ? 'T' : 'F';
}

Fixed version (ground truth):
public void setInheritDerivedAttributes(boolean inheritDerivedAttributes){
  this.inheritDerivedAttributes=getBooleanAsCharacter(inheritDerivedAttributes);
}
Program: 61262
Project: 61262
Buggy source:
public void setInheritAttributes(boolean inheritAttributes){
  this.inheritAttributes=inheritAttributes ? 'T' : 'F';
}

Fixed version (ground truth):
public void setInheritAttributes(boolean inheritAttributes){
  this.inheritAttributes=getBooleanAsCharacter(inheritAttributes);
}
Program: 61263
Project: 61263
Buggy source:
public TargetResource getResource(TargetResource resource,ResourceTO resourceTO) throws SyncopeClientCompositeErrorException {
  SyncopeClientCompositeErrorException compositeErrorException=new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
  SyncopeClientException requiredValuesMissing=new SyncopeClientException(SyncopeClientExceptionType.RequiredValuesMissing);
  if (resourceTO == null)   return null;
  if (resourceTO.getName() == null) {
    requiredValuesMissing.addElement("String_Node_Str");
  }
  ConnectorInstance connector=null;
  if (resourceTO.getConnectorId() != null) {
    connector=connectorInstanceDAO.find(resourceTO.getConnectorId());
  }
  if (connector == null) {
    requiredValuesMissing.addElement("String_Node_Str");
  }
  if (!requiredValuesMissing.getElements().isEmpty()) {
    compositeErrorException.addException(requiredValuesMissing);
  }
  if (compositeErrorException.hasExceptions()) {
    throw compositeErrorException;
  }
  resource.setName(resourceTO.getName());
  resource.setMappings(getSchemaMappings(resource,resourceTO.getMappings()));
  resource.setConnector(connector);
  connector.addResource(resource);
  return resource;
}

Fixed version (ground truth):
public TargetResource getResource(TargetResource resource,ResourceTO resourceTO) throws SyncopeClientCompositeErrorException {
  SyncopeClientCompositeErrorException compositeErrorException=new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
  SyncopeClientException requiredValuesMissing=new SyncopeClientException(SyncopeClientExceptionType.RequiredValuesMissing);
  if (resourceTO == null)   return null;
  if (resourceTO.getName() == null) {
    requiredValuesMissing.addElement("String_Node_Str");
  }
  ConnectorInstance connector=null;
  if (resourceTO.getConnectorId() != null) {
    connector=connectorInstanceDAO.find(resourceTO.getConnectorId());
  }
  if (connector == null) {
    requiredValuesMissing.addElement("String_Node_Str");
  }
  if (!requiredValuesMissing.getElements().isEmpty()) {
    compositeErrorException.addException(requiredValuesMissing);
  }
  if (compositeErrorException.hasExceptions()) {
    throw compositeErrorException;
  }
  resource.setName(resourceTO.getName());
  resource.setMappings(getSchemaMappings(resource,resourceTO.getMappings()));
  resource.setConnector(connector);
  connector.addResource(resource);
  resource.setForceMandatoryConstraint(resourceTO.isForceMandatoryConstraint());
  return resource;
}
Program: 61264
Project: 61264
Buggy source:
public ResourceTO getResourceTO(TargetResource resource){
  if (resource == null)   return null;
  ResourceTO resourceTO=new ResourceTO();
  resourceTO.setName(resource.getName());
  ConnectorInstance connector=resource.getConnector();
  resourceTO.setConnectorId(connector != null ? connector.getId() : null);
  resourceTO.setMappings(getSchemaMappingTOs(resource.getMappings()));
  return resourceTO;
}

Fixed version (ground truth):
public ResourceTO getResourceTO(TargetResource resource){
  if (resource == null)   return null;
  ResourceTO resourceTO=new ResourceTO();
  resourceTO.setName(resource.getName());
  ConnectorInstance connector=resource.getConnector();
  resourceTO.setConnectorId(connector != null ? connector.getId() : null);
  resourceTO.setMappings(getSchemaMappingTOs(resource.getMappings()));
  resourceTO.setForceMandatoryConstraint(resource.isForceMandatoryConstraint());
  return resourceTO;
}
Program: 61265
Project: 61265
Buggy source:
private ConnectorObjectBuilder buildConnectorObject(Set<WSAttributeValue> attributes){
  ConnectorObjectBuilder bld=new ConnectorObjectBuilder();
  String uid=null;
  for (  WSAttributeValue attribute : attributes) {
    if (attribute.isKey()) {
      uid=attribute.getStringValue();
      bld.setName(uid);
    }
    if (!attribute.isKey() && !attribute.isPassword()) {
      if (attribute.getValue() == null) {
        bld.addAttribute(AttributeBuilder.build(attribute.getName()));
      }
 else {
        bld.addAttribute(AttributeBuilder.build(attribute.getName(),attribute.getValue()));
      }
    }
  }
  if (uid == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  bld.setUid(new Uid(uid));
  bld.setObjectClass(ObjectClass.ACCOUNT);
  return bld;
}

Fixed version (ground truth):
private ConnectorObjectBuilder buildConnectorObject(Set<WSAttributeValue> attributes){
  ConnectorObjectBuilder bld=new ConnectorObjectBuilder();
  String uid=null;
  for (  WSAttributeValue attribute : attributes) {
    if (attribute.isKey()) {
      uid=attribute.getStringValue();
      bld.setName(uid);
      bld.addAttribute(AttributeBuilder.build(attribute.getName(),attribute.getValue()));
    }
    if (!attribute.isKey() && !attribute.isPassword()) {
      if (attribute.getValue() == null) {
        bld.addAttribute(AttributeBuilder.build(attribute.getName()));
      }
 else {
        bld.addAttribute(AttributeBuilder.build(attribute.getName(),attribute.getValue()));
      }
    }
  }
  if (uid == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  bld.setUid(new Uid(uid));
  bld.setObjectClass(ObjectClass.ACCOUNT);
  return bld;
}
Program: 61266
Project: 61266
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void executeQuery(ObjectClass objClass,Operand query,ResultsHandler handler,OperationOptions options){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  if (objClass == null || (!objClass.equals(ObjectClass.ACCOUNT))) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (handler == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Provisioning provisioning=connection.getProvisioning();
  if (provisioning == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    List<WSUser> resultSet=provisioning.query(query);
    Iterator i=resultSet.iterator();
    WSUser user=null;
    boolean handle=true;
    while (i.hasNext() && handle) {
      user=(WSUser)i.next();
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + user.getAccountid());
      }
      handle=handler.handle(buildConnectorObject(user.getAttributes()).build());
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + handle);
      }
    }
  }
 catch (  Exception e) {
    throw new IllegalArgumentException(e);
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void executeQuery(ObjectClass objClass,Operand query,ResultsHandler handler,OperationOptions options){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  if (objClass == null || (!objClass.equals(ObjectClass.ACCOUNT))) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  if (handler == null) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  Provisioning provisioning=connection.getProvisioning();
  if (provisioning == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  try {
    List<WSUser> resultSet=provisioning.query(query);
    if (resultSet == null)     return;
    Iterator i=resultSet.iterator();
    WSUser user=null;
    boolean handle=true;
    while (i.hasNext() && handle) {
      user=(WSUser)i.next();
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + user.getAccountid());
      }
      handle=handler.handle(buildConnectorObject(user.getAttributes()).build());
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + handle);
      }
    }
  }
 catch (  Exception e) {
    throw new IllegalArgumentException(e);
  }
}
Program: 61267
Project: 61267
Buggy source:
/** 
 * Seraches for user accounts.
 */
@Test public void search(){
  final List<ConnectorObject> results=new ArrayList<ConnectorObject>();
  ResultsHandler resultsHandler=new ResultsHandler(){
    @Override public boolean handle(    ConnectorObject obj){
      results.add(obj);
      return true;
    }
  }
;
  Filter usernameFilter=FilterBuilder.startsWith(AttributeBuilder.build(Name.NAME,"String_Node_Str"));
  Filter nameFilter=FilterBuilder.equalTo(AttributeBuilder.build("String_Node_Str","String_Node_Str"));
  Filter surnameFilter=FilterBuilder.equalTo(AttributeBuilder.build("String_Node_Str","String_Node_Str"));
  Filter filter=FilterBuilder.or(usernameFilter,FilterBuilder.and(nameFilter,surnameFilter));
  connector.search(ObjectClass.ACCOUNT,filter,resultsHandler,null);
  assertFalse(results.isEmpty());
  if (log.isDebugEnabled()) {
    for (    ConnectorObject obj : results) {
      log.debug("String_Node_Str" + obj.getName() + "String_Node_Str"+ obj.getUid());
    }
  }
}

Fixed version (ground truth):
/** 
 * Seraches for user accounts.
 */
@Test public void search(){
  final List<ConnectorObject> results=new ArrayList<ConnectorObject>();
  ResultsHandler resultsHandler=new ResultsHandler(){
    @Override public boolean handle(    ConnectorObject obj){
      if (log.isDebugEnabled()) {
        log.debug("String_Node_Str" + obj);
      }
      results.add(obj);
      return true;
    }
  }
;
  Filter usernameFilter=FilterBuilder.startsWith(AttributeBuilder.build("String_Node_Str","String_Node_Str"));
  Filter nameFilter=FilterBuilder.equalTo(AttributeBuilder.build("String_Node_Str","String_Node_Str"));
  Filter surnameFilter=FilterBuilder.equalTo(AttributeBuilder.build("String_Node_Str","String_Node_Str"));
  Filter filter=FilterBuilder.or(usernameFilter,FilterBuilder.and(nameFilter,surnameFilter));
  connector.search(ObjectClass.ACCOUNT,filter,resultsHandler,null);
  assertFalse(results.isEmpty());
  if (log.isDebugEnabled()) {
    for (    ConnectorObject obj : results) {
      log.debug("String_Node_Str" + obj.getName() + "String_Node_Str"+ obj.getUid());
    }
  }
}
Program: 61268
Project: 61268
Buggy source:
@Override public boolean handle(ConnectorObject obj){
  results.add(obj);
  return true;
}

Fixed version (ground truth):
@Override public boolean handle(ConnectorObject obj){
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str" + obj);
  }
  results.add(obj);
  return true;
}
Program: 61269
Project: 61269
Buggy source:
@Override public String toString(){
  StringBuffer str=new StringBuffer();
  if (not)   str.append("String_Node_Str");
  if (logical && operands != null) {
    str.append("String_Node_Str" + this.op.toString());
    for (    Operand o : operands)     str.append(o.toString());
    str.append("String_Node_Str");
  }
 else   str.append("String_Node_Str" + getName() + "String_Node_Str"+ op.toString()+ "String_Node_Str"+ getValue().toString()+ "String_Node_Str");
  if (not)   str.append("String_Node_Str");
  return str.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  if (Operator.STARTS.equals(op)) {
    return (not ? "String_Node_Str" : "String_Node_Str") + getName() + "String_Node_Str"+ getValue()+ "String_Node_Str";
  }
  if (Operator.ENDS.equals(op)) {
    return (not ? "String_Node_Str" : "String_Node_Str") + getName() + "String_Node_Str"+ getValue()+ "String_Node_Str";
  }
  if (Operator.CONTAINS.equals(op)) {
    return (not ? "String_Node_Str" : "String_Node_Str") + getName() + "String_Node_Str"+ getValue()+ "String_Node_Str";
  }
  if (Operator.GT.equals(op)) {
    return (not ? "String_Node_Str" : "String_Node_Str") + getName() + "String_Node_Str"+ getValue()+ "String_Node_Str";
  }
  if (Operator.LT.equals(op)) {
    return (not ? "String_Node_Str" : "String_Node_Str") + getName() + "String_Node_Str"+ getValue()+ "String_Node_Str";
  }
  if (Operator.EQ.equals(op)) {
    return (not ? "String_Node_Str" : "String_Node_Str") + getName() + "String_Node_Str"+ getValue()+ "String_Node_Str";
  }
  if (operands == null)   return null;
  StringBuilder queryBuilder=new StringBuilder();
  for (  Operand operand : operands) {
    if (queryBuilder.length() > 0)     queryBuilder.append("String_Node_Str" + op.toString() + "String_Node_Str");
    queryBuilder.append(operand.toString());
  }
  if (not)   return "String_Node_Str" + queryBuilder + "String_Node_Str";
  if (operands.size() > 1)   return "String_Node_Str" + queryBuilder + "String_Node_Str";
  return queryBuilder.toString();
}
Program: 61270
Project: 61270
Buggy source:
@Override public final void contextInitialized(final ServletContextEvent sce){
  ConfigurableApplicationContext context=ApplicationContextManager.getApplicationContext();
  ConnectorInstanceDAO connectorInstanceDAO=(ConnectorInstanceDAO)context.getBean("String_Node_Str");
  List<ConnectorInstance> instances=connectorInstanceDAO.findAll();
  for (  ConnectorInstance instance : instances) {
    try {
      registerConnectorFacade(instance);
    }
 catch (    NotFoundException e) {
      LOG.error("String_Node_Str" + instance,e);
    }
  }
}

Fixed version (ground truth):
@Override public final void contextInitialized(final ServletContextEvent sce){
  ConfigurableApplicationContext context=ApplicationContextManager.getApplicationContext();
  ConnectorInstanceDAO connectorInstanceDAO=(ConnectorInstanceDAO)context.getBean("String_Node_Str");
  List<ConnectorInstance> instances=connectorInstanceDAO.findAll();
  for (  ConnectorInstance instance : instances) {
    try {
      registerConnector(instance);
    }
 catch (    NotFoundException e) {
      LOG.error("String_Node_Str" + instance,e);
    }
  }
}
Program: 61271
Project: 61271
Buggy source:
@Override public final ConnectorInstance save(final ConnectorInstance connector){
  ConnectorInstance actual=entityManager.merge(connector);
  try {
    ConnectorInstanceLoader.registerConnectorFacade(actual);
  }
 catch (  NotFoundException e) {
    LOG.error("String_Node_Str" + actual,e);
  }
  return actual;
}

Fixed version (ground truth):
@Override public final ConnectorInstance save(final ConnectorInstance connector){
  ConnectorInstance actual=entityManager.merge(connector);
  try {
    ConnectorInstanceLoader.registerConnector(actual);
  }
 catch (  NotFoundException e) {
    LOG.error("String_Node_Str" + actual,e);
  }
  return actual;
}
Program: 61272
Project: 61272
Buggy source:
@Override public final void delete(final Long id){
  entityManager.remove(find(id));
  ConnectorInstanceLoader.removeConnectorFacade(id.toString());
}

Fixed version (ground truth):
@Override public final void delete(final Long id){
  entityManager.remove(find(id));
  ConnectorInstanceLoader.removeConnector(id.toString());
}
Program: 61273
Project: 61273
Buggy source:
private List<Long> getAncestors(SyncopeRole role,List<Long> ancestors){
  ancestors.add(role.getId());
  if (role.getParent() != null && role.isInheritAttributes()) {
    return getAncestors(role.getParent(),ancestors);
  }
  return ancestors;
}

Fixed version (ground truth):
private List<Long> getAncestors(final SyncopeRole role,final List<Long> ancestors){
  ancestors.add(role.getId());
  if (role.getParent() != null && role.isInheritAttributes()) {
    return getAncestors(role.getParent(),ancestors);
  }
  return ancestors;
}
Program: 61274
Project: 61274
Buggy source:
@Override @Transactional(readOnly=true) public List<RoleAttribute> findInheritedAttributes(SyncopeRole role){
  if (role.getParent() == null) {
    return Collections.EMPTY_LIST;
  }
  List<Long> ancestors=getAncestors(role.getParent(),new ArrayList<Long>());
  if (ancestors == null || ancestors.isEmpty()) {
    return Collections.EMPTY_LIST;
  }
  StringBuilder queryExp=new StringBuilder();
  queryExp.append("String_Node_Str" + "String_Node_Str");
  queryExp.append(ancestors.get(0));
  if (ancestors.size() > 1) {
    for (int i=1; i < ancestors.size(); i++) {
      queryExp.append("String_Node_Str");
      queryExp.append(ancestors.get(i));
      queryExp.append("String_Node_Str");
    }
  }
  queryExp.append("String_Node_Str");
  Query query=entityManager.createQuery(queryExp.toString());
  return query.getResultList();
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true) public List<RoleAttribute> findInheritedAttributes(final SyncopeRole role){
  if (role.getParent() == null) {
    return Collections.EMPTY_LIST;
  }
  List<Long> ancestors=getAncestors(role.getParent(),new ArrayList<Long>());
  if (ancestors == null || ancestors.isEmpty()) {
    return Collections.EMPTY_LIST;
  }
  StringBuilder queryExp=new StringBuilder();
  queryExp.append("String_Node_Str" + "String_Node_Str");
  queryExp.append(ancestors.get(0));
  if (ancestors.size() > 1) {
    for (int i=1; i < ancestors.size(); i++) {
      queryExp.append("String_Node_Str");
      queryExp.append(ancestors.get(i));
      queryExp.append("String_Node_Str");
    }
  }
  queryExp.append("String_Node_Str");
  Query query=entityManager.createQuery(queryExp.toString());
  return query.getResultList();
}
Program: 61275
Project: 61275
Buggy source:
@Override @Transactional(readOnly=true) public List<RoleDerivedAttribute> findInheritedDerivedAttributes(SyncopeRole role){
  if (role.getParent() == null) {
    return Collections.EMPTY_LIST;
  }
  List<Long> ancestors=getAncestors(role.getParent(),new ArrayList<Long>());
  if (ancestors == null || ancestors.isEmpty()) {
    return Collections.EMPTY_LIST;
  }
  StringBuilder queryExp=new StringBuilder();
  queryExp.append("String_Node_Str" + "String_Node_Str");
  queryExp.append(ancestors.get(0));
  if (ancestors.size() > 1) {
    for (int i=1; i < ancestors.size(); i++) {
      queryExp.append("String_Node_Str");
      queryExp.append(ancestors.get(i));
      queryExp.append("String_Node_Str");
    }
  }
  queryExp.append("String_Node_Str");
  Query query=entityManager.createQuery(queryExp.toString());
  return query.getResultList();
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true) public List<RoleDerivedAttribute> findInheritedDerivedAttributes(final SyncopeRole role){
  if (role.getParent() == null) {
    return Collections.EMPTY_LIST;
  }
  List<Long> ancestors=getAncestors(role.getParent(),new ArrayList<Long>());
  if (ancestors == null || ancestors.isEmpty()) {
    return Collections.EMPTY_LIST;
  }
  StringBuilder queryExp=new StringBuilder();
  queryExp.append("String_Node_Str" + "String_Node_Str");
  queryExp.append(ancestors.get(0));
  if (ancestors.size() > 1) {
    for (int i=1; i < ancestors.size(); i++) {
      queryExp.append("String_Node_Str");
      queryExp.append(ancestors.get(i));
      queryExp.append("String_Node_Str");
    }
  }
  queryExp.append("String_Node_Str");
  Query query=entityManager.createQuery(queryExp.toString());
  return query.getResultList();
}
Program: 61276
Project: 61276
Buggy source:
@Override @Transactional(readOnly=true) public SyncopeRole find(Long id){
  return entityManager.find(SyncopeRole.class,id);
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true) public SyncopeRole find(final Long id){
  return entityManager.find(SyncopeRole.class,id);
}
Program: 61277
Project: 61277
Buggy source:
@Override public SyncopeRole save(SyncopeRole syncopeRole){
  return entityManager.merge(syncopeRole);
}

Fixed version (ground truth):
@Override public SyncopeRole save(final SyncopeRole syncopeRole){
  return entityManager.merge(syncopeRole);
}
Program: 61278
Project: 61278
Buggy source:
@Override @Transactional(readOnly=true) public List<SyncopeRole> findChildren(Long roleId){
  Query query=entityManager.createQuery("String_Node_Str" + "String_Node_Str");
  query.setParameter("String_Node_Str",roleId);
  return query.getResultList();
}

Fixed version (ground truth):
@Override @Transactional(readOnly=true) public List<SyncopeRole> findChildren(final Long roleId){
  Query query=entityManager.createQuery("String_Node_Str" + "String_Node_Str");
  query.setParameter("String_Node_Str",roleId);
  return query.getResultList();
}
Program: 61279
Project: 61279
Buggy source:
@Override public void delete(Long id){
  SyncopeRole role=find(id);
  if (id == null) {
    return;
  }
  Query query=entityManager.createQuery("String_Node_Str" + "String_Node_Str");
  query.setParameter("String_Node_Str",id);
  List<SyncopeRole> childrenRoles=query.getResultList();
  for (  SyncopeRole child : childrenRoles) {
    delete(child.getId());
  }
  for (  Membership membership : role.getMemberships()) {
    membership.setSyncopeRole(null);
    membership.getSyncopeUser().removeMembership(membership);
    membership.setSyncopeRole(null);
    entityManager.remove(membership);
  }
  role.setMemberships(Collections.EMPTY_LIST);
  for (  Entitlement entitlement : role.getEntitlements()) {
    entitlement.removeRole(role);
  }
  role.setEntitlements(Collections.EMPTY_SET);
  role.setParent(null);
  entityManager.remove(role);
}

Fixed version (ground truth):
@Override public void delete(final Long id){
  SyncopeRole role=find(id);
  if (id == null) {
    return;
  }
  Query query=entityManager.createQuery("String_Node_Str" + "String_Node_Str");
  query.setParameter("String_Node_Str",id);
  List<SyncopeRole> childrenRoles=query.getResultList();
  for (  SyncopeRole child : childrenRoles) {
    delete(child.getId());
  }
  for (  Membership membership : role.getMemberships()) {
    membership.setSyncopeRole(null);
    membership.getSyncopeUser().removeMembership(membership);
    membership.setSyncopeRole(null);
    entityManager.remove(membership);
  }
  role.setMemberships(Collections.EMPTY_LIST);
  for (  Entitlement entitlement : role.getEntitlements()) {
    entitlement.removeRole(role);
  }
  role.setEntitlements(Collections.EMPTY_SET);
  role.setParent(null);
  entityManager.remove(role);
}
Program: 61281
Project: 61281
Buggy source:
public TargetResource getResource(TargetResource resource,ResourceTO resourceTO) throws SyncopeClientCompositeErrorException {
  SyncopeClientCompositeErrorException compositeErrorException=new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
  SyncopeClientException requiredValuesMissing=new SyncopeClientException(SyncopeClientExceptionType.RequiredValuesMissing);
  if (resourceTO == null)   return null;
  if (resourceTO.getName() == null) {
    requiredValuesMissing.addElement("String_Node_Str");
  }
  ConnectorInstance connector=null;
  if (resourceTO.getConnectorId() != null) {
    connector=connectorInstanceDAO.find(resourceTO.getConnectorId());
  }
  if (connector == null) {
    requiredValuesMissing.addElement("String_Node_Str");
  }
  if (!requiredValuesMissing.getElements().isEmpty()) {
    compositeErrorException.addException(requiredValuesMissing);
  }
  if (compositeErrorException.hasExceptions()) {
    throw compositeErrorException;
  }
  resource.setName(resourceTO.getName());
  resource.setMappings(getSchemaMappings(resource,resourceTO.getMappings()));
  resource.setConnector(connector);
  connector.addResource(resource);
  resource.setForceMandatoryConstraint(resourceTO.isForceMandatoryConstraint());
  return resource;
}

Fixed version (ground truth):
public TargetResource getResource(TargetResource resource,ResourceTO resourceTO) throws SyncopeClientCompositeErrorException {
  SyncopeClientCompositeErrorException compositeErrorException=new SyncopeClientCompositeErrorException(HttpStatus.BAD_REQUEST);
  SyncopeClientException requiredValuesMissing=new SyncopeClientException(SyncopeClientExceptionType.RequiredValuesMissing);
  if (resourceTO == null)   return null;
  if (resourceTO.getName() == null) {
    requiredValuesMissing.addElement("String_Node_Str");
  }
  ConnectorInstance connector=null;
  if (resourceTO.getConnectorId() != null) {
    connector=connectorInstanceDAO.find(resourceTO.getConnectorId());
  }
  if (connector == null) {
    requiredValuesMissing.addElement("String_Node_Str");
  }
  if (!requiredValuesMissing.getElements().isEmpty()) {
    compositeErrorException.addException(requiredValuesMissing);
  }
  if (compositeErrorException.hasExceptions()) {
    throw compositeErrorException;
  }
  resource.setName(resourceTO.getName());
  resource.setConnector(connector);
  connector.addResource(resource);
  resource.setForceMandatoryConstraint(resourceTO.isForceMandatoryConstraint());
  resource.setMappings(getSchemaMappings(resource,resourceTO.getMappings()));
  return resource;
}
Program: 61282
Project: 61282
Buggy source:
@Override public void delete(String name){
  Resource resource=find(name);
  Set<SchemaMapping> mappings=resource.getMappings();
  if (mappings != null) {
    for (    SchemaMapping mapping : mappings) {
      mapping.setResource(null);
      schemaMappingDAO.delete(mapping.getId());
    }
  }
  resource.setMappings(null);
  Set<SyncopeUser> users=resource.getUsers();
  if (users != null && !users.isEmpty()) {
    for (    SyncopeUser user : users) {
      user.removeResource(resource);
    }
  }
  resource.setUsers(null);
  Set<SyncopeRole> roles=resource.getRoles();
  if (roles != null && !roles.isEmpty()) {
    for (    SyncopeRole role : roles) {
      role.removeResource(resource);
    }
  }
  resource.setRoles(null);
  ConnectorInstance connector=resource.getConnector();
  Set<Resource> resources=null;
  if (connector != null) {
    resources=connector.getResources();
  }
  if (resources != null && !resources.isEmpty()) {
    resources.remove(resource);
  }
  resource.setConnector(null);
  entityManager.remove(resource);
}

Fixed version (ground truth):
@Override public void delete(String name){
  Resource resource=find(name);
  if (resource == null)   return;
  Set<SchemaMapping> mappings=resource.getMappings();
  if (mappings != null) {
    for (    SchemaMapping mapping : mappings) {
      mapping.setResource(null);
      schemaMappingDAO.delete(mapping.getId());
    }
  }
  resource.setMappings(null);
  Set<SyncopeUser> users=resource.getUsers();
  if (users != null && !users.isEmpty()) {
    for (    SyncopeUser user : users) {
      user.removeResource(resource);
    }
  }
  resource.setUsers(null);
  Set<SyncopeRole> roles=resource.getRoles();
  if (roles != null && !roles.isEmpty()) {
    for (    SyncopeRole role : roles) {
      role.removeResource(resource);
    }
  }
  resource.setRoles(null);
  ConnectorInstance connector=resource.getConnector();
  Set<Resource> resources=null;
  if (connector != null) {
    resources=connector.getResources();
  }
  if (resources != null && !resources.isEmpty()) {
    resources.remove(resource);
  }
  resource.setConnector(null);
  entityManager.remove(resource);
}
Program: 61283
Project: 61283
Buggy source:
@RequestMapping(method=RequestMethod.POST,value="String_Node_Str") public UserTO verifyToken(@RequestBody UserTO userTO) throws WorkflowException, NotFoundException {
  return userDataBinder.getUserTO(doExecuteAction(Constants.ACTION_VERIFY_TOKEN,userTO,Collections.singletonMap(Constants.TOKEN,(Object)userTO.getToken())));
}

Fixed version (ground truth):
@RequestMapping(method=RequestMethod.POST,value="String_Node_Str") public UserTO verifyToken(@RequestBody UserTO userTO) throws WorkflowException, NotFoundException {
  return userDataBinder.getUserTO(doExecuteAction(Constants.ACTION_VERIFY_TOKEN,userTO,Collections.singletonMap(Constants.TOKEN,(Object)userTO.getToken())),userWorkflow);
}