Program: 61232
Project: 61232
Buggy source:
/** 
 * <em>WARNING</em>: this method connects to the database by mean of the  underlying Spring's datasource, not using the provided one, to be fetched via JNDI. This in order to avoid potential conflicts and problems with DbUnit.
 * @param sce
 */
@Override public void contextInitialized(final ServletContextEvent sce){
  WebApplicationContext springContext=WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext());
  DataSource dataSource=(DataSource)springContext.getBean("String_Node_Str");
  DefaultDataTypeFactory dbUnitDataTypeFactory=(DefaultDataTypeFactory)springContext.getBean("String_Node_Str");
  String dbSchema=null;
  try {
    InputStream dbPropsStream=sce.getServletContext().getResourceAsStream("String_Node_Str" + "String_Node_Str");
    Properties dbProps=new Properties();
    dbProps.load(dbPropsStream);
    dbSchema=dbProps.getProperty("String_Node_Str");
  }
 catch (  Throwable t) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",t);
    }
 else {
      log.error("String_Node_Str");
    }
    dbSchema=null;
  }
  Connection conn=DataSourceUtils.getConnection(dataSource);
  Statement statement=null;
  ResultSet resultSet=null;
  boolean existingData=false;
  try {
    statement=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
    resultSet=statement.executeQuery("String_Node_Str" + SyncopeConfiguration.class.getSimpleName());
    resultSet.last();
    existingData=resultSet.getRow() > 0;
  }
 catch (  SQLException e) {
    log.error("String_Node_Str" + SyncopeConfiguration.class.getSimpleName(),e);
    existingData=true;
  }
 finally {
    try {
      resultSet.close();
      statement.close();
    }
 catch (    SQLException e) {
      log.error("String_Node_Str",e);
    }
  }
  try {
    IDatabaseConnection dbUnitConn=dbSchema == null ? new DatabaseConnection(conn) : new DatabaseConnection(conn,dbSchema);
    DatabaseConfig config=dbUnitConn.getConfig();
    config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY,dbUnitDataTypeFactory);
    config.setProperty(DatabaseConfig.FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES,true);
    if (existingData) {
      log.info("String_Node_Str");
    }
 else {
      log.info("String_Node_Str");
      FlatXmlDataSetBuilder dataSetBuilder=new FlatXmlDataSetBuilder();
      dataSetBuilder.setColumnSensing(true);
      IDataSet dataSet=dataSetBuilder.build(getClass().getResourceAsStream("String_Node_Str"));
      DatabaseOperation.REFRESH.execute(dbUnitConn,dataSet);
    }
  }
 catch (  Throwable t) {
    log.error("String_Node_Str",t);
  }
 finally {
    DataSourceUtils.releaseConnection(conn,dataSource);
  }
}

Fixed version (ground truth):
/** 
 * <em>WARNING</em>: this method connects to the database by mean of the  underlying Spring's datasource, not using the provided one, to be fetched via JNDI. This in order to avoid potential conflicts and problems with DbUnit.
 * @param sce
 */
@Override public void contextInitialized(final ServletContextEvent sce){
  WebApplicationContext springContext=WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext());
  DataSource dataSource=(DataSource)springContext.getBean("String_Node_Str");
  DefaultDataTypeFactory dbUnitDataTypeFactory=(DefaultDataTypeFactory)springContext.getBean("String_Node_Str");
  String dbSchema=null;
  try {
    InputStream dbPropsStream=sce.getServletContext().getResourceAsStream("String_Node_Str" + "String_Node_Str");
    Properties dbProps=new Properties();
    dbProps.load(dbPropsStream);
    dbSchema=dbProps.getProperty("String_Node_Str");
  }
 catch (  Throwable t) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str",t);
    }
 else {
      log.error("String_Node_Str");
    }
    dbSchema=null;
  }
  Connection conn=DataSourceUtils.getConnection(dataSource);
  Statement statement=null;
  ResultSet resultSet=null;
  boolean existingData=false;
  try {
    statement=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
    resultSet=statement.executeQuery("String_Node_Str" + SyncopeConfiguration.class.getSimpleName());
    resultSet.last();
    existingData=resultSet.getRow() > 0;
  }
 catch (  SQLException e) {
    log.error("String_Node_Str" + SyncopeConfiguration.class.getSimpleName(),e);
    existingData=true;
  }
 finally {
    try {
      resultSet.close();
      statement.close();
    }
 catch (    SQLException e) {
      log.error("String_Node_Str",e);
    }
  }
  try {
    IDatabaseConnection dbUnitConn=dbSchema == null ? new DatabaseConnection(conn) : new DatabaseConnection(conn,dbSchema);
    DatabaseConfig config=dbUnitConn.getConfig();
    config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY,dbUnitDataTypeFactory);
    config.setProperty(DatabaseConfig.FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES,true);
    if (existingData) {
      log.info("String_Node_Str");
    }
 else {
      log.info("String_Node_Str");
      FlatXmlDataSetBuilder dataSetBuilder=new FlatXmlDataSetBuilder();
      dataSetBuilder.setColumnSensing(true);
      IDataSet dataSet=dataSetBuilder.build(getClass().getResourceAsStream("String_Node_Str"));
      DatabaseOperation.CLEAN_INSERT.execute(dbUnitConn,dataSet);
    }
  }
 catch (  Throwable t) {
    log.error("String_Node_Str",t);
  }
 finally {
    DataSourceUtils.releaseConnection(conn,dataSource);
  }
}