Program: 169018
Project: 169018
Buggy source:
private void applyMapping(Attribute<?,?> attribute,List<Object> mappingList,List<String> parameterMappingList,boolean[] featuresFound){
  if (attribute.isSubquery()) {
    applySubqueryMapping((SubqueryAttribute<? super T,?>)attribute,mappingList,parameterMappingList);
  }
 else {
    MappingAttribute<? super T,?> mappingAttribute=(MappingAttribute<? super T,?>)attribute;
    if (attribute.isCollection()) {
      PluralAttribute<?,?,?> pluralAttribute=(PluralAttribute<?,?,?>)attribute;
      boolean listKey=pluralAttribute.isIndexed() && attribute instanceof ListAttribute<?,?>;
      boolean mapKey=pluralAttribute.isIndexed() && attribute instanceof MapAttribute<?,?,?>;
      int startIndex=tupleOffset + mappingList.size();
      if (listKey) {
        featuresFound[1]=true;
        applyCollectionKeyMapping("String_Node_Str",mappingAttribute,attribute,mappingList);
        parameterMappingList.add(null);
      }
 else       if (mapKey) {
        featuresFound[1]=true;
        applyCollectionKeyMapping("String_Node_Str",mappingAttribute,attribute,mappingList);
        parameterMappingList.add(null);
      }
      if (attribute.isSubview()) {
        featuresFound[2]=true;
        int[] newIdPositions;
        if (listKey || mapKey) {
          newIdPositions=new int[idPositions.length + 1];
          System.arraycopy(idPositions,0,newIdPositions,0,idPositions.length);
          newIdPositions[idPositions.length]=mappingList.size();
        }
 else {
          newIdPositions=idPositions;
        }
        applySubviewMapping(attribute,newIdPositions,pluralAttribute.getElementType(),mappingAttribute,mappingList,parameterMappingList);
      }
 else {
        applyBasicMapping(mappingAttribute,attribute,mappingList,parameterMappingList);
      }
      if (listKey) {
        if (pluralAttribute.isSorted()) {
          throw new IllegalArgumentException("String_Node_Str" + pluralAttribute + "String_Node_Str");
        }
 else {
          tupleTransformator.add(new IndexedListTupleListTransformer(idPositions,startIndex));
        }
      }
 else       if (mapKey) {
        if (pluralAttribute.isSorted()) {
          tupleTransformator.add(new SortedMapTupleListTransformer(idPositions,startIndex,pluralAttribute.getComparator()));
        }
 else         if (pluralAttribute.isOrdered()) {
          tupleTransformator.add(new OrderedMapTupleListTransformer(idPositions,startIndex));
        }
 else {
          tupleTransformator.add(new MapTupleListTransformer(idPositions,startIndex));
        }
      }
 else {
switch (pluralAttribute.getCollectionType()) {
case COLLECTION:
          if (pluralAttribute.isSorted()) {
            throw new IllegalArgumentException("String_Node_Str" + pluralAttribute + "String_Node_Str");
          }
 else {
            tupleTransformator.add(new OrderedListTupleListTransformer(idPositions,startIndex));
          }
        break;
case LIST:
      if (pluralAttribute.isSorted()) {
        throw new IllegalArgumentException("String_Node_Str" + pluralAttribute + "String_Node_Str");
      }
 else {
        tupleTransformator.add(new OrderedListTupleListTransformer(idPositions,startIndex));
      }
    break;
case SET:
  if (pluralAttribute.isSorted()) {
    tupleTransformator.add(new SortedSetTupleListTransformer(idPositions,startIndex,pluralAttribute.getComparator()));
  }
 else   if (pluralAttribute.isOrdered()) {
    tupleTransformator.add(new OrderedSetTupleListTransformer(idPositions,startIndex));
  }
 else {
    tupleTransformator.add(new SetTupleListTransformer(idPositions,startIndex));
  }
break;
case MAP:
throw new IllegalArgumentException("String_Node_Str" + pluralAttribute + "String_Node_Str");
}
}
}
 else if (((SingularAttribute)attribute).isQueryParameter()) {
featuresFound[0]=true;
applyQueryParameterMapping(mappingAttribute,mappingList,parameterMappingList);
}
 else if (attribute.isSubview()) {
featuresFound[2]=true;
applySubviewMapping(attribute,idPositions,attribute.getJavaType(),mappingAttribute,mappingList,parameterMappingList);
}
 else {
applyBasicMapping(mappingAttribute,attribute,mappingList,parameterMappingList);
}
}
}

Fixed version (ground truth):
private void applyMapping(Attribute<?,?> attribute,List<Object> mappingList,List<String> parameterMappingList,boolean[] featuresFound){
  if (attribute.isSubquery()) {
    applySubqueryMapping((SubqueryAttribute<? super T,?>)attribute,mappingList,parameterMappingList);
  }
 else {
    MappingAttribute<? super T,?> mappingAttribute=(MappingAttribute<? super T,?>)attribute;
    if (attribute.isCollection()) {
      PluralAttribute<?,?,?> pluralAttribute=(PluralAttribute<?,?,?>)attribute;
      boolean listKey=pluralAttribute.isIndexed() && attribute instanceof ListAttribute<?,?>;
      boolean mapKey=pluralAttribute.isIndexed() && attribute instanceof MapAttribute<?,?,?>;
      int startIndex=tupleOffset + mappingList.size();
      if (listKey) {
        featuresFound[1]=true;
        applyCollectionKeyMapping("String_Node_Str",mappingAttribute,attribute,mappingList);
        parameterMappingList.add(null);
      }
 else       if (mapKey) {
        featuresFound[1]=true;
        applyCollectionKeyMapping("String_Node_Str",mappingAttribute,attribute,mappingList);
        parameterMappingList.add(null);
      }
      if (attribute.isSubview()) {
        featuresFound[2]=true;
        int[] newIdPositions;
        if (listKey || mapKey) {
          newIdPositions=new int[idPositions.length + 1];
          System.arraycopy(idPositions,0,newIdPositions,0,idPositions.length);
          newIdPositions[idPositions.length]=mappingList.size();
        }
 else {
          newIdPositions=idPositions;
        }
        applySubviewMapping(attribute,newIdPositions,pluralAttribute.getElementType(),mappingAttribute,mappingList,parameterMappingList);
      }
 else {
        applyBasicMapping(mappingAttribute,attribute,mappingList,parameterMappingList);
      }
      if (listKey) {
        if (pluralAttribute.isSorted()) {
          throw new IllegalArgumentException("String_Node_Str" + pluralAttribute + "String_Node_Str");
        }
 else {
          tupleTransformatorFactory.add(new IndexedListTupleListTransformer(idPositions,startIndex));
        }
      }
 else       if (mapKey) {
        if (pluralAttribute.isSorted()) {
          tupleTransformatorFactory.add(new SortedMapTupleListTransformer(idPositions,startIndex,pluralAttribute.getComparator()));
        }
 else         if (pluralAttribute.isOrdered()) {
          tupleTransformatorFactory.add(new OrderedMapTupleListTransformer(idPositions,startIndex));
        }
 else {
          tupleTransformatorFactory.add(new MapTupleListTransformer(idPositions,startIndex));
        }
      }
 else {
switch (pluralAttribute.getCollectionType()) {
case COLLECTION:
          if (pluralAttribute.isSorted()) {
            throw new IllegalArgumentException("String_Node_Str" + pluralAttribute + "String_Node_Str");
          }
 else {
            tupleTransformatorFactory.add(new OrderedListTupleListTransformer(idPositions,startIndex));
          }
        break;
case LIST:
      if (pluralAttribute.isSorted()) {
        throw new IllegalArgumentException("String_Node_Str" + pluralAttribute + "String_Node_Str");
      }
 else {
        tupleTransformatorFactory.add(new OrderedListTupleListTransformer(idPositions,startIndex));
      }
    break;
case SET:
  if (pluralAttribute.isSorted()) {
    tupleTransformatorFactory.add(new SortedSetTupleListTransformer(idPositions,startIndex,pluralAttribute.getComparator()));
  }
 else   if (pluralAttribute.isOrdered()) {
    tupleTransformatorFactory.add(new OrderedSetTupleListTransformer(idPositions,startIndex));
  }
 else {
    tupleTransformatorFactory.add(new SetTupleListTransformer(idPositions,startIndex));
  }
break;
case MAP:
throw new IllegalArgumentException("String_Node_Str" + pluralAttribute + "String_Node_Str");
}
}
}
 else if (((SingularAttribute)attribute).isQueryParameter()) {
featuresFound[0]=true;
applyQueryParameterMapping(mappingAttribute,mappingList,parameterMappingList);
}
 else if (attribute.isSubview()) {
featuresFound[2]=true;
applySubviewMapping(attribute,idPositions,attribute.getJavaType(),mappingAttribute,mappingList,parameterMappingList);
}
 else {
applyBasicMapping(mappingAttribute,attribute,mappingList,parameterMappingList);
}
}
}