Program: 167563
Project: 167563
Buggy source:
@Override public void handle(String executionId,final Message inputMessage,final IMessageTarget messageTarget){
  componentStatistics.incrementInboundMessages();
  NamedParameterJdbcTemplate template=getJdbcTemplate();
  Map<String,Object> paramMap=new HashMap<String,Object>();
  int inboundRecordCount=1;
  ArrayList<EntityData> payload=null;
  if (!(inputMessage instanceof StartupMessage)) {
    payload=inputMessage.getPayload();
    inboundRecordCount=payload.size();
  }
  for (int i=0; i < inboundRecordCount; i++) {
    if (payload != null && payload.size() > i) {
      setParamsFromInboundMsgAndRec(paramMap,inputMessage,payload.get(i));
    }
 else {
      setParamsFromInboundMsgAndRec(paramMap,inputMessage,null);
    }
    executionTracker.log(executionId,LogLevel.DEBUG,this,"String_Node_Str" + sql);
    template.query(sql,paramMap,new ResultSetExtractor<Object>(){
      @Override public Object extractData(      ResultSet rs) throws SQLException, DataAccessException {
        ResultSetMetaData meta=rs.getMetaData();
        ArrayList<String> attributeIds=null;
        Message message=null;
        int outputRecCount=0;
        while (rs.next()) {
          if (message == null) {
            message=createMessage(inputMessage);
          }
          if (outputRecCount == 0) {
            attributeIds=getAttributeIds(meta,getSqlColumnEntityHints(sql));
          }
          EntityData rowData=new EntityData();
          for (int i=1; i <= meta.getColumnCount(); i++) {
            Object value=JdbcUtils.getResultSetValue(rs,i);
            if (trimColumns && value instanceof String) {
              value=value.toString().trim();
            }
            rowData.put(attributeIds.get(i - 1),value);
          }
          ArrayList<EntityData> payload=message.getPayload();
          payload.add(rowData);
          if (payload.size() >= rowsPerMessage) {
            componentStatistics.incrementOutboundMessages();
            messageTarget.put(message);
            message=null;
          }
          outputRecCount++;
        }
        rs.close();
        if (message != null) {
          componentStatistics.incrementOutboundMessages();
          messageTarget.put(message);
        }
        return null;
      }
    }
);
  }
}

Fixed version (ground truth):
@Override public void handle(String executionId,final Message inputMessage,final IMessageTarget messageTarget){
  componentStatistics.incrementInboundMessages();
  if (resource == null) {
    throw new RuntimeException("String_Node_Str");
  }
  NamedParameterJdbcTemplate template=getJdbcTemplate();
  Map<String,Object> paramMap=new HashMap<String,Object>();
  int inboundRecordCount=1;
  ArrayList<EntityData> payload=null;
  if (!(inputMessage instanceof StartupMessage)) {
    payload=inputMessage.getPayload();
    inboundRecordCount=payload.size();
  }
  for (int i=0; i < inboundRecordCount; i++) {
    if (payload != null && payload.size() > i) {
      setParamsFromInboundMsgAndRec(paramMap,inputMessage,payload.get(i));
    }
 else {
      setParamsFromInboundMsgAndRec(paramMap,inputMessage,null);
    }
    executionTracker.log(executionId,LogLevel.DEBUG,this,"String_Node_Str" + sql);
    template.query(sql,paramMap,new ResultSetExtractor<Object>(){
      @Override public Object extractData(      ResultSet rs) throws SQLException, DataAccessException {
        ResultSetMetaData meta=rs.getMetaData();
        ArrayList<String> attributeIds=null;
        Message message=null;
        int outputRecCount=0;
        while (rs.next()) {
          if (message == null) {
            message=createMessage(inputMessage);
          }
          if (outputRecCount == 0) {
            attributeIds=getAttributeIds(meta,getSqlColumnEntityHints(sql));
          }
          EntityData rowData=new EntityData();
          for (int i=1; i <= meta.getColumnCount(); i++) {
            Object value=JdbcUtils.getResultSetValue(rs,i);
            if (trimColumns && value instanceof String) {
              value=value.toString().trim();
            }
            rowData.put(attributeIds.get(i - 1),value);
          }
          ArrayList<EntityData> payload=message.getPayload();
          payload.add(rowData);
          if (payload.size() >= rowsPerMessage) {
            componentStatistics.incrementOutboundMessages();
            messageTarget.put(message);
            message=null;
          }
          outputRecCount++;
        }
        rs.close();
        if (message != null) {
          componentStatistics.incrementOutboundMessages();
          messageTarget.put(message);
        }
        return null;
      }
    }
);
  }
}