Program: 51311
Project: 51311
Buggy source:
private TabularRowSet executeColumnQuery(XmlaRequest request) throws XmlaException {
  checkFormat(request);
  DataSourcesConfig.DataSource ds=getDataSource(request);
  DataSourcesConfig.Catalog dsCatalog=getCatalog(request,ds);
  String roleName=request.getRoleName();
  Role role=request.getRole();
  final Connection connection=getConnection(dsCatalog,role,roleName);
  final String statement=request.getStatement();
  final Query query=connection.parseQuery(statement);
  query.setResultStyle(ResultStyle.LIST);
  final Result result=connection.execute(query);
  Cell dtCell=result.getCell(new int[]{0,0});
  if (!dtCell.canDrillThrough()) {
    throw new XmlaException(SERVER_FAULT_FC,HSB_DRILL_THROUGH_NOT_ALLOWED_CODE,HSB_DRILL_THROUGH_NOT_ALLOWED_FAULT_FS,Util.newError("String_Node_Str"));
  }
  final Map<String,String> properties=request.getProperties();
  String dtSql=dtCell.getDrillThroughSQL(true);
  int index=dtSql.indexOf("String_Node_Str");
  String whereClause="String_Node_Str" + dtSql.substring(index);
  final String fieldNames=properties.get(PropertyDefinition.TableFields.name());
  StringTokenizer st=new StringTokenizer(fieldNames,"String_Node_Str");
  drillThruColumnNames.clear();
  while (st.hasMoreTokens()) {
    drillThruColumnNames.add(st.nextToken());
  }
  StringBuilder buf=new StringBuilder("String_Node_Str");
  int k=-1;
  for (  String drillThruColumnName : drillThruColumnNames) {
    if (++k > 0) {
      buf.append("String_Node_Str");
    }
    buf.append(drillThruColumnName);
  }
  buf.append(' ');
  buf.append(whereClause);
  dtSql=buf.toString();
  DataSource dataSource=((RolapConnection)connection).getDataSource();
  try {
    int count=-1;
    if (MondrianProperties.instance().EnableTotalCount.booleanValue()) {
      String temp=dtSql.toUpperCase();
      int fromOff=temp.indexOf("String_Node_Str");
      buf.setLength(0);
      buf.append("String_Node_Str");
      buf.append(dtSql.substring(fromOff));
      String countSql=buf.toString();
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("String_Node_Str" + countSql);
      }
      SqlStatement smt=RolapUtil.executeQuery(dataSource,countSql,-1,"String_Node_Str","String_Node_Str",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
      try {
        ResultSet rs=smt.getResultSet();
        if (rs.next()) {
          count=rs.getInt(1);
          ++smt.rowCount;
        }
      }
 catch (      SQLException e) {
        smt.handle(e);
      }
 finally {
        smt.close();
      }
    }
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("String_Node_Str" + dtSql);
    }
    SqlStatement stmt=RolapUtil.executeQuery(dataSource,dtSql,-1,"String_Node_Str","String_Node_Str",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    return new TabularRowSet(stmt,request.drillThroughMaxRows(),request.drillThroughFirstRowset(),count,ResultSet.TYPE_FORWARD_ONLY);
  }
 catch (  XmlaException xex) {
    throw xex;
  }
catch (  RuntimeException rte) {
    throw new XmlaException(SERVER_FAULT_FC,HSB_DRILL_THROUGH_SQL_CODE,HSB_DRILL_THROUGH_SQL_FAULT_FS,rte);
  }
}

Fixed version (ground truth):
private TabularRowSet executeColumnQuery(XmlaRequest request) throws XmlaException {
  checkFormat(request);
  DataSourcesConfig.DataSource ds=getDataSource(request);
  DataSourcesConfig.Catalog dsCatalog=getCatalog(request,ds);
  String roleName=request.getRoleName();
  Role role=request.getRole();
  final Connection connection=getConnection(dsCatalog,role,roleName);
  final String statement=request.getStatement();
  final Query query=connection.parseQuery(statement);
  query.setResultStyle(ResultStyle.LIST);
  final Result result=connection.execute(query);
  Cell dtCell=result.getCell(new int[]{0,0});
  if (!dtCell.canDrillThrough()) {
    throw new XmlaException(SERVER_FAULT_FC,HSB_DRILL_THROUGH_NOT_ALLOWED_CODE,HSB_DRILL_THROUGH_NOT_ALLOWED_FAULT_FS,Util.newError("String_Node_Str"));
  }
  final Map<String,String> properties=request.getProperties();
  String dtSql=dtCell.getDrillThroughSQL(true);
  int index=dtSql.indexOf("String_Node_Str");
  String whereClause="String_Node_Str" + dtSql.substring(index);
  final String fieldNames=properties.get(PropertyDefinition.TableFields.name());
  StringTokenizer st=new StringTokenizer(fieldNames,"String_Node_Str");
  drillThruColumnNames.clear();
  while (st.hasMoreTokens()) {
    drillThruColumnNames.add(st.nextToken());
  }
  StringBuilder buf=new StringBuilder("String_Node_Str");
  int k=-1;
  for (  String drillThruColumnName : drillThruColumnNames) {
    if (++k > 0) {
      buf.append("String_Node_Str");
    }
    buf.append(drillThruColumnName);
  }
  buf.append(' ');
  buf.append(whereClause);
  dtSql=buf.toString();
  DataSource dataSource=connection.getDataSource();
  try {
    int count=-1;
    if (MondrianProperties.instance().EnableTotalCount.booleanValue()) {
      String temp=dtSql.toUpperCase();
      int fromOff=temp.indexOf("String_Node_Str");
      buf.setLength(0);
      buf.append("String_Node_Str");
      buf.append(dtSql.substring(fromOff));
      String countSql=buf.toString();
      if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("String_Node_Str" + countSql);
      }
      SqlStatement smt=RolapUtil.executeQuery(dataSource,countSql,-1,"String_Node_Str","String_Node_Str",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
      try {
        ResultSet rs=smt.getResultSet();
        if (rs.next()) {
          count=rs.getInt(1);
          ++smt.rowCount;
        }
      }
 catch (      SQLException e) {
        smt.handle(e);
      }
 finally {
        smt.close();
      }
    }
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("String_Node_Str" + dtSql);
    }
    SqlStatement stmt=RolapUtil.executeQuery(dataSource,dtSql,-1,"String_Node_Str","String_Node_Str",ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    return new TabularRowSet(stmt,request.drillThroughMaxRows(),request.drillThroughFirstRowset(),count,ResultSet.TYPE_FORWARD_ONLY);
  }
 catch (  XmlaException xex) {
    throw xex;
  }
catch (  RuntimeException rte) {
    throw new XmlaException(SERVER_FAULT_FC,HSB_DRILL_THROUGH_SQL_CODE,HSB_DRILL_THROUGH_SQL_FAULT_FS,rte);
  }
}