Program: 78364
Project: 78364
Buggy source:
/** 
 * Populate the JointResultMetadata.
 * @param left
 * @param leftPrefix
 * @param right
 * @param rightPrefix
 * @return
 * @throws DataException
 */
private JointResultMetadata populatorJointResultMetadata(IResultClass left,String leftPrefix,IResultClass right,String rightPrefix) throws DataException {
  int[] index=new int[left.getFieldCount() + right.getFieldCount()];
  boolean[] isFromLeft=new boolean[left.getFieldCount() + right.getFieldCount()];
  List projectedColumns=new ArrayList();
  for (int i=1; i <= left.getFieldCount(); i++) {
    index[i - 1]=i;
    isFromLeft[i - 1]=true;
    projectedColumns.add(new ResultFieldMetadata(i,leftPrefix + left.getFieldName(i),leftPrefix + left.getFieldName(i),left.getFieldValueClass(i),left.getFieldNativeTypeName(i),false));
  }
  for (int i=left.getFieldCount() + 1; i <= index.length; i++) {
    index[i - 1]=i - left.getFieldCount();
    isFromLeft[i - 1]=false;
    projectedColumns.add(new ResultFieldMetadata(i,rightPrefix + right.getFieldName(i - left.getFieldCount()),rightPrefix + right.getFieldName(i - left.getFieldCount()),right.getFieldValueClass(i - left.getFieldCount()),right.getFieldNativeTypeName(i - left.getFieldCount()),false));
  }
  ResultClass resultClass=new ResultClass(projectedColumns);
  return new JointResultMetadata(resultClass,isFromLeft,index);
}

Fixed version (ground truth):
/** 
 * Populate the JointResultMetadata.
 * @param left
 * @param leftPrefix
 * @param right
 * @param rightPrefix
 * @return
 * @throws DataException
 */
private JointResultMetadata populatorJointResultMetadata(IResultClass left,String leftPrefix,IResultClass right,String rightPrefix) throws DataException {
  int length=left.getFieldCount() + right.getFieldCount() + ((dataSet.getComputedColumns() == null) ? 0 : dataSet.getComputedColumns().size());
  int[] index=new int[length];
  int[] columnSource=new int[length];
  List projectedColumns=new ArrayList();
  for (int i=1; i <= left.getFieldCount(); i++) {
    index[i - 1]=i;
    columnSource[i - 1]=JointResultMetadata.COLUMN_TYPE_LEFT;
    projectedColumns.add(new ResultFieldMetadata(i,leftPrefix + left.getFieldName(i),leftPrefix + left.getFieldName(i),left.getFieldValueClass(i),left.getFieldNativeTypeName(i),false));
  }
  for (int i=left.getFieldCount() + 1; i <= left.getFieldCount() + right.getFieldCount(); i++) {
    index[i - 1]=i - left.getFieldCount();
    columnSource[i - 1]=JointResultMetadata.COLUMN_TYPE_RIGHT;
    projectedColumns.add(new ResultFieldMetadata(i,rightPrefix + right.getFieldName(i - left.getFieldCount()),rightPrefix + right.getFieldName(i - left.getFieldCount()),right.getFieldValueClass(i - left.getFieldCount()),right.getFieldNativeTypeName(i - left.getFieldCount()),false));
  }
  if (dataSet.getComputedColumns() != null) {
    for (int i=0; i < dataSet.getComputedColumns().size(); i++) {
      IComputedColumn cc=(IComputedColumn)dataSet.getComputedColumns().get(i);
      index[i + left.getFieldCount() + right.getFieldCount()]=-1;
      columnSource[i + left.getFieldCount() + right.getFieldCount()]=JointResultMetadata.COLUMN_TYPE_COMPUTED;
      projectedColumns.add(new ResultFieldMetadata(i,cc.getName(),cc.getName(),DataType.getClass(cc.getDataType()),null,true));
    }
  }
  ResultClass resultClass=new ResultClass(projectedColumns);
  return new JointResultMetadata(resultClass,columnSource,index);
}