Program: 51627
Project: 51627
Buggy source:
/** 
 * Creates a RolapConnection. <p>Only   {@link mondrian.rolap.RolapSchema.Pool#get} calls this with schema != null (tocreate a schema's internal connection). Other uses retrieve a schema from the cache based upon the <code>Catalog</code> property.
 * @param connectInfo Connection properties; keywords are described in{@link RolapConnectionProperties}.
 * @param schema Schema for the connection. Must be null unless this is tobe an internal connection.
 * @pre connectInfo != null
 */
RolapConnection(Util.PropertyList connectInfo,RolapSchema schema){
  this.connectInfo=connectInfo;
  final String jdbcConnectString=connectInfo.get(RolapConnectionProperties.Jdbc);
  final String jdbcUser=connectInfo.get(RolapConnectionProperties.JdbcUser);
  final String dataSource=connectInfo.get(RolapConnectionProperties.DataSource);
  if ((jdbcConnectString == null) != (dataSource != null)) {
    throw Util.newInternal("String_Node_Str" + connectInfo.toString() + "String_Node_Str"+ RolapConnectionProperties.Jdbc+ "String_Node_Str"+ RolapConnectionProperties.DataSource+ "String_Node_Str");
  }
  if (jdbcConnectString != null) {
    this.catalogName=connectInfo.get(RolapConnectionProperties.Catalog);
    String provider=connectInfo.get(RolapConnectionProperties.Provider);
    Util.assertTrue(provider.equalsIgnoreCase("String_Node_Str"));
    String jdbcDrivers=connectInfo.get(RolapConnectionProperties.JdbcDrivers);
    if (jdbcDrivers != null) {
      loadDrivers(jdbcDrivers);
    }
    loadDrivers(MondrianProperties.instance().getJdbcDrivers());
    Properties jdbcProperties=new Properties();
    if (jdbcUser != null) {
      jdbcProperties.setProperty("String_Node_Str",jdbcUser);
    }
    String jdbcPassword=connectInfo.get(RolapConnectionProperties.JdbcPassword);
    if (jdbcPassword != null) {
      jdbcProperties.setProperty("String_Node_Str",jdbcPassword);
    }
    try {
      this.jdbcConnection=java.sql.DriverManager.getConnection(jdbcConnectString,jdbcProperties);
    }
 catch (    SQLException e) {
      throw Util.newInternal(e,"String_Node_Str" + connectInfo.toString() + "String_Node_Str");
    }
  }
 else {
    Util.assertTrue(dataSource != null);
    try {
      final DataSource dataSourceObject=(DataSource)new InitialContext().lookup(dataSource);
      this.jdbcConnection=dataSourceObject.getConnection();
    }
 catch (    SQLException e) {
      throw Util.newInternal(e,"String_Node_Str" + dataSource + "String_Node_Str");
    }
catch (    NamingException e) {
      throw Util.newInternal(e,"String_Node_Str" + dataSource + "String_Node_Str");
    }
  }
  Role role=null;
  if (schema == null) {
    schema=RolapSchema.Pool.instance().get(catalogName,jdbcConnectString,jdbcUser,dataSource,connectInfo);
    String roleName=connectInfo.get(RolapConnectionProperties.Role);
    if (roleName != null) {
      role=schema.lookupRole(roleName);
      if (role == null) {
        throw Util.newError("String_Node_Str" + roleName + "String_Node_Str");
      }
    }
  }
  if (role == null) {
    role=schema.defaultRole;
  }
  setRole(role);
  this.schema=schema;
}

Fixed version (ground truth):
/** 
 * Creates a RolapConnection. <p>Only   {@link mondrian.rolap.RolapSchema.Pool#get} calls this with schema != null (tocreate a schema's internal connection). Other uses retrieve a schema from the cache based upon the <code>Catalog</code> property.
 * @param connectInfo Connection properties; keywords are described in{@link RolapConnectionProperties}.
 * @param schema Schema for the connection. Must be null unless this is tobe an internal connection.
 * @pre connectInfo != null
 */
RolapConnection(Util.PropertyList connectInfo,RolapSchema schema){
  this.connectInfo=connectInfo;
  final String jdbcConnectString=connectInfo.get(RolapConnectionProperties.Jdbc);
  final String jdbcUser=connectInfo.get(RolapConnectionProperties.JdbcUser);
  final String dataSource=connectInfo.get(RolapConnectionProperties.DataSource);
  if ((jdbcConnectString == null) != (dataSource != null)) {
    throw Util.newInternal("String_Node_Str" + connectInfo.toString() + "String_Node_Str"+ RolapConnectionProperties.Jdbc+ "String_Node_Str"+ RolapConnectionProperties.DataSource+ "String_Node_Str");
  }
  this.catalogName=connectInfo.get(RolapConnectionProperties.Catalog);
  if (jdbcConnectString != null) {
    String provider=connectInfo.get(RolapConnectionProperties.Provider);
    Util.assertTrue(provider.equalsIgnoreCase("String_Node_Str"));
    String jdbcDrivers=connectInfo.get(RolapConnectionProperties.JdbcDrivers);
    if (jdbcDrivers != null) {
      loadDrivers(jdbcDrivers);
    }
    loadDrivers(MondrianProperties.instance().getJdbcDrivers());
    Properties jdbcProperties=new Properties();
    if (jdbcUser != null) {
      jdbcProperties.setProperty("String_Node_Str",jdbcUser);
    }
    String jdbcPassword=connectInfo.get(RolapConnectionProperties.JdbcPassword);
    if (jdbcPassword != null) {
      jdbcProperties.setProperty("String_Node_Str",jdbcPassword);
    }
    try {
      this.jdbcConnection=java.sql.DriverManager.getConnection(jdbcConnectString,jdbcProperties);
    }
 catch (    SQLException e) {
      throw Util.newInternal(e,"String_Node_Str" + connectInfo.toString() + "String_Node_Str");
    }
  }
 else {
    Util.assertTrue(dataSource != null);
    try {
      final DataSource dataSourceObject=(DataSource)new InitialContext().lookup(dataSource);
      this.jdbcConnection=dataSourceObject.getConnection();
    }
 catch (    SQLException e) {
      throw Util.newInternal(e,"String_Node_Str" + dataSource + "String_Node_Str");
    }
catch (    NamingException e) {
      throw Util.newInternal(e,"String_Node_Str" + dataSource + "String_Node_Str");
    }
  }
  Role role=null;
  if (schema == null) {
    schema=RolapSchema.Pool.instance().get(catalogName,jdbcConnectString,jdbcUser,dataSource,connectInfo);
    String roleName=connectInfo.get(RolapConnectionProperties.Role);
    if (roleName != null) {
      role=schema.lookupRole(roleName);
      if (role == null) {
        throw Util.newError("String_Node_Str" + roleName + "String_Node_Str");
      }
    }
  }
  if (role == null) {
    role=schema.defaultRole;
  }
  setRole(role);
  this.schema=schema;
}