Program: 74102
Project: 74102
Buggy source:
private int _refreshTable(TransformationEditor topLevelFrame,TransformationRule transformer,int index,CompositeEntity container){
  try {
    Replacement replacement=transformer.getReplacement();
    Pattern pattern=transformer.getPattern();
    container.workspace().getReadAccess();
    Collection<?> objectCollection=new CombinedCollection<Object>(new Collection<?>[]{container.entityList(),container.relationList()});
    for (    Object entityObject : objectCollection) {
      NamedObj object=(NamedObj)entityObject;
      PatternObjectAttribute attribute=GTTools.getPatternObjectAttribute(object);
      if (attribute != null) {
        attribute.addValueListener(this);
        String patternObject=attribute.getExpression();
        if (!patternObject.equals("String_Node_Str")) {
          String patternObjectName=attribute.getExpression();
          if (patternObjectName.equals("String_Node_Str")) {
            continue;
          }
          boolean found=false;
          if (object instanceof Entity) {
            found=pattern.getEntity(patternObjectName) != null;
          }
 else           if (object instanceof Relation) {
            found=pattern.getRelation(patternObjectName) != null;
          }
          if (!found) {
            String moml="String_Node_Str" + attribute.getName() + "String_Node_Str";
            MoMLChangeRequest request=new MoMLChangeRequest(this,object,moml);
            request.setUndoable(true);
            request.setMergeWithPreviousUndo(true);
            object.requestChange(request);
            continue;
          }
          String name=_getNameWithinContainer(object,replacement);
          topLevelFrame._tableModel.addRow(new Object[]{_createCellPanel(Integer.toString(index++)),_createCellPanel(patternObject),_createCellPanel(name)});
        }
      }
      if (object instanceof CompositeEntity) {
        index=_refreshTable(topLevelFrame,transformer,index,(CompositeEntity)object);
      }
    }
  }
  finally {
    container.workspace().doneReading();
  }
  return index;
}

Fixed version (ground truth):
private int _refreshTable(TransformationEditor topLevelFrame,TransformationRule transformer,int index,CompositeEntity container){
  try {
    Replacement replacement=transformer.getReplacement();
    Pattern pattern=transformer.getPattern();
    container.workspace().getReadAccess();
    Collection<?> objectCollection=new CombinedCollection<Object>(new Collection<?>[]{container.entityList(),container.relationList()});
    for (    Object entityObject : objectCollection) {
      NamedObj object=(NamedObj)entityObject;
      PatternObjectAttribute attribute;
      try {
        attribute=GTTools.getPatternObjectAttribute(object,false);
      }
 catch (      KernelException e) {
        throw new KernelRuntimeException(e,"String_Node_Str" + "String_Node_Str");
      }
      if (attribute != null) {
        attribute.addValueListener(this);
        String patternObject=attribute.getExpression();
        if (!patternObject.equals("String_Node_Str")) {
          String patternObjectName=attribute.getExpression();
          if (patternObjectName.equals("String_Node_Str")) {
            continue;
          }
          boolean found=false;
          if (object instanceof Entity) {
            found=pattern.getEntity(patternObjectName) != null;
          }
 else           if (object instanceof Relation) {
            found=pattern.getRelation(patternObjectName) != null;
          }
          if (!found) {
            String moml="String_Node_Str" + attribute.getName() + "String_Node_Str";
            MoMLChangeRequest request=new MoMLChangeRequest(this,object,moml);
            request.setUndoable(true);
            request.setMergeWithPreviousUndo(true);
            object.requestChange(request);
            continue;
          }
          String name=_getNameWithinContainer(object,replacement);
          topLevelFrame._tableModel.addRow(new Object[]{_createCellPanel(Integer.toString(index++)),_createCellPanel(patternObject),_createCellPanel(name)});
        }
      }
      if (object instanceof CompositeEntity) {
        index=_refreshTable(topLevelFrame,transformer,index,(CompositeEntity)object);
      }
    }
  }
  finally {
    container.workspace().doneReading();
  }
  return index;
}