nus-yam/ex-repair huggingface dataset:
Program: 171147
Project: 171147
Buggy source:
private void mapMapCollectionToVertex(Id id,ITypedInstance typedInstance,Vertex instanceVertex,AttributeInfo attributeInfo,Map<Id,Vertex> idToVertexMap) throws MetadataException {
  LOG.debug("String_Node_Str",typedInstance.getTypeName(),instanceVertex,attributeInfo.name);
  @SuppressWarnings("String_Node_Str") Map<Object,Object> collection=(Map<Object,Object>)typedInstance.get(attributeInfo.name);
  if (collection == null) {
    return;
  }
  String propertyName=typedInstance.getTypeName() + "String_Node_Str" + attributeInfo.name;
  GraphHelper.createPropertyKey(titanGraph.getManagementSystem(),propertyName);
  StringBuilder buffer=new StringBuilder();
  IDataType elementType=((DataTypes.MapType)attributeInfo.dataType()).getValueType();
  for (  Map.Entry entry : collection.entrySet()) {
    String propertyNameWithSuffix=propertyName + "String_Node_Str" + entry.getKey();
    buffer.append(propertyNameWithSuffix).append("String_Node_Str");
    mapCollectionEntryToVertex(id,instanceVertex,attributeInfo,idToVertexMap,elementType,entry.getValue(),propertyNameWithSuffix);
  }
  buffer.setLength(buffer.length() - 1);
  instanceVertex.setProperty(propertyName,buffer.toString());
}

Fixed version (ground truth):
private void mapMapCollectionToVertex(Id id,ITypedInstance typedInstance,Vertex instanceVertex,AttributeInfo attributeInfo,Map<Id,Vertex> idToVertexMap) throws MetadataException {
  LOG.debug("String_Node_Str",typedInstance.getTypeName(),instanceVertex,attributeInfo.name);
  @SuppressWarnings("String_Node_Str") Map<Object,Object> collection=(Map<Object,Object>)typedInstance.get(attributeInfo.name);
  if (collection == null || collection.isEmpty()) {
    return;
  }
  String propertyName=typedInstance.getTypeName() + "String_Node_Str" + attributeInfo.name;
  GraphHelper.createPropertyKey(titanGraph.getManagementSystem(),propertyName);
  StringBuilder buffer=new StringBuilder();
  IDataType elementType=((DataTypes.MapType)attributeInfo.dataType()).getValueType();
  for (  Map.Entry entry : collection.entrySet()) {
    String propertyNameWithSuffix=propertyName + "String_Node_Str" + entry.getKey();
    buffer.append(propertyNameWithSuffix).append("String_Node_Str");
    mapCollectionEntryToVertex(id,instanceVertex,attributeInfo,idToVertexMap,elementType,entry.getValue(),propertyNameWithSuffix);
  }
  buffer.setLength(buffer.length() - 1);
  instanceVertex.setProperty(propertyName,buffer.toString());
}
Program: 171148
Project: 171148
Buggy source:
private void mapArrayCollectionToVertex(Id id,ITypedInstance typedInstance,Vertex instanceVertex,AttributeInfo attributeInfo,Map<Id,Vertex> idToVertexMap) throws MetadataException {
  LOG.debug("String_Node_Str",typedInstance.getTypeName(),instanceVertex,attributeInfo.name);
  List list=(List)typedInstance.get(attributeInfo.name);
  if (list == null) {
    return;
  }
  String propertyName=typedInstance.getTypeName() + "String_Node_Str" + attributeInfo.name;
  GraphHelper.createPropertyKey(titanGraph.getManagementSystem(),propertyName);
  IDataType elementType=((DataTypes.ArrayType)attributeInfo.dataType()).getElemType();
  StringBuilder buffer=new StringBuilder();
  Object[] array=list.toArray();
  for (int index=0; index < array.length; index++) {
    String propertyNameWithSuffix=propertyName + "String_Node_Str" + index;
    buffer.append(propertyNameWithSuffix).append("String_Node_Str");
    mapCollectionEntryToVertex(id,instanceVertex,attributeInfo,idToVertexMap,elementType,array[index],propertyNameWithSuffix);
  }
  buffer.setLength(buffer.length() - 1);
  instanceVertex.setProperty(propertyName,buffer.toString());
}

Fixed version (ground truth):
private void mapArrayCollectionToVertex(Id id,ITypedInstance typedInstance,Vertex instanceVertex,AttributeInfo attributeInfo,Map<Id,Vertex> idToVertexMap) throws MetadataException {
  LOG.debug("String_Node_Str",typedInstance.getTypeName(),instanceVertex,attributeInfo.name);
  List list=(List)typedInstance.get(attributeInfo.name);
  if (list == null || list.isEmpty()) {
    return;
  }
  String propertyName=typedInstance.getTypeName() + "String_Node_Str" + attributeInfo.name;
  GraphHelper.createPropertyKey(titanGraph.getManagementSystem(),propertyName);
  IDataType elementType=((DataTypes.ArrayType)attributeInfo.dataType()).getElemType();
  StringBuilder buffer=new StringBuilder();
  Object[] array=list.toArray();
  for (int index=0; index < array.length; index++) {
    String propertyNameWithSuffix=propertyName + "String_Node_Str" + index;
    buffer.append(propertyNameWithSuffix).append("String_Node_Str");
    mapCollectionEntryToVertex(id,instanceVertex,attributeInfo,idToVertexMap,elementType,array[index],propertyNameWithSuffix);
  }
  buffer.setLength(buffer.length() - 1);
  instanceVertex.setProperty(propertyName,buffer.toString());
}
Program: 171149
Project: 171149
Buggy source:
@BeforeClass public void setUp() throws Exception {
  titanGraphService.start();
  repositoryService.start();
  ts=TypeSystem.getInstance();
  repo=new MemRepository(ts);
  defineDeptEmployeeTypes(ts);
}

Fixed version (ground truth):
@BeforeClass public void setUp() throws Exception {
  titanGraphService.start();
  repositoryService.start();
  ts=TypeSystem.getInstance();
  defineDeptEmployeeTypes(ts);
}
Program: 171150
Project: 171150
Buggy source:
@Override public void ensureCapacity(int pos) throws RepositoryException {
  for (  Map.Entry<AttributeInfo,IAttributeStore> e : attrStores.entrySet()) {
    IAttributeStore attributeStore=e.getValue();
    attributeStore.ensureCapacity(pos);
  }
  nullList.ensureCapacity(pos);
}

Fixed version (ground truth):
@Override public void ensureCapacity(int pos) throws RepositoryException {
  for (  Map.Entry<AttributeInfo,IAttributeStore> e : attrStores.entrySet()) {
    IAttributeStore attributeStore=e.getValue();
    attributeStore.ensureCapacity(pos);
  }
  nullList.size(pos + 1);
}
Program: 171151
Project: 171151
Buggy source:
public Id(String className){
  this(-System.currentTimeMillis(),0,className);
}

Fixed version (ground truth):
public Id(String className){
  this(-System.nanoTime(),0,className);
}
Program: 171152
Project: 171152
Buggy source:
@Override public void processNode(ObjectGraphWalker.Node nd) throws MetadataException {
  IReferenceableInstance ref=null;
  Id id=null;
  if (nd.attributeName == null) {
    ref=(IReferenceableInstance)nd.instance;
    Id newId=idToNewIdMap.get(ref.getId());
    if (newId != null) {
      ((ReferenceableInstance)ref).replaceWithNewId(newId);
    }
  }
 else   if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
    if (nd.value != null && nd.value instanceof IReferenceableInstance) {
      Id oldId=((IReferenceableInstance)nd.value).getId();
      Id newId=idToNewIdMap.get(ref.getId());
      newId=newId == null ? oldId : newId;
      nd.instance.set(nd.attributeName,newId);
    }
  }
 else   if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
    DataTypes.ArrayType aT=(DataTypes.ArrayType)nd.aInfo.dataType();
    Object v=aT.mapIds((ImmutableCollection)nd.value,nd.aInfo.multiplicity,idToNewIdMap);
    nd.instance.set(nd.attributeName,v);
  }
 else   if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
    DataTypes.MapType mT=(DataTypes.MapType)nd.aInfo.dataType();
    Object v=mT.mapIds((ImmutableMap)nd.value,nd.aInfo.multiplicity,idToNewIdMap);
    nd.instance.set(nd.attributeName,v);
  }
}

Fixed version (ground truth):
@Override public void processNode(ObjectGraphWalker.Node nd) throws MetadataException {
  IReferenceableInstance ref=null;
  Id id=null;
  if (nd.attributeName == null) {
    ref=(IReferenceableInstance)nd.instance;
    Id newId=idToNewIdMap.get(ref.getId());
    if (newId != null) {
      ((ReferenceableInstance)ref).replaceWithNewId(newId);
    }
  }
 else   if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
    if (nd.value != null && nd.value instanceof IReferenceableInstance) {
      Id oldId=((IReferenceableInstance)nd.value).getId();
      Id newId=idToNewIdMap.get(oldId);
      newId=newId == null ? oldId : newId;
      nd.instance.set(nd.attributeName,newId);
    }
  }
 else   if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.ARRAY) {
    DataTypes.ArrayType aT=(DataTypes.ArrayType)nd.aInfo.dataType();
    Object v=aT.mapIds((ImmutableCollection)nd.value,nd.aInfo.multiplicity,idToNewIdMap);
    nd.instance.set(nd.attributeName,v);
  }
 else   if (nd.aInfo.dataType().getTypeCategory() == DataTypes.TypeCategory.MAP) {
    DataTypes.MapType mT=(DataTypes.MapType)nd.aInfo.dataType();
    Object v=mT.mapIds((ImmutableMap)nd.value,nd.aInfo.multiplicity,idToNewIdMap);
    nd.instance.set(nd.attributeName,v);
  }
}
Program: 171154
Project: 171154
Buggy source:
@Override public void ensureCapacity(int pos) throws RepositoryException {
  list.ensureCapacity(pos);
  nullList.ensureCapacity(pos);
}

Fixed version (ground truth):
@Override public void ensureCapacity(int pos) throws RepositoryException {
  while (list.size() < pos + 1) {
    list.add((T)null);
  }
  nullList.size(pos + 1);
}
Program: 171155
Project: 171155
Buggy source:
HierarchicalTypeStore(MemRepository repository,HierarchicalType hierarchicalType) throws RepositoryException {
  this.hierarchicalType=(IConstructableType)hierarchicalType;
  this.repository=repository;
  ImmutableMap.Builder<AttributeInfo,IAttributeStore> b=new ImmutableBiMap.Builder<AttributeInfo,IAttributeStore>();
  typeNameList=Lists.newArrayList((String)null);
  ImmutableList<AttributeInfo> l=hierarchicalType.immediateAttrs;
  for (  AttributeInfo i : l) {
    b.put(i,AttributeStores.createStore(i));
  }
  attrStores=b.build();
  ImmutableList.Builder<HierarchicalTypeStore> b1=new ImmutableList.Builder<HierarchicalTypeStore>();
  Set<String> allSuperTypeNames=hierarchicalType.getAllSuperTypeNames();
  for (  String s : allSuperTypeNames) {
    b1.add(repository.getStore(s));
  }
  superTypeStores=b1.build();
  nextPos=0;
}

Fixed version (ground truth):
HierarchicalTypeStore(MemRepository repository,HierarchicalType hierarchicalType) throws RepositoryException {
  this.hierarchicalType=(IConstructableType)hierarchicalType;
  this.repository=repository;
  ImmutableMap.Builder<AttributeInfo,IAttributeStore> b=new ImmutableBiMap.Builder<AttributeInfo,IAttributeStore>();
  typeNameList=Lists.newArrayList((String)null);
  ImmutableList<AttributeInfo> l=hierarchicalType.immediateAttrs;
  for (  AttributeInfo i : l) {
    b.put(i,AttributeStores.createStore(i));
  }
  attrStores=b.build();
  ImmutableList.Builder<HierarchicalTypeStore> b1=new ImmutableList.Builder<HierarchicalTypeStore>();
  Set<String> allSuperTypeNames=hierarchicalType.getAllSuperTypeNames();
  for (  String s : allSuperTypeNames) {
    b1.add(repository.getStore(s));
  }
  superTypeStores=b1.build();
  nextPos=0;
  idPosMap=new HashMap<Id,Integer>();
  freePositions=new ArrayList<Integer>();
  lock=new ReentrantReadWriteLock();
}
Program: 171156
Project: 171156
Buggy source:
void releaseWriteLock(){
  lock.readLock().unlock();
}

Fixed version (ground truth):
void releaseWriteLock(){
  lock.writeLock().unlock();
}
Program: 171157
Project: 171157
Buggy source:
public void ensureCapacity(int pos) throws RepositoryException {
  typeNameList.ensureCapacity(pos);
  for (  Map.Entry<AttributeInfo,IAttributeStore> e : attrStores.entrySet()) {
    IAttributeStore attributeStore=e.getValue();
    attributeStore.ensureCapacity(pos);
  }
}

Fixed version (ground truth):
public void ensureCapacity(int pos) throws RepositoryException {
  while (typeNameList.size() < pos + 1) {
    typeNameList.add(null);
  }
  for (  Map.Entry<AttributeInfo,IAttributeStore> e : attrStores.entrySet()) {
    IAttributeStore attributeStore=e.getValue();
    attributeStore.ensureCapacity(pos);
  }
}
Program: 171159
Project: 171159
Buggy source:
public ObjectGraphWalker(TypeSystem typeSystem,NodeProcessor nodeProcessor,List<? extends IReferenceableInstance> roots) throws MetadataException {
  this.typeSystem=typeSystem;
  this.nodeProcessor=nodeProcessor;
  queue=new LinkedList<IReferenceableInstance>();
  processedIds=new HashSet<Id>();
  queue.addAll(roots);
}

Fixed version (ground truth):
public ObjectGraphWalker(TypeSystem typeSystem,NodeProcessor nodeProcessor,List<? extends IReferenceableInstance> roots) throws MetadataException {
  this.typeSystem=typeSystem;
  this.nodeProcessor=nodeProcessor;
  queue=new LinkedList<IReferenceableInstance>();
  processedIds=new HashSet<Id>();
  for (  IReferenceableInstance r : roots) {
    visitReferenceableInstance(r);
  }
}
Program: 171160
Project: 171160
Buggy source:
void visitReferenceableInstance(Object val) throws MetadataException {
  if (val == null || !(val instanceof IReferenceableInstance)) {
    return;
  }
  IReferenceableInstance ref=(IReferenceableInstance)val;
  if (!processedIds.contains(ref.getId())) {
    queue.add(ref);
  }
}

Fixed version (ground truth):
void visitReferenceableInstance(Object val) throws MetadataException {
  if (val == null || !(val instanceof IReferenceableInstance)) {
    return;
  }
  IReferenceableInstance ref=(IReferenceableInstance)val;
  if (!processedIds.contains(ref.getId())) {
    processedIds.add(ref.getId());
    if (!(ref instanceof Id)) {
      queue.add(ref);
    }
  }
}
Program: 171161
Project: 171161
Buggy source:
@Test public void test1() throws MetadataException {
  TypeSystem ts=ms.getTypeSystem();
  defineDeptEmployeeTypes(ts);
  Referenceable hrDept=createDeptEg1(ts);
}

Fixed version (ground truth):
@Test public void test1() throws MetadataException {
  TypeSystem ts=ms.getTypeSystem();
  defineDeptEmployeeTypes(ts);
  Referenceable hrDept=createDeptEg1(ts);
  ITypedReferenceableInstance hrDept2=ms.getRepository().create(hrDept);
}
Program: 171162
Project: 171162
Buggy source:
@Override public String toString(){
  try {
    StringBuilder buf=new StringBuilder();
    String prefix="String_Node_Str";
    TypeUtils.outputVal("String_Node_Str",buf,prefix);
    TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
    String fieldPrefix=prefix + "String_Node_Str";
    for (    Map.Entry<String,AttributeInfo> e : fieldMapping.fields.entrySet()) {
      String attrName=e.getKey();
      AttributeInfo i=e.getValue();
      Object aVal=get(attrName);
      TypeUtils.outputVal(attrName + "String_Node_Str",buf,fieldPrefix);
      i.dataType().output(aVal,buf,"String_Node_Str");
      TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
    }
    TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
    return buf.toString();
  }
 catch (  MetadataException me) {
    throw new RuntimeException(me);
  }
}

Fixed version (ground truth):
@Override public String toString(){
  try {
    StringBuilder buf=new StringBuilder();
    String prefix="String_Node_Str";
    fieldMapping.output(this,buf,prefix);
    return buf.toString();
  }
 catch (  MetadataException me) {
    throw new RuntimeException(me);
  }
}
Program: 171163
Project: 171163
Buggy source:
@Override public void output(IReferenceableInstance s,Appendable buf,String prefix) throws MetadataException {
  TypeUtils.outputVal("String_Node_Str",buf,prefix);
  if (s == null) {
    TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
    return;
  }
  TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
  String fieldPrefix=prefix + "String_Node_Str";
  TypeUtils.outputVal("String_Node_Str",buf,fieldPrefix);
  TypeUtils.outputVal(s.getId().toString(),buf,"String_Node_Str");
  TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
  for (  AttributeInfo i : fieldMapping.fields.values()) {
    Object aVal=s.get(i.name);
    TypeUtils.outputVal(i.name + "String_Node_Str",buf,fieldPrefix);
    i.dataType().output(aVal,buf,"String_Node_Str");
    TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
  }
  for (  String sT : s.getTraits()) {
    TraitType tt=typeSystem.getDataType(TraitType.class,sT);
    TypeUtils.outputVal(sT + "String_Node_Str",buf,fieldPrefix);
    tt.output(s.getTrait(sT),buf,fieldPrefix);
  }
  TypeUtils.outputVal("String_Node_Str",buf,fieldPrefix);
}

Fixed version (ground truth):
@Override public void output(IReferenceableInstance s,Appendable buf,String prefix) throws MetadataException {
  fieldMapping.output(s,buf,prefix);
}
Program: 171164
Project: 171164
Buggy source:
@Override public ITypedReferenceableInstance convert(Object val,Multiplicity m) throws MetadataException {
  if (val != null) {
    if (val instanceof Struct) {
      Struct s=(Struct)val;
      Referenceable r=null;
      if (s.typeName != getName()) {
        throw new ValueConversionException(this,val);
      }
      if (val instanceof Referenceable) {
        r=(Referenceable)val;
      }
      ITypedReferenceableInstance tr=r != null ? createInstanceWithTraits(r,r.getTraits().toArray(new String[0])) : createInstance();
      for (      Map.Entry<String,AttributeInfo> e : fieldMapping.fields.entrySet()) {
        String attrKey=e.getKey();
        AttributeInfo i=e.getValue();
        Object aVal=s.get(attrKey);
        try {
          tr.set(attrKey,aVal);
        }
 catch (        ValueConversionException ve) {
          throw new ValueConversionException(this,val,ve);
        }
      }
      return tr;
    }
 else     if (val instanceof ReferenceableInstance) {
      validateId(((ReferenceableInstance)val).getId());
      return (ReferenceableInstance)val;
    }
 else {
      throw new ValueConversionException(this,val);
    }
  }
  if (!m.nullAllowed()) {
    throw new ValueConversionException.NullConversionException(m);
  }
  return null;
}

Fixed version (ground truth):
@Override public ITypedReferenceableInstance convert(Object val,Multiplicity m) throws MetadataException {
  if (val != null) {
    if (val instanceof Struct) {
      Struct s=(Struct)val;
      Referenceable r=null;
      if (s.typeName != getName()) {
        ClassType valType=typeSystem.getDataType(superTypeClass,s.typeName);
        if (valType.superTypePaths.containsKey(name)) {
          return valType.convert(s,m);
        }
        throw new ValueConversionException(this,val);
      }
      if (val instanceof Referenceable) {
        r=(Referenceable)val;
      }
      ITypedReferenceableInstance tr=r != null ? createInstanceWithTraits(r,r.getTraits().toArray(new String[0])) : createInstance();
      for (      Map.Entry<String,AttributeInfo> e : fieldMapping.fields.entrySet()) {
        String attrKey=e.getKey();
        AttributeInfo i=e.getValue();
        Object aVal=s.get(attrKey);
        if (aVal != null && i.dataType().getTypeCategory() == DataTypes.TypeCategory.CLASS) {
          if (!i.isComposite) {
            aVal=((IReferenceableInstance)aVal).getId();
          }
        }
        try {
          tr.set(attrKey,aVal);
        }
 catch (        ValueConversionException ve) {
          throw new ValueConversionException(this,val,ve);
        }
      }
      return tr;
    }
 else     if (val instanceof ReferenceableInstance) {
      validateId(((ReferenceableInstance)val).getId());
      return (ReferenceableInstance)val;
    }
 else {
      throw new ValueConversionException(this,val);
    }
  }
  if (!m.nullAllowed()) {
    throw new ValueConversionException.NullConversionException(m);
  }
  return null;
}
Program: 171166
Project: 171166
Buggy source:
public void output(IStruct s,Appendable buf,String prefix) throws MetadataException {
  TypeUtils.outputVal("String_Node_Str",buf,prefix);
  if (s == null) {
    TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
    return;
  }
  TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
  String fieldPrefix=prefix + "String_Node_Str";
  for (  AttributeInfo i : fieldMapping.fields.values()) {
    Object aVal=s.get(i.name);
    TypeUtils.outputVal(i.name + "String_Node_Str",buf,fieldPrefix);
    i.dataType().output(aVal,buf,"String_Node_Str");
    TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
  }
  TypeUtils.outputVal("String_Node_Str",buf,"String_Node_Str");
}

Fixed version (ground truth):
public void output(IStruct s,Appendable buf,String prefix) throws MetadataException {
  fieldMapping.output(s,buf,prefix);
}
Program: 171167
Project: 171167
Buggy source:
@Test public void test1() throws MetadataException {
  TypeSystem ts=ms.getTypeSystem();
}

Fixed version (ground truth):
@Test public void test1() throws MetadataException {
  TypeSystem ts=ms.getTypeSystem();
  HierarchicalTypeDefinition<ClassType> deptTypeDef=createClassTypeDef("String_Node_Str",ImmutableList.<String>of(),createRequiredAttrDef("String_Node_Str",DataTypes.STRING_TYPE),new AttributeDefinition("String_Node_Str",String.format("String_Node_Str","String_Node_Str"),Multiplicity.COLLECTION,true,"String_Node_Str"));
  HierarchicalTypeDefinition<ClassType> personTypeDef=createClassTypeDef("String_Node_Str",ImmutableList.<String>of(),createRequiredAttrDef("String_Node_Str",DataTypes.STRING_TYPE),new AttributeDefinition("String_Node_Str","String_Node_Str",Multiplicity.REQUIRED,false,"String_Node_Str"),new AttributeDefinition("String_Node_Str","String_Node_Str",Multiplicity.OPTIONAL,false,"String_Node_Str"));
  HierarchicalTypeDefinition<ClassType> managerTypeDef=createClassTypeDef("String_Node_Str",ImmutableList.<String>of("String_Node_Str"),new AttributeDefinition("String_Node_Str",String.format("String_Node_Str","String_Node_Str"),Multiplicity.COLLECTION,false,"String_Node_Str"));
  HierarchicalTypeDefinition<TraitType> securityClearanceTypeDef=createTraitTypeDef("String_Node_Str",ImmutableList.<String>of(),createRequiredAttrDef("String_Node_Str",DataTypes.INT_TYPE));
  ts.defineTypes(ImmutableList.<StructTypeDefinition>of(),ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(securityClearanceTypeDef),ImmutableList.<HierarchicalTypeDefinition<ClassType>>of(deptTypeDef,personTypeDef,managerTypeDef));
  Referenceable hrDept=new Referenceable("String_Node_Str");
  Referenceable john=new Referenceable("String_Node_Str");
  Referenceable jane=new Referenceable("String_Node_Str","String_Node_Str");
  hrDept.set("String_Node_Str","String_Node_Str");
  john.set("String_Node_Str","String_Node_Str");
  john.set("String_Node_Str",hrDept);
  jane.set("String_Node_Str","String_Node_Str");
  jane.set("String_Node_Str",hrDept);
  john.set("String_Node_Str",jane);
  hrDept.set("String_Node_Str",ImmutableList.<Referenceable>of(john,jane));
  jane.set("String_Node_Str",ImmutableList.<Referenceable>of(john));
  jane.getTrait("String_Node_Str").set("String_Node_Str",1);
  ClassType deptType=ts.getDataType(ClassType.class,"String_Node_Str");
  ITypedReferenceableInstance hrDept2=deptType.convert(hrDept,Multiplicity.REQUIRED);
  Assert.assertEquals(hrDept2.toString(),"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
}
Program: 171168
Project: 171168
Buggy source:
private void setWaveTable(AudioOutput outMix){
  tableX=Waves.randomNHarms(0);
  waveX=new Oscil(freq.x,amp.x,tableX);
  tableX.setWaveform(shapeX);
  waveX.patch(panX).patch(outMix);
  tableY=Waves.randomNHarms(0);
  waveY=new Oscil(freq.y,amp.y,tableY);
  tableY.setWaveform(shapeY);
  waveY.patch(panY).patch(outMix);
  waveX.reset();
  waveY.reset();
  if (zaxis) {
    tableZ=Waves.randomNHarms(0);
    waveZ=new Oscil(freq.z,amp.z,tableZ);
    tableZ.setWaveform(shapeZ);
    waveZ.patch(outZ);
    waveZ.reset();
  }
}

Fixed version (ground truth):
private void setWaveTable(AudioOutput outMix){
  tableX=Waves.randomNHarms(0);
  waveX=new Oscil(freq.x,amp.x,tableX);
  tableX.setWaveform(shapeX);
  waveX.patch(panX).patch(outMix);
  tableY=Waves.randomNHarms(0);
  waveY=new Oscil(freq.y,amp.y,tableY);
  tableY.setWaveform(shapeY);
  waveY.patch(panY).patch(outMix);
  mixXY=outMix;
  waveX.reset();
  waveY.reset();
  if (zaxis) {
    tableZ=Waves.randomNHarms(0);
    waveZ=new Oscil(freq.z,amp.z,tableZ);
    tableZ.setWaveform(shapeZ);
    waveZ.patch(outZ);
    waveZ.reset();
  }
}
Program: 171169
Project: 171169
Buggy source:
/** 
 * Simulate X-Y mode of oscilloscope output.
 */
public void drawXY(){
  myParent.pushStyle();
  myParent.noFill();
  myParent.stroke(50,255,50);
  myParent.pushMatrix();
  myParent.translate(myParent.width / 2,myParent.height / 2);
  myParent.beginShape();
  for (int i=0; i < outXY.bufferSize() - 1; i++) {
    float lAudio=outXY.left.get(i) * audioWaveAmp;
    float rAudio=outXY.right.get(i) * audioWaveAmp;
    myParent.curveVertex(lAudio,rAudio * -1f);
  }
  myParent.endShape();
  myParent.popMatrix();
  myParent.popStyle();
}

Fixed version (ground truth):
/** 
 * Simulate X-Y mode of oscilloscope output.
 */
public void drawXY(){
  myParent.pushStyle();
  myParent.noFill();
  myParent.stroke(50,255,50);
  myParent.pushMatrix();
  myParent.translate(myParent.width / 2,myParent.height / 2);
  myParent.beginShape();
  AudioOutput tempXY;
  if (useMix) {
    tempXY=mixXY;
  }
 else {
    tempXY=outXY;
  }
  for (int i=0; i < tempXY.bufferSize() - 1; i++) {
    float lAudio=tempXY.left.get(i) * audioWaveAmp;
    float rAudio=tempXY.right.get(i) * audioWaveAmp;
    myParent.curveVertex(lAudio,rAudio * -1f);
  }
  myParent.endShape();
  myParent.popMatrix();
  myParent.popStyle();
}
Program: 171170
Project: 171170
Buggy source:
/** 
 * Draw wave of all XYZ oscillators.
 */
public void drawWave(){
  myParent.pushStyle();
  myParent.stroke(255);
  myParent.noFill();
  myParent.pushMatrix();
  myParent.beginShape();
  for (int i=0; i < outXY.bufferSize() - 1; i++) {
    float xAudio=myParent.map(i,0,outXY.bufferSize(),0,myParent.width);
    float lAudio=outXY.left.get(i);
    myParent.vertex(xAudio,myParent.height * .25f - (myParent.height * .25f) * lAudio);
  }
  myParent.endShape();
  myParent.beginShape();
  for (int i=0; i < outXY.bufferSize() - 1; i++) {
    float xAudio=myParent.map(i,0,outXY.bufferSize(),0,myParent.width);
    float rAudio=outXY.right.get(i);
    myParent.vertex(xAudio,myParent.height * .75f + (myParent.height * .25f) * rAudio);
  }
  myParent.endShape();
  if (zaxis) {
    myParent.beginShape();
    for (int i=0; i < outZ.bufferSize() - 1; i++) {
      float xAudio=myParent.map(i,0,outZ.bufferSize(),0,myParent.width);
      float rAudio=outZ.right.get(i);
      myParent.vertex(xAudio,myParent.height * .5f - (myParent.height * .25f) * rAudio);
    }
    myParent.endShape();
  }
  myParent.popMatrix();
  myParent.popStyle();
}

Fixed version (ground truth):
/** 
 * Draw wave of all XYZ oscillators.
 */
public void drawWave(){
  myParent.pushStyle();
  myParent.stroke(255);
  myParent.noFill();
  myParent.pushMatrix();
  myParent.beginShape();
  AudioOutput tempXY;
  if (useMix) {
    tempXY=mixXY;
  }
 else {
    tempXY=outXY;
  }
  for (int i=0; i < tempXY.bufferSize() - 1; i++) {
    float xAudio=myParent.map(i,0,tempXY.bufferSize(),0,myParent.width);
    float lAudio=tempXY.left.get(i);
    myParent.vertex(xAudio,myParent.height * .25f - (myParent.height * .25f) * lAudio);
  }
  myParent.endShape();
  myParent.beginShape();
  for (int i=0; i < tempXY.bufferSize() - 1; i++) {
    float xAudio=myParent.map(i,0,tempXY.bufferSize(),0,myParent.width);
    float rAudio=tempXY.right.get(i);
    myParent.vertex(xAudio,myParent.height * .75f + (myParent.height * .25f) * rAudio);
  }
  myParent.endShape();
  if (zaxis) {
    myParent.beginShape();
    for (int i=0; i < outZ.bufferSize() - 1; i++) {
      float xAudio=myParent.map(i,0,outZ.bufferSize(),0,myParent.width);
      float rAudio=outZ.right.get(i);
      myParent.vertex(xAudio,myParent.height * .5f - (myParent.height * .25f) * rAudio);
    }
    myParent.endShape();
  }
  myParent.popMatrix();
  myParent.popStyle();
}
Program: 171171
Project: 171171
Buggy source:
@Override public void beforeAll(final ExtensionContext context){
  start();
}

Fixed version (ground truth):
@Override public void beforeAll(final ExtensionContext context){
  startOnlySingleInstance();
}
Program: 171172
Project: 171172
Buggy source:
@Override public void afterAll(final ExtensionContext context){
  stop();
}

Fixed version (ground truth):
@Override public void afterAll(final ExtensionContext context){
  stopWhenLastConsumerFinished();
}
Program: 171173
Project: 171173
Buggy source:
public void onRequestPermissionsResult(int requestCode,String[] permissions,int[] grantResults){
  if (requestCode == PERMISSION_REQUEST_CODE) {
    for (    String permission : permissions) {
      if (isPermissionNotGranted(permission)) {
        if (isNeedAskPermission()) {
          if (isNewerAskAgain(permission)) {
            newerAskAgainListener.onNewerAskAgain();
          }
 else {
            failureListener.onFailure();
          }
          return;
        }
      }
    }
  }
  successListener.onSuccess();
}

Fixed version (ground truth):
public void onRequestPermissionsResult(int requestCode,String[] permissions,int[] grantResults){
  if (requestCode == PERMISSION_REQUEST_CODE) {
    for (    String permission : permissions) {
      if (isNeedToAskPermissions()) {
        if (isPermissionNotGranted(permission)) {
          if (isNewerAskAgain(permission)) {
            newerAskAgainListener.onNewerAskAgain();
          }
 else {
            failureListener.onFailure();
          }
          return;
        }
      }
    }
  }
  successListener.onSuccess();
}
Program: 171174
Project: 171174
Buggy source:
public PermissionHelper(Activity activity){
  permissions=new String[1];
  this.activity=activity;
}

Fixed version (ground truth):
public PermissionHelper(Activity activity){
  this.activity=activity;
}
Program: 171175
Project: 171175
Buggy source:
public void run(){
  if (isNeedAskPermission()) {
    if (successListener != null && failureListener != null && newerAskAgainListener != null) {
      activity.requestPermissions(permissions,PERMISSION_REQUEST_CODE);
    }
 else     throw new RuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void run(){
  if (isListenersCorrect()) {
    if (isNeedToAskPermissions()) {
      checkPermissions();
    }
 else {
      successListener.onSuccess();
    }
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 171177
Project: 171177
Buggy source:
/** 
 * Default constructor called from Layouts
 * @param context : Context
 * @param attrs : Attributes Array
 */
public MaterialFancyButton(Context context,AttributeSet attrs){
  super(context,attrs);
  TypedArray attrsArray=context.obtainStyledAttributes(attrs,R.styleable.MaterialFancyButtonAttrs,0,0);
  initAttributesArray(attrsArray);
  initializeMaterialFancyButton();
  attrsArray.recycle();
  applyStyle(context,attrs,0,0);
}

Fixed version (ground truth):
/** 
 * Default constructor called from Layouts
 * @param context : Context
 * @param attrs : Attributes Array
 */
public MaterialFancyButton(Context context,AttributeSet attrs){
  super(context,attrs);
  TypedArray attrsArray=context.obtainStyledAttributes(attrs,R.styleable.MaterialFancyButtonAttrs,0,0);
  initAttributesArray(attrsArray);
  attrsArray.recycle();
  initializeMaterialFancyButton();
}
Program: 171178
Project: 171178
Buggy source:
public void setIcon(IIcon icon){
  ITypeface typeface=icon.getTypeface();
  mIconTypeFace=typeface.getTypeface(getContext().getApplicationContext());
  setIconResource(String.valueOf(icon.getCharacter()));
}

Fixed version (ground truth):
public void setIcon(IIcon icon){
  ITypeface typeface=icon.getTypeface();
  Log.d(TAG,"String_Node_Str" + icon.getTypeface().getAuthor());
  mIconTypeFace=typeface.getTypeface(getContext().getApplicationContext());
  setIconResource(String.valueOf(icon.getCharacter()));
}
Program: 171179
Project: 171179
Buggy source:
/** 
 * Initialize Button dependencies - Initialize Button Container : The LinearLayout - Initialize Button TextView - Initialize Button Icon - Initialize Button Font Icon
 */
private void initializeMaterialFancyButton(){
  initializeButtonContainer();
  mTextView=setupTextView();
  mIconView=setupIconView();
  mFontIconView=setupFontIconView();
  if (mIcon != null) {
    setIcon(mIcon);
  }
  this.removeAllViews();
  setupBackground();
  List<View> views=new ArrayList<>();
  if (mIconPosition == POSITION_LEFT || mIconPosition == POSITION_TOP) {
    if (mIconView != null) {
      views.add(mIconView);
    }
    if (mFontIconView != null) {
      views.add(mFontIconView);
    }
    if (mTextView != null) {
      views.add(mTextView);
    }
  }
 else {
    if (mTextView != null) {
      views.add(mTextView);
    }
    if (mIconView != null) {
      views.add(mIconView);
    }
    if (mFontIconView != null) {
      views.add(mFontIconView);
    }
  }
  for (  View view : views) {
    this.addView(view);
  }
}

Fixed version (ground truth):
/** 
 * Initialize Button dependencies - Initialize Button Container : The LinearLayout - Initialize Button TextView - Initialize Button Icon - Initialize Button Font Icon
 */
private void initializeMaterialFancyButton(){
  initializeButtonContainer();
  mTextView=setupTextView();
  mIconView=setupIconView();
  mFontIconView=setupFontIconView();
  if (mIcon != null) {
    Log.d(TAG,"String_Node_Str" + mIcon);
    setIcon(mIcon);
  }
  this.removeAllViews();
  setupBackground();
  List<View> views=new ArrayList<>();
  if (mIconPosition == POSITION_LEFT || mIconPosition == POSITION_TOP) {
    if (mIconView != null) {
      views.add(mIconView);
    }
    if (mFontIconView != null) {
      views.add(mFontIconView);
    }
    if (mTextView != null) {
      views.add(mTextView);
    }
  }
 else {
    if (mTextView != null) {
      views.add(mTextView);
    }
    if (mIconView != null) {
      views.add(mIconView);
    }
    if (mFontIconView != null) {
      views.add(mFontIconView);
    }
  }
  for (  View view : views) {
    this.addView(view);
  }
}
Program: 171182
Project: 171182
Buggy source:
/** 
 * Setup Text View
 * @return : TextView
 */
private TextView setupTextView(){
  if (mText != null) {
    TextView textView=new TextView(mContext);
    textView.setText(mText);
    textView.setGravity(mDefaultTextGravity);
    textView.setTextColor(mDefaultTextColor);
    textView.setTextSize(mDefaultTextSize);
    textView.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,1f));
    if (!isInEditMode() && mTextTypeFace != null) {
      textView.setTypeface(mTextTypeFace);
    }
    return textView;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Setup Text View
 * @return : TextView
 */
private TextView setupTextView(){
  if (mText != null) {
    TextView textView=new TextView(mContext);
    textView.setText(mText);
    textView.setGravity(mDefaultTextGravity);
    textView.setTextColor(mDefaultTextColor);
    textView.setTextSize(mDefaultTextSize);
    textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
    if (!isInEditMode() && mTextTypeFace != null) {
      textView.setTypeface(mTextTypeFace);
    }
    return textView;
  }
  return null;
}
Program: 171183
Project: 171183
Buggy source:
/** 
 * Initialize button container
 */
private void initializeButtonContainer(){
  if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
    this.setOrientation(LinearLayout.VERTICAL);
  }
 else {
    this.setOrientation(LinearLayout.HORIZONTAL);
  }
  LayoutParams containerParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  this.setLayoutParams(containerParams);
  this.setGravity(Gravity.CENTER_VERTICAL);
  this.setClickable(true);
  this.setFocusable(true);
  if (mIconResource == null && mFontIcon == null && getPaddingLeft() == 0 && getPaddingRight() == 0 && getPaddingTop() == 0 && getPaddingBottom() == 0) {
    this.setPadding(20,20,20,20);
  }
}

Fixed version (ground truth):
/** 
 * Initialize button container
 */
private void initializeButtonContainer(){
  if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
    this.setOrientation(LinearLayout.VERTICAL);
  }
 else {
    this.setOrientation(LinearLayout.HORIZONTAL);
  }
  LayoutParams containerParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  this.setLayoutParams(containerParams);
  this.setGravity(Gravity.CENTER);
  this.setClickable(true);
  this.setFocusable(true);
  if (mIconResource == null && mFontIcon == null && getPaddingLeft() == 0 && getPaddingRight() == 0 && getPaddingTop() == 0 && getPaddingBottom() == 0) {
    this.setPadding(20,20,20,20);
  }
}
Program: 171184
Project: 171184
Buggy source:
/** 
 * Setup Font Icon View
 * @return : TextView
 */
private TextView setupFontIconView(){
  if (mFontIcon != null) {
    TextView fontIconView=new TextView(mContext);
    fontIconView.setTextColor(mDefaultIconColor);
    LayoutParams iconTextViewParams=new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,1f);
    iconTextViewParams.rightMargin=mIconPaddingRight;
    iconTextViewParams.leftMargin=mIconPaddingLeft;
    iconTextViewParams.topMargin=mIconPaddingTop;
    iconTextViewParams.bottomMargin=mIconPaddingBottom;
    if (mTextView != null) {
      if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
        iconTextViewParams.gravity=Gravity.CENTER;
        fontIconView.setGravity(Gravity.CENTER);
      }
 else {
        fontIconView.setGravity(Gravity.CENTER_VERTICAL);
        iconTextViewParams.gravity=Gravity.CENTER_VERTICAL;
      }
    }
 else {
      iconTextViewParams.gravity=Gravity.CENTER;
      fontIconView.setGravity(Gravity.CENTER_VERTICAL);
    }
    fontIconView.setLayoutParams(iconTextViewParams);
    if (!isInEditMode()) {
      fontIconView.setTextSize(mFontIconSize);
      fontIconView.setText(mFontIcon);
      fontIconView.setTypeface(mIconTypeFace);
    }
 else {
      fontIconView.setText("String_Node_Str");
    }
    return fontIconView;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Setup Font Icon View
 * @return : TextView
 */
private TextView setupFontIconView(){
  if (mFontIcon != null) {
    TextView fontIconView=new TextView(mContext);
    fontIconView.setTextColor(mDefaultIconColor);
    LayoutParams iconTextViewParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    iconTextViewParams.rightMargin=mIconPaddingRight;
    iconTextViewParams.leftMargin=mIconPaddingLeft;
    iconTextViewParams.topMargin=mIconPaddingTop;
    iconTextViewParams.bottomMargin=mIconPaddingBottom;
    if (mTextView != null) {
      if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
        iconTextViewParams.gravity=Gravity.CENTER;
        fontIconView.setGravity(Gravity.CENTER);
      }
 else {
        fontIconView.setGravity(Gravity.CENTER_VERTICAL);
        iconTextViewParams.gravity=Gravity.CENTER_VERTICAL;
      }
    }
 else {
      iconTextViewParams.gravity=Gravity.CENTER;
      fontIconView.setGravity(Gravity.CENTER_VERTICAL);
    }
    fontIconView.setLayoutParams(iconTextViewParams);
    if (!isInEditMode()) {
      fontIconView.setTextSize(mFontIconSize);
      fontIconView.setText(mFontIcon);
      fontIconView.setTypeface(mIconTypeFace);
    }
 else {
      fontIconView.setText("String_Node_Str");
    }
    return fontIconView;
  }
  return null;
}
Program: 171185
Project: 171185
Buggy source:
/** 
 * Setup Text View
 * @return : TextView
 */
private TextView setupTextView(){
  if (mText != null) {
    TextView textView=new TextView(mContext);
    textView.setText(mText);
    textView.setGravity(mDefaultTextGravity);
    textView.setTextColor(mDefaultTextColor);
    textView.setTextSize(mDefaultTextSize);
    textView.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,1f));
    if (!isInEditMode() && mTextTypeFace != null) {
      textView.setTypeface(mTextTypeFace);
    }
    return textView;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Setup Text View
 * @return : TextView
 */
private TextView setupTextView(){
  if (mText != null) {
    TextView textView=new TextView(mContext);
    textView.setText(mText);
    textView.setGravity(mDefaultTextGravity);
    textView.setTextColor(mDefaultTextColor);
    textView.setTextSize(mDefaultTextSize);
    textView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
    if (!isInEditMode() && mTextTypeFace != null) {
      textView.setTypeface(mTextTypeFace);
    }
    return textView;
  }
  return null;
}
Program: 171186
Project: 171186
Buggy source:
/** 
 * Initialize button container
 */
private void initializeButtonContainer(){
  if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
    this.setOrientation(LinearLayout.VERTICAL);
  }
 else {
    this.setOrientation(LinearLayout.HORIZONTAL);
  }
  LayoutParams containerParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  this.setLayoutParams(containerParams);
  this.setGravity(Gravity.CENTER_VERTICAL);
  this.setClickable(true);
  this.setFocusable(true);
  if (mIconResource == null && mFontIcon == null && getPaddingLeft() == 0 && getPaddingRight() == 0 && getPaddingTop() == 0 && getPaddingBottom() == 0) {
    this.setPadding(20,20,20,20);
  }
}

Fixed version (ground truth):
/** 
 * Initialize button container
 */
private void initializeButtonContainer(){
  if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
    this.setOrientation(LinearLayout.VERTICAL);
  }
 else {
    this.setOrientation(LinearLayout.HORIZONTAL);
  }
  LayoutParams containerParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
  this.setLayoutParams(containerParams);
  this.setGravity(Gravity.CENTER);
  this.setClickable(true);
  this.setFocusable(true);
  if (mIconResource == null && mFontIcon == null && getPaddingLeft() == 0 && getPaddingRight() == 0 && getPaddingTop() == 0 && getPaddingBottom() == 0) {
    this.setPadding(20,20,20,20);
  }
}
Program: 171187
Project: 171187
Buggy source:
/** 
 * Setup Font Icon View
 * @return : TextView
 */
private TextView setupFontIconView(){
  if (mFontIcon != null) {
    TextView fontIconView=new TextView(mContext);
    fontIconView.setTextColor(mDefaultIconColor);
    LayoutParams iconTextViewParams=new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT,1f);
    iconTextViewParams.rightMargin=mIconPaddingRight;
    iconTextViewParams.leftMargin=mIconPaddingLeft;
    iconTextViewParams.topMargin=mIconPaddingTop;
    iconTextViewParams.bottomMargin=mIconPaddingBottom;
    if (mTextView != null) {
      if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
        iconTextViewParams.gravity=Gravity.CENTER;
        fontIconView.setGravity(Gravity.CENTER);
      }
 else {
        fontIconView.setGravity(Gravity.CENTER_VERTICAL);
        iconTextViewParams.gravity=Gravity.CENTER_VERTICAL;
      }
    }
 else {
      iconTextViewParams.gravity=Gravity.CENTER;
      fontIconView.setGravity(Gravity.CENTER_VERTICAL);
    }
    fontIconView.setLayoutParams(iconTextViewParams);
    if (!isInEditMode()) {
      fontIconView.setTextSize(mFontIconSize);
      fontIconView.setText(mFontIcon);
      fontIconView.setTypeface(mIconTypeFace);
    }
 else {
      fontIconView.setText("String_Node_Str");
    }
    return fontIconView;
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Setup Font Icon View
 * @return : TextView
 */
private TextView setupFontIconView(){
  if (mFontIcon != null) {
    TextView fontIconView=new TextView(mContext);
    fontIconView.setTextColor(mDefaultIconColor);
    LayoutParams iconTextViewParams=new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
    iconTextViewParams.rightMargin=mIconPaddingRight;
    iconTextViewParams.leftMargin=mIconPaddingLeft;
    iconTextViewParams.topMargin=mIconPaddingTop;
    iconTextViewParams.bottomMargin=mIconPaddingBottom;
    if (mTextView != null) {
      if (mIconPosition == POSITION_TOP || mIconPosition == POSITION_BOTTOM) {
        iconTextViewParams.gravity=Gravity.CENTER;
        fontIconView.setGravity(Gravity.CENTER);
      }
 else {
        fontIconView.setGravity(Gravity.CENTER_VERTICAL);
        iconTextViewParams.gravity=Gravity.CENTER_VERTICAL;
      }
    }
 else {
      iconTextViewParams.gravity=Gravity.CENTER;
      fontIconView.setGravity(Gravity.CENTER_VERTICAL);
    }
    fontIconView.setLayoutParams(iconTextViewParams);
    if (!isInEditMode()) {
      fontIconView.setTextSize(mFontIconSize);
      fontIconView.setText(mFontIcon);
      fontIconView.setTypeface(mIconTypeFace);
    }
 else {
      fontIconView.setText("String_Node_Str");
    }
    return fontIconView;
  }
  return null;
}
Program: 171188
Project: 171188
Buggy source:
private void initGraphics(){
  if (Double.compare(getPrefWidth(),0.0) <= 0 || Double.compare(getPrefHeight(),0.0) <= 0 || Double.compare(getWidth(),0.0) <= 0 || Double.compare(getHeight(),0.0) <= 0) {
    if (getPrefWidth() > 0 && getPrefHeight() > 0) {
      setPrefSize(getPrefWidth(),getPrefHeight());
    }
 else {
      setPrefSize(PREFERRED_WIDTH,PREFERRED_HEIGHT);
    }
  }
  axisCanvas=new Canvas(PREFERRED_WIDTH,PREFERRED_HEIGHT);
  axisCtx=axisCanvas.getGraphicsContext2D();
  Color selectionRectColor=getSelectionRectColor();
  rect=new Rectangle();
  rect.setMouseTransparent(true);
  rect.setVisible(false);
  rect.setStroke(Helper.getColorWithOpacity(selectionRectColor,0.5));
  rect.setFill(Helper.getColorWithOpacity(selectionRectColor,0.25));
  connectionCanvas=new Canvas(PREFERRED_WIDTH,PREFERRED_HEIGHT);
  connectionCanvas.setMouseTransparent(true);
  connectionCtx=connectionCanvas.getGraphicsContext2D();
  dragText=new Text("String_Node_Str");
  dragText.setTextOrigin(VPos.CENTER);
  dragText.setFill(Helper.getColorWithOpacity(getHeaderColor(),0.5));
  getChildren().setAll(axisCanvas,rect,connectionCanvas,dragText);
}

Fixed version (ground truth):
private void initGraphics(){
  if (Double.compare(getPrefWidth(),0.0) <= 0 || Double.compare(getPrefHeight(),0.0) <= 0 || Double.compare(getWidth(),0.0) <= 0 || Double.compare(getHeight(),0.0) <= 0) {
    if (getPrefWidth() > 0 && getPrefHeight() > 0) {
      setPrefSize(getPrefWidth(),getPrefHeight());
    }
 else {
      setPrefSize(PREFERRED_WIDTH,PREFERRED_HEIGHT);
    }
  }
  axisCanvas=new Canvas(PREFERRED_WIDTH,PREFERRED_HEIGHT);
  axisCtx=axisCanvas.getGraphicsContext2D();
  Color selectionRectColor=getSelectionRectColor();
  rect=new Rectangle();
  rect.setMouseTransparent(true);
  rect.setVisible(false);
  rect.setStroke(Helper.getColorWithOpacity(selectionRectColor,0.5));
  rect.setFill(Helper.getColorWithOpacity(selectionRectColor,0.25));
  connectionCanvas=new Canvas(PREFERRED_WIDTH,PREFERRED_HEIGHT);
  connectionCanvas.setMouseTransparent(true);
  connectionCtx=connectionCanvas.getGraphicsContext2D();
  dragText=new Text("String_Node_Str");
  dragText.setVisible(false);
  dragText.setTextOrigin(VPos.CENTER);
  dragText.setFill(Helper.getColorWithOpacity(getHeaderColor(),0.5));
  getChildren().setAll(axisCanvas,rect,connectionCanvas,dragText);
}