Program: 126949
Project: 126949
Buggy source:
/** 
 * DOC cantoine. Method to connect to DataBase.
 * @param String driverClass
 * @param String urlString pwdT
 * @param String username
 * @param String pwd
 * @param String schemaBase
 */
public List getConnection(String dbType,String url,String username,String pwd,String dataBase,String schemaBase,final String driverClassName,final String driverJarPath,String dbVersion,String additionalParams){
  boolean isColsed=false;
  List conList=new ArrayList();
  try {
    if (conn != null) {
      isColsed=conn.isClosed();
    }
  }
 catch (  Exception e) {
    log.error(e.toString());
  }
  List list=new ArrayList();
  DriverShim wapperDriver=null;
  if (isReconnect || conn == null || isColsed) {
    try {
      ConnectionUtils.closeConnection(conn);
      checkDBConnectionTimeout();
      list=connect(dbType,url,username,pwd,driverClassName,driverJarPath,dbVersion,additionalParams);
      if (list != null && list.size() > 0) {
        for (int i=0; i < list.size(); i++) {
          if (list.get(i) instanceof Connection) {
            conn=(Connection)list.get(i);
          }
          if (list.get(i) instanceof DriverShim) {
            wapperDriver=(DriverShim)list.get(i);
          }
        }
      }
      if (schemaBase != null && !schemaBase.equals("String_Node_Str")) {
        final boolean equals=EDatabaseTypeName.getTypeFromDbType(dbType).getProduct().equals(EDatabaseTypeName.ORACLEFORSID.getProduct());
        if (!ExtractMetaDataFromDataBase.checkSchemaConnection(schemaBase,conn,equals,dbType)) {
          schema=null;
        }
      }
 else {
        boolean teradata=EDatabaseTypeName.getTypeFromDbType(dbType).getProduct().equals(EDatabaseTypeName.TERADATA.getProduct());
        boolean as400=EDatabaseTypeName.getTypeFromDbType(dbType).getProduct().equals(EDatabaseTypeName.AS400.getProduct());
        if (teradata) {
          schema=dataBase;
        }
 else         if (as400) {
          schema=retrieveSchemaPatternForAS400(url);
        }
 else         if (EDatabaseTypeName.SAS.getProduct().equals(EDatabaseTypeName.getTypeFromDbType(dbType).getProduct())) {
          schema=dataBase;
        }
 else {
          schema=null;
        }
      }
      conList.add(conn);
      if (wapperDriver != null) {
        conList.add(wapperDriver);
      }
    }
 catch (    MissingDriverException e) {
      throw e;
    }
catch (    SQLException e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
catch (    Exception e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
  }
  return conList;
}

Fixed version (ground truth):
/** 
 * DOC cantoine. Method to connect to DataBase.
 * @param String driverClass
 * @param String urlString pwdT
 * @param String username
 * @param String pwd
 * @param String schemaBase
 */
public List getConnection(String dbType,String url,String username,String pwd,String dataBase,String schemaBase,final String driverClassName,final String driverJarPath,String dbVersion,String additionalParams){
  boolean isColsed=false;
  List conList=new ArrayList();
  try {
    if (conn != null) {
      isColsed=conn.isClosed();
    }
  }
 catch (  Exception e) {
    log.error(e.toString());
  }
  List list=new ArrayList();
  DriverShim wapperDriver=null;
  if (isReconnect || conn == null || isColsed) {
    try {
      closeConnection(true);
      checkDBConnectionTimeout();
      list=connect(dbType,url,username,pwd,driverClassName,driverJarPath,dbVersion,additionalParams);
      if (list != null && list.size() > 0) {
        for (int i=0; i < list.size(); i++) {
          if (list.get(i) instanceof Connection) {
            conn=(Connection)list.get(i);
          }
          if (list.get(i) instanceof DriverShim) {
            wapperDriver=(DriverShim)list.get(i);
          }
        }
      }
      if (schemaBase != null && !schemaBase.equals("String_Node_Str")) {
        final boolean equals=EDatabaseTypeName.getTypeFromDbType(dbType).getProduct().equals(EDatabaseTypeName.ORACLEFORSID.getProduct());
        if (!ExtractMetaDataFromDataBase.checkSchemaConnection(schemaBase,conn,equals,dbType)) {
          schema=null;
        }
      }
 else {
        boolean teradata=EDatabaseTypeName.getTypeFromDbType(dbType).getProduct().equals(EDatabaseTypeName.TERADATA.getProduct());
        boolean as400=EDatabaseTypeName.getTypeFromDbType(dbType).getProduct().equals(EDatabaseTypeName.AS400.getProduct());
        if (teradata) {
          schema=dataBase;
        }
 else         if (as400) {
          schema=retrieveSchemaPatternForAS400(url);
        }
 else         if (EDatabaseTypeName.SAS.getProduct().equals(EDatabaseTypeName.getTypeFromDbType(dbType).getProduct())) {
          schema=dataBase;
        }
 else {
          schema=null;
        }
      }
      conList.add(conn);
      if (wapperDriver != null) {
        conList.add(wapperDriver);
      }
    }
 catch (    MissingDriverException e) {
      throw e;
    }
catch (    SQLException e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
catch (    Exception e) {
      log.error(e.toString());
      throw new RuntimeException(e);
    }
  }
  return conList;
}