Program: 78321
Project: 78321
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 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);
}

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));
    }
  }
  if (dataSet.getResultSetHints() != null) {
    List hintList=dataSet.getResultSetHints();
    for (int i=0; i < hintList.size(); i++) {
      IColumnDefinition columnDefinition=(IColumnDefinition)hintList.get(i);
      for (int j=0; j < projectedColumns.size(); j++) {
        ResultFieldMetadata resultFieldMetadata=(ResultFieldMetadata)projectedColumns.get(j);
        if (columnDefinition.getColumnName().equals(resultFieldMetadata.getName())) {
          resultFieldMetadata.setAlias(columnDefinition.getAlias());
          break;
        }
      }
    }
  }
  ResultClass resultClass=new ResultClass(projectedColumns);
  return new JointResultMetadata(resultClass,columnSource,index);
}