Program: 29053
Project: 29053
Buggy source:
/** 
 * Event Table initialization method, it checks the annotation and do necessary pre configuration tasks.
 * @param tableDefinition      Definition of event table
 * @param executionPlanContext ExecutionPlan related meta information
 */
public void init(TableDefinition tableDefinition,ExecutionPlanContext executionPlanContext){
  this.tableDefinition=tableDefinition;
  Connection con=null;
  int bloomFilterSize=RDBMSEventTableConstants.BLOOM_FILTER_SIZE;
  int bloomFilterHashFunctions=RDBMSEventTableConstants.BLOOM_FILTER_HASH_FUNCTIONS;
  Annotation fromAnnotation=AnnotationHelper.getAnnotation(SiddhiConstants.ANNOTATION_FROM,tableDefinition.getAnnotations());
  String dataSourceName=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_DATASOURCE_NAME);
  String tableName=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_TABLE_NAME);
  DataSource dataSource=executionPlanContext.getSiddhiContext().getSiddhiDataSource(dataSourceName);
  List<Attribute> attributeList=tableDefinition.getAttributeList();
  if (dataSource == null) {
    String jdbcConnectionUrl=fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_JDBC_URL);
    String username=fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_USERNAME);
    String password=fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_PASSWORD);
    String driverName=fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_DRIVER_NAME);
    List<Element> connectionPropertyElements=null;
    Annotation connectionAnnotation=AnnotationHelper.getAnnotation(RDBMSEventTableConstants.ANNOTATION_CONNECTION,tableDefinition.getAnnotations());
    if (connectionAnnotation != null) {
      connectionPropertyElements=connectionAnnotation.getElements();
    }
    dataSource=PooledDataSource.getPoolDataSource(driverName,jdbcConnectionUrl,username,password,connectionPropertyElements);
  }
  if (dataSource == null || tableName == null) {
    throw new ExecutionPlanCreationException("String_Node_Str");
  }
  String cacheType=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE);
  cacheSizeInString=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE_SIZE);
  String cacheLoadingType=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE_LOADING);
  String cacheValidityInterval=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE_VALIDITY_PERIOD);
  String bloomsEnabled=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_FILTERS);
  String bloomFilterValidityInterval=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_VALIDITY_PERIOD);
  try {
    this.dbHandler=new DBHandler(dataSource,tableName,attributeList,tableDefinition);
    if ((con=dataSource.getConnection()) == null) {
      throw new ExecutionPlanCreationException("String_Node_Str");
    }
    if (cacheType != null) {
      cachedTable=new CachingTable(cacheType,cacheSizeInString,executionPlanContext,tableDefinition);
      isCachingEnabled=true;
      if (cacheLoadingType != null && cacheLoadingType.equalsIgnoreCase(RDBMSEventTableConstants.EAGER_CACHE_LOADING_ELEMENT)) {
        dbHandler.loadDBCache(cachedTable,cacheSizeInString);
      }
      if (cacheValidityInterval != null) {
        Long cacheTimeInterval=Long.parseLong(cacheValidityInterval);
        Timer timer=new Timer();
        CacheUpdateTask cacheUpdateTask=new CacheUpdateTask();
        timer.schedule(cacheUpdateTask,cacheTimeInterval);
      }
    }
 else     if (bloomsEnabled != null && bloomsEnabled.equalsIgnoreCase("String_Node_Str")) {
      String bloomsFilterSize=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_FILTERS_SIZE);
      String bloomsFilterHash=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_FILTERS_HASH);
      if (bloomsFilterSize != null) {
        bloomFilterSize=Integer.parseInt(bloomsFilterSize);
      }
      if (bloomsFilterHash != null) {
        bloomFilterHashFunctions=Integer.parseInt(bloomsFilterHash);
      }
      dbHandler.setBloomFilterProperties(bloomFilterSize,bloomFilterHashFunctions);
      dbHandler.buildBloomFilters();
      if (bloomFilterValidityInterval != null) {
        Long bloomTimeInterval=Long.parseLong(bloomFilterValidityInterval);
        Timer timer=new Timer();
        BloomsUpdateTask bloomsUpdateTask=new BloomsUpdateTask();
        timer.schedule(bloomsUpdateTask,bloomTimeInterval);
      }
    }
  }
 catch (  SQLException e) {
    throw new ExecutionPlanCreationException("String_Node_Str",e);
  }
 finally {
    if (con != null) {
      try {
        con.close();
      }
 catch (      SQLException e) {
        log.error("String_Node_Str",e);
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Event Table initialization method, it checks the annotation and do necessary pre configuration tasks.
 * @param tableDefinition      Definition of event table
 * @param executionPlanContext ExecutionPlan related meta information
 */
public void init(TableDefinition tableDefinition,ExecutionPlanContext executionPlanContext){
  this.tableDefinition=tableDefinition;
  Connection con=null;
  int bloomFilterSize=RDBMSEventTableConstants.BLOOM_FILTER_SIZE;
  int bloomFilterHashFunctions=RDBMSEventTableConstants.BLOOM_FILTER_HASH_FUNCTIONS;
  Annotation fromAnnotation=AnnotationHelper.getAnnotation(SiddhiConstants.ANNOTATION_FROM,tableDefinition.getAnnotations());
  String dataSourceName=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_DATASOURCE_NAME);
  String tableName=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_TABLE_NAME);
  DataSource dataSource=executionPlanContext.getSiddhiContext().getSiddhiDataSource(dataSourceName);
  List<Attribute> attributeList=tableDefinition.getAttributeList();
  if (dataSource == null) {
    String jdbcConnectionUrl=fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_JDBC_URL);
    String username=fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_USERNAME);
    String password=fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_PASSWORD);
    String driverName=fromAnnotation.getElement(RDBMSEventTableConstants.EVENT_TABLE_RDBMS_TABLE_DRIVER_NAME);
    List<Element> connectionPropertyElements=null;
    Annotation connectionAnnotation=AnnotationHelper.getAnnotation(RDBMSEventTableConstants.ANNOTATION_CONNECTION,tableDefinition.getAnnotations());
    if (connectionAnnotation != null) {
      connectionPropertyElements=connectionAnnotation.getElements();
    }
    dataSource=PooledDataSource.getPoolDataSource(driverName,jdbcConnectionUrl,username,password,connectionPropertyElements);
  }
  if (dataSource == null || tableName == null) {
    throw new ExecutionPlanCreationException("String_Node_Str");
  }
  String cacheType=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE);
  cacheSizeInString=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE_SIZE);
  String cacheLoadingType=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE_LOADING);
  String cacheValidityInterval=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_CACHE_VALIDITY_PERIOD);
  String bloomsEnabled=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_FILTERS);
  String bloomFilterValidityInterval=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_VALIDITY_PERIOD);
  try {
    this.dbHandler=new DBHandler(dataSource,tableName,attributeList,tableDefinition);
    if ((con=dataSource.getConnection()) == null) {
      throw new ExecutionPlanCreationException("String_Node_Str");
    }
    if (cacheType != null) {
      cachedTable=new CachingTable(cacheType,cacheSizeInString,executionPlanContext,tableDefinition);
      isCachingEnabled=true;
      if (cacheLoadingType != null && cacheLoadingType.equalsIgnoreCase(RDBMSEventTableConstants.EAGER_CACHE_LOADING_ELEMENT)) {
        dbHandler.loadDBCache(cachedTable,cacheSizeInString);
      }
      if (cacheValidityInterval != null) {
        Long cacheTimeInterval=Long.parseLong(cacheValidityInterval);
        Timer timer=new Timer();
        CacheUpdateTask cacheUpdateTask=new CacheUpdateTask();
        timer.schedule(cacheUpdateTask,cacheTimeInterval);
      }
    }
 else     if (bloomsEnabled != null && bloomsEnabled.equalsIgnoreCase("String_Node_Str")) {
      String bloomsFilterSize=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_FILTERS_SIZE);
      String bloomsFilterHash=fromAnnotation.getElement(RDBMSEventTableConstants.ANNOTATION_ELEMENT_BLOOM_FILTERS_HASH);
      if (bloomsFilterSize != null) {
        bloomFilterSize=Integer.parseInt(bloomsFilterSize);
      }
      if (bloomsFilterHash != null) {
        bloomFilterHashFunctions=Integer.parseInt(bloomsFilterHash);
      }
      dbHandler.setBloomFilterProperties(bloomFilterSize,bloomFilterHashFunctions);
      dbHandler.buildBloomFilters();
      if (bloomFilterValidityInterval != null) {
        Long bloomTimeInterval=Long.parseLong(bloomFilterValidityInterval);
        Timer timer=new Timer();
        BloomsUpdateTask bloomsUpdateTask=new BloomsUpdateTask();
        timer.schedule(bloomsUpdateTask,bloomTimeInterval,bloomTimeInterval);
      }
    }
  }
 catch (  SQLException e) {
    throw new ExecutionPlanCreationException("String_Node_Str",e);
  }
 finally {
    if (con != null) {
      try {
        con.close();
      }
 catch (      SQLException e) {
        log.error("String_Node_Str",e);
      }
    }
  }
}