Program: 65604
Project: 65604
Buggy source:
/** 
 * Prepare the meta data which will be used in execution of a query text. It sets the value of two member variables: resultSetMetaData and currentTableName
 * @param queryText
 * @throws OdaException
 */
private void prepareMetaData() throws OdaException {
  masterExcelFileSource=new ExcelFileSource(connProperties,currentTableName,worksheetNames,maxRowsToRead,null,null,appContext);
  String[] allColumnNames;
  String[] allColumnTypes;
  allColumnNames=this.hasColumnNames ? discoverActualColumnMetaData(NAME_LITERAL,currentTableName) : createTempColumnNames(masterExcelFileSource.getColumnCount());
  allColumnTypes=this.hasTypeLine ? discoverActualColumnMetaData(TYPE_LITERAL,currentTableName) : createTempColumnTypes(masterExcelFileSource.getColumnCount());
  resultSetMetaData=new ResultSetMetaData(allColumnNames,allColumnTypes);
  if (allColumnNames.length != allColumnTypes.length)   throw new OdaException(Messages.getString("String_Node_Str"));
  String[] queryColumnNames=null;
  String[] queryColumnTypes=null;
  String[] queryColumnLables=null;
  if (isWildCard(preparedColumnNames)) {
    queryColumnNames=allColumnNames;
    queryColumnTypes=allColumnTypes;
    queryColumnLables=allColumnNames;
    this.resultSetMetaDataHelper=new ResultSetMetaDataHelper(queryColumnNames,queryColumnTypes,queryColumnLables);
    this.resultSetMetaData=new ResultSetMetaData(this.resultSetMetaDataHelper);
  }
 else {
    queryColumnNames=ExcelFileSource.getStringArrayFromList(stripFormatInfoFromQueryColumnNames(getQueryColumnNamesVector((preparedColumnNames))));
    validateColumnName(queryColumnNames,allColumnNames);
    queryColumnTypes=this.hasTypeLine ? getQueryColumnTypes(allColumnNames,allColumnTypes,queryColumnNames) : createTempColumnTypes(queryColumnNames.length);
    queryColumnLables=this.hasColumnNames ? columnLabels : queryColumnNames;
    if (queryColumnLables == null)     queryColumnLables=queryColumnNames;
    this.resultSetMetaDataHelper=new ResultSetMetaDataHelper(queryColumnNames,queryColumnTypes,queryColumnLables);
    this.resultSetMetaData=new ResultSetMetaData(this.resultSetMetaDataHelper);
  }
}

Fixed version (ground truth):
/** 
 * Prepare the meta data which will be used in execution of a query text. It sets the value of two member variables: resultSetMetaData and currentTableName
 * @param queryText
 * @throws OdaException
 */
private void prepareMetaData(String savedSelectedColInfo) throws OdaException {
  masterExcelFileSource=new ExcelFileSource(connProperties,currentTableName,worksheetNames,maxRowsToRead,null,null,appContext);
  String[] allColumnNames;
  String[] allColumnTypes;
  allColumnNames=this.hasColumnNames ? discoverActualColumnMetaData(NAME_LITERAL,currentTableName) : createTempColumnNames(masterExcelFileSource.getColumnCount());
  allColumnTypes=this.hasTypeLine ? discoverActualColumnMetaData(TYPE_LITERAL,currentTableName) : createTempColumnTypes(masterExcelFileSource.getColumnCount());
  resultSetMetaData=new ResultSetMetaData(allColumnNames,allColumnTypes);
  if (allColumnNames.length != allColumnTypes.length)   throw new OdaException(Messages.getString("String_Node_Str"));
  String[] queryColumnNames=null;
  String[] queryColumnTypes=null;
  String[] queryColumnLables=null;
  if (isWildCard(preparedColumnNames)) {
    queryColumnNames=allColumnNames;
    queryColumnTypes=allColumnTypes;
    queryColumnLables=allColumnNames;
    this.resultSetMetaDataHelper=new ResultSetMetaDataHelper(queryColumnNames,queryColumnTypes,queryColumnLables);
    this.resultSetMetaData=new ResultSetMetaData(this.resultSetMetaDataHelper);
  }
 else {
    queryColumnNames=ExcelFileSource.getStringArrayFromList(stripFormatInfoFromQueryColumnNames(getQueryColumnNamesVector((preparedColumnNames))));
    validateColumnName(queryColumnNames,allColumnNames);
    if (savedSelectedColInfo == null || savedSelectedColInfo.length() == 0) {
      queryColumnTypes=this.hasTypeLine ? getQueryColumnTypes(allColumnNames,allColumnTypes,queryColumnNames) : createTempColumnTypes(queryColumnNames.length);
      queryColumnLables=this.hasColumnNames ? columnLabels : queryColumnNames;
      if (queryColumnLables == null)       queryColumnLables=queryColumnNames;
      this.resultSetMetaDataHelper=new ResultSetMetaDataHelper(queryColumnNames,queryColumnTypes,queryColumnLables);
      this.resultSetMetaData=new ResultSetMetaData(this.resultSetMetaDataHelper);
    }
 else {
      this.resultSetMetaDataHelper=new ResultSetMetaDataHelper(savedSelectedColInfo);
      this.resultSetMetaData=new ResultSetMetaData(this.resultSetMetaDataHelper);
    }
  }
}