Program: 175979
Project: 175979
Buggy source:
public final void process(final Class<?> clazz,EntityMetadata metadata){
  if (clazz != null) {
    metadata.setIndexName(clazz.getSimpleName());
  }
  Index idx=clazz.getAnnotation(Index.class);
  IndexCollection indexes=clazz.getAnnotation(IndexCollection.class);
  EntityType entityType=(EntityType)kunderaMetadata.getApplicationMetadata().getMetaModelBuilder(metadata.getPersistenceUnit()).getManagedTypes().get(clazz);
  List<String> columnsNameToBeIndexed=new ArrayList<String>();
  Map<String,com.impetus.kundera.index.Index> indexedColumnsMap=new HashMap<String,com.impetus.kundera.index.Index>();
  if (null != indexes) {
    if (indexes.columns() != null && indexes.columns().length != 0) {
      metadata.setIndexable(true);
      for (      com.impetus.kundera.index.Index indexedColumn : indexes.columns()) {
        if (indexedColumn.type().equals("String_Node_Str")) {
          metadata.addIndexProperty(prepareCompositeIndexName(indexedColumn.name(),entityType),populatePropertyIndex(indexedColumn.indexName(),indexedColumn.type(),null,null,null));
        }
 else {
          indexedColumnsMap.put(indexedColumn.name(),indexedColumn);
        }
      }
    }
  }
 else   if (null != idx) {
    boolean isIndexable=idx.index();
    if (isIndexable) {
      metadata.setIndexable(isIndexable);
      String indexName=idx.name();
      if (indexName != null && !indexName.isEmpty()) {
        metadata.setIndexName(indexName);
      }
      if (idx.columns() != null && idx.columns().length != 0) {
        for (        String indexedColumn : idx.columns()) {
          columnsNameToBeIndexed.add(indexedColumn);
        }
      }
    }
  }
 else {
    log.debug("String_Node_Str" + clazz.getName() + "String_Node_Str"+ (indexedColumnsMap.isEmpty() ? "String_Node_Str" : indexedColumnsMap));
    return;
  }
  log.debug("String_Node_Str" + clazz.getName() + "String_Node_Str");
  Set<Attribute> attributes=entityType.getAttributes();
  for (  Attribute attrib : attributes) {
    if (!attrib.isAssociation()) {
      String colName=attrib.getName();
      String columnName=((AbstractAttribute)attrib).getJPAColumnName();
      if (indexedColumnsMap != null && !indexedColumnsMap.isEmpty() && indexedColumnsMap.containsKey(colName)) {
        com.impetus.kundera.index.Index indexedColumn=indexedColumnsMap.get(colName);
        String indexName=StringUtils.isBlank(indexedColumn.indexName()) ? columnName : indexedColumn.indexName();
        metadata.addIndexProperty(columnName,populatePropertyIndex(indexName,indexedColumn.type(),indexedColumn.max(),indexedColumn.min(),(Field)attrib.getJavaMember()));
      }
 else       if (columnsNameToBeIndexed != null && !columnsNameToBeIndexed.isEmpty() && columnsNameToBeIndexed.contains(colName)) {
        metadata.addIndexProperty(columnName,populatePropertyIndex(columnName,null,null,null,(Field)attrib.getJavaMember()));
      }
    }
  }
}

Fixed version (ground truth):
public final void process(final Class<?> clazz,EntityMetadata metadata){
  if (clazz != null) {
    metadata.setIndexName(clazz.getSimpleName());
  }
  Index idx=clazz.getAnnotation(Index.class);
  IndexCollection indexes=clazz.getAnnotation(IndexCollection.class);
  EntityType entityType=(EntityType)kunderaMetadata.getApplicationMetadata().getMetaModelBuilder(metadata.getPersistenceUnit()).getManagedTypes().get(clazz);
  List<String> columnsNameToBeIndexed=new ArrayList<String>();
  Map<String,com.impetus.kundera.index.Index> indexedColumnsMap=new HashMap<String,com.impetus.kundera.index.Index>();
  if (null != indexes) {
    if (indexes.columns() != null && indexes.columns().length != 0) {
      metadata.setIndexable(true);
      for (      com.impetus.kundera.index.Index indexedColumn : indexes.columns()) {
        if (indexedColumn.type().equals("String_Node_Str")) {
          metadata.addIndexProperty(prepareCompositeIndexName(indexedColumn.name(),entityType,metadata),populatePropertyIndex(indexedColumn.indexName(),indexedColumn.type(),null,null,null));
        }
 else {
          indexedColumnsMap.put(indexedColumn.name(),indexedColumn);
        }
      }
    }
  }
 else   if (null != idx) {
    boolean isIndexable=idx.index();
    if (isIndexable) {
      metadata.setIndexable(isIndexable);
      String indexName=idx.name();
      if (indexName != null && !indexName.isEmpty()) {
        metadata.setIndexName(indexName);
      }
      if (idx.columns() != null && idx.columns().length != 0) {
        for (        String indexedColumn : idx.columns()) {
          columnsNameToBeIndexed.add(indexedColumn);
        }
      }
    }
  }
 else {
    log.debug("String_Node_Str" + clazz.getName() + "String_Node_Str"+ (indexedColumnsMap.isEmpty() ? "String_Node_Str" : indexedColumnsMap));
    return;
  }
  log.debug("String_Node_Str" + clazz.getName() + "String_Node_Str");
  Set<Attribute> attributes=entityType.getAttributes();
  for (  Attribute attrib : attributes) {
    if (!attrib.isAssociation()) {
      String colName=attrib.getName();
      String columnName=((AbstractAttribute)attrib).getJPAColumnName();
      if (indexedColumnsMap != null && !indexedColumnsMap.isEmpty() && indexedColumnsMap.containsKey(colName)) {
        com.impetus.kundera.index.Index indexedColumn=indexedColumnsMap.get(colName);
        String indexName=StringUtils.isBlank(indexedColumn.indexName()) ? columnName : indexedColumn.indexName();
        metadata.addIndexProperty(columnName,populatePropertyIndex(indexName,indexedColumn.type(),indexedColumn.max(),indexedColumn.min(),(Field)attrib.getJavaMember()));
      }
 else       if (columnsNameToBeIndexed != null && !columnsNameToBeIndexed.isEmpty() && columnsNameToBeIndexed.contains(colName)) {
        metadata.addIndexProperty(columnName,populatePropertyIndex(columnName,null,null,null,(Field)attrib.getJavaMember()));
      }
    }
  }
}