Program: 91130
Project: 91130
Buggy source:
protected void cacheRawNotificationsFromDB(ProcessingFilterType processingFilterType) throws SQLException, IngestException {
  Connection connection=null;
  List<StoredRawNotification<Long,String>> workList=null;
  PreparedStatement statement=null;
  ResultSet resultSet=null;
  PreparedStatement updateStatement=null;
  try {
    connection=getConnection();
    StringBuilder sqlStatementBuilder;
    String selectFilter;
    if (ProcessingFilterType.KNOWN_TYPES.equals(processingFilterType)) {
      sqlStatementBuilder=new StringBuilder(STATEMENT_SELECT_KNOWN_NOTIF);
      selectFilter=ProcessingFilterType.UNKNOWN_TYPES.name();
      workList=rawKnownNotificationCache;
    }
 else {
      sqlStatementBuilder=new StringBuilder(STATEMENT_SELECT_UNKNOWN_NOTIF);
      selectFilter=processingFilterType.name();
      workList=rawUnknownNotificationCache;
    }
    statement=connection.prepareStatement(sqlStatementBuilder.toString());
    statement.setString(1,ProcessingStatus.RAW.name());
    statement.setString(2,selectFilter);
    statement.setInt(3,rawNotificationCacheSize);
    long startTime=0;
    if (plog.isTraceEnabled())     startTime=System.currentTimeMillis();
    resultSet=statement.executeQuery();
    if (plog.isTraceEnabled())     plog.trace("String_Node_Str" + (System.currentTimeMillis() - startTime));
    StringBuilder updateStatementBuilder=new StringBuilder(STATEMENT_UPDATE_RAW_NOTIF_STATUS);
    List<Long> internalIDList=new ArrayList<Long>();
    while (resultSet.next()) {
      long internalID=resultSet.getLong("String_Node_Str");
      internalIDList.add(internalID);
      String notificationTypeString=resultSet.getString("String_Node_Str");
      String notification=resultSet.getString("String_Node_Str");
      BaseDBStoredRawNotification storedRawNotification=new BaseDBStoredRawNotification(internalID,NotificationTypeEnum.valueOf(notificationTypeString),notification);
      workList.add(storedRawNotification);
    }
    int listSize=internalIDList.size();
    if (listSize > 0) {
      for (int i=0; i < listSize - 1; i++) {
        updateStatementBuilder.append("String_Node_Str");
      }
      updateStatementBuilder.append("String_Node_Str");
      updateStatement=connection.prepareStatement(updateStatementBuilder.toString());
      updateStatement.setString(1,ProcessingStatus.PROCESSING.name());
      int index=2;
      for (      Long id : internalIDList) {
        updateStatement.setLong(index++,id);
      }
      if (plog.isTraceEnabled())       startTime=System.currentTimeMillis();
      int result=updateStatement.executeUpdate();
      if (plog.isTraceEnabled())       plog.trace("String_Node_Str" + (System.currentTimeMillis() - startTime));
      if (result != listSize) {
        throw new IngestException("String_Node_Str" + listSize + "String_Node_Str"+ result);
      }
    }
  }
 catch (  SQLException sqle) {
    throw new IngestException(sqle);
  }
 finally {
    if (updateStatement != null) {
      updateStatement.close();
    }
    if (resultSet != null) {
      resultSet.close();
    }
    if (statement != null) {
      statement.close();
    }
    connectionPool.releaseEntry(connection);
  }
}

Fixed version (ground truth):
protected void cacheRawNotificationsFromDB(ProcessingFilterType processingFilterType) throws SQLException, IngestException {
  Connection connection=null;
  List<StoredRawNotification<Long,String>> workList;
  PreparedStatement statement=null;
  ResultSet resultSet=null;
  PreparedStatement updateStatement=null;
  try {
    connection=getConnection();
    StringBuilder sqlStatementBuilder;
    String selectFilter;
    if (ProcessingFilterType.KNOWN_TYPES.equals(processingFilterType)) {
      sqlStatementBuilder=new StringBuilder(STATEMENT_SELECT_KNOWN_NOTIF);
      selectFilter=ProcessingFilterType.UNKNOWN_TYPES.name();
      workList=rawKnownNotificationCache;
    }
 else {
      sqlStatementBuilder=new StringBuilder(STATEMENT_SELECT_UNKNOWN_NOTIF);
      selectFilter=processingFilterType.name();
      workList=rawUnknownNotificationCache;
    }
    statement=connection.prepareStatement(sqlStatementBuilder.toString());
    statement.setString(1,ProcessingStatus.RAW.name());
    statement.setString(2,selectFilter);
    statement.setInt(3,rawNotificationCacheSize);
    long startTime=0;
    if (plog.isTraceEnabled())     startTime=System.currentTimeMillis();
    resultSet=statement.executeQuery();
    if (plog.isTraceEnabled())     plog.trace("String_Node_Str" + (System.currentTimeMillis() - startTime));
    StringBuilder updateStatementBuilder=new StringBuilder(STATEMENT_UPDATE_RAW_NOTIF_STATUS);
    List<Long> internalIDList=new ArrayList<Long>();
    while (resultSet.next()) {
      long internalID=resultSet.getLong("String_Node_Str");
      internalIDList.add(internalID);
      String notificationTypeString=resultSet.getString("String_Node_Str");
      String notification=resultSet.getString("String_Node_Str");
      BaseDBStoredRawNotification storedRawNotification=new BaseDBStoredRawNotification(internalID,NotificationTypeEnum.valueOf(notificationTypeString),notification);
      workList.add(storedRawNotification);
    }
    int listSize=internalIDList.size();
    if (listSize > 0) {
      for (int i=0; i < listSize - 1; i++) {
        updateStatementBuilder.append("String_Node_Str");
      }
      updateStatementBuilder.append("String_Node_Str");
      updateStatement=connection.prepareStatement(updateStatementBuilder.toString());
      updateStatement.setString(1,ProcessingStatus.PROCESSING.name());
      int index=2;
      for (      Long id : internalIDList) {
        updateStatement.setLong(index++,id);
      }
      if (plog.isTraceEnabled())       startTime=System.currentTimeMillis();
      int result=updateStatement.executeUpdate();
      if (plog.isTraceEnabled())       plog.trace("String_Node_Str" + (System.currentTimeMillis() - startTime));
      if (result != listSize) {
        throw new IngestException("String_Node_Str" + listSize + "String_Node_Str"+ result);
      }
    }
  }
 catch (  SQLException sqle) {
    throw new IngestException(sqle);
  }
 finally {
    if (updateStatement != null) {
      updateStatement.close();
    }
    if (resultSet != null) {
      resultSet.close();
    }
    if (statement != null) {
      statement.close();
    }
    connectionPool.releaseEntry(connection);
  }
}