nus-yam/ex-repair huggingface dataset:
Program: 167438
Project: 167438
Buggy source:
private void processInputRow(Document document,EntityData inputRow){
  Set<XmlFormatterEntitySetting> inputEntitySettings=getEntitySettings(inputRow);
  applyAttributeXpath(document,inputRow,attributeSettings);
  for (  XmlFormatterEntitySetting entitySetting : inputEntitySettings) {
    if (entitySetting.isFirstTimeApply()) {
      applyAttributeXpath(document,inputRow,entitySetting.getAttributeSettings());
      entitySetting.setFirstTimeApply(false);
    }
 else {
      Map<Element,Namespace> namespaces=removeNamespaces(templateDocument);
      applyAttributeXpath(templateDocument,inputRow,entitySetting.getAttributeSettings());
      restoreNamespaces(templateDocument,namespaces);
      Element clonedElement=entitySetting.getTemplateElement().clone();
      entitySetting.getParentElement().addContent(clonedElement);
    }
  }
}

Fixed version (ground truth):
private void processInputRow(Document document,EntityData inputRow,Map<String,XmlFormatterEntitySetting> entitySettings,List<XmlFormatterAttributeSetting> attributeSettings){
  Set<XmlFormatterEntitySetting> inputEntitySettings=getEntitySettings(inputRow,entitySettings);
  applyAttributeXpath(document,inputRow,attributeSettings);
  for (  XmlFormatterEntitySetting entitySetting : inputEntitySettings) {
    if (entitySetting.isFirstTimeApply()) {
      applyAttributeXpath(document,inputRow,entitySetting.getAttributeSettings());
      entitySetting.setFirstTimeApply(false);
    }
 else {
      Map<Element,Namespace> namespaces=removeNamespaces(document);
      applyAttributeXpath(document,inputRow,entitySetting.getAttributeSettings());
      restoreNamespaces(document,namespaces);
      Element clonedElement=entitySetting.getTemplateElement().clone();
      entitySetting.getParentElement().addContent(clonedElement);
    }
  }
}
Program: 167439
Project: 167439
Buggy source:
public Group(String name){
  this.name=name;
}

Fixed version (ground truth):
public Group(String name){
  this();
  this.name=name;
}
Program: 167444
Project: 167444
Buggy source:
@Override public void run(){
  try {
    MessageTarget target=new MessageTarget();
    while (running) {
      Message inputMessage=inQueue.take();
      if (inputMessage instanceof ShutdownMessage) {
        ShutdownMessage shutdownMessage=(ShutdownMessage)inputMessage;
        cancelled=shutdownMessage.isCancelled();
        String fromStepId=inputMessage.getHeader().getOriginatingStepId();
        removeSourceStepRuntime(fromStepId);
        if (cancelled || fromStepId == null || sourceStepRuntimes == null || sourceStepRuntimes.size() == 0 || fromStepId.equals(componentContext.getFlowStep().getId())) {
          shutdown(target);
        }
      }
 else {
        try {
          componentContext.getExecutionTracker().beforeHandle(componentContext);
          componentRuntime.handle(inputMessage,target);
        }
 catch (        Exception ex) {
          recordError(ex);
        }
 finally {
          componentContext.getExecutionTracker().afterHandle(componentContext,error);
        }
        if (isStartStep() || (sourceStepRuntimes.size() == 1 && sourceStepRuntimes.get(0).getComponentContext().equals(this.componentContext) && inQueue.size() == 0)) {
          shutdown(target);
        }
      }
    }
  }
 catch (  Exception ex) {
    log.error("String_Node_Str",ex);
    error=ex;
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    MessageTarget target=new MessageTarget();
    while (flowRuntime.isRunning()) {
      Message inputMessage=inQueue.poll(5,TimeUnit.SECONDS);
      if (running) {
        if (inputMessage instanceof ShutdownMessage) {
          ShutdownMessage shutdownMessage=(ShutdownMessage)inputMessage;
          cancelled=shutdownMessage.isCancelled();
          String fromStepId=inputMessage.getHeader().getOriginatingStepId();
          removeSourceStepRuntime(fromStepId);
          if (cancelled || fromStepId == null || sourceStepRuntimes == null || sourceStepRuntimes.size() == 0 || fromStepId.equals(componentContext.getFlowStep().getId())) {
            shutdown(target);
          }
        }
 else         if (inputMessage != null) {
          try {
            componentContext.getExecutionTracker().beforeHandle(componentContext);
            componentRuntime.handle(inputMessage,target);
          }
 catch (          Exception ex) {
            recordError(ex);
          }
 finally {
            componentContext.getExecutionTracker().afterHandle(componentContext,error);
          }
          if (isStartStep() || (sourceStepRuntimes.size() == 1 && sourceStepRuntimes.get(0).getComponentContext().equals(this.componentContext) && inQueue.size() == 0)) {
            shutdown(target);
          }
        }
      }
    }
  }
 catch (  Exception ex) {
    log.error("String_Node_Str",ex);
    error=ex;
  }
}
Program: 167445
Project: 167445
Buggy source:
@Override public void handle(final Message inputMessage,final IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  if (getResourceRuntime() == 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();
    if (payload != null) {
      inboundRecordCount=payload.size();
    }
  }
  for (int i=0; i < inboundRecordCount; i++) {
    if (payload != null && payload.size() > i && payload.get(i) instanceof EntityData) {
      setParamsFromInboundMsgAndRec(paramMap,inputMessage,payload.get(i));
    }
 else {
      setParamsFromInboundMsgAndRec(paramMap,inputMessage,null);
    }
    Message message=null;
    MessageResultSetExtractor messageResultSetExtractor=new MessageResultSetExtractor(inputMessage,messageTarget);
    for (    String sql : sqls) {
      String sqlToExecute=FormatUtils.replaceTokens(sql,context.getFlowParametersAsString(),true);
      log(LogLevel.DEBUG,"String_Node_Str" + sqlToExecute);
      messageResultSetExtractor.setSqlToExecute(sqlToExecute);
      message=template.query(sqlToExecute,paramMap,messageResultSetExtractor);
    }
    if (message != null) {
      message.getHeader().setLastMessage(true);
    }
  }
}

Fixed version (ground truth):
@Override public void handle(final Message inputMessage,final IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  if (getResourceRuntime() == 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();
    if (payload != null) {
      inboundRecordCount=payload.size();
    }
  }
  for (int i=0; i < inboundRecordCount; i++) {
    if (payload != null && payload.size() > i && payload.get(i) instanceof EntityData) {
      setParamsFromInboundMsgAndRec(paramMap,inputMessage,payload.get(i));
    }
 else {
      setParamsFromInboundMsgAndRec(paramMap,inputMessage,null);
    }
    MessageResultSetExtractor messageResultSetExtractor=new MessageResultSetExtractor(inputMessage,messageTarget);
    Message message=null;
    for (    String sql : sqls) {
      String sqlToExecute=FormatUtils.replaceTokens(sql,context.getFlowParametersAsString(),true);
      log(LogLevel.DEBUG,"String_Node_Str" + sqlToExecute);
      messageResultSetExtractor.setSqlToExecute(sqlToExecute);
      message=template.query(sqlToExecute,paramMap,messageResultSetExtractor);
    }
    if (message != null) {
      message.getHeader().setLastMessage(true);
      messageTarget.put(message);
    }
  }
}
Program: 167446
Project: 167446
Buggy source:
@Override public Message extractData(ResultSet rs) throws SQLException, DataAccessException {
  ResultSetMetaData meta=rs.getMetaData();
  Map<Integer,String> columnHints=getSqlColumnEntityHints(sqlToExecute);
  ArrayList<String> attributeIds=getAttributeIds(meta,columnHints);
  while (rs.next()) {
    if (outputRecCount++ % rowsPerMessage == 0 || message == null) {
      message=createMessage(inputMessage);
      getComponentStatistics().incrementOutboundMessages();
      message.getHeader().setSequenceNumber(getComponentStatistics().getNumberOutboundMessages());
      messageTarget.put(message);
    }
    getComponentStatistics().incrementNumberEntitiesProcessed();
    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 (context.getDeployment() != null && context.getDeployment().asLogLevel() == LogLevel.DEBUG) {
      logEntityAttributes(rowData);
    }
  }
  return message;
}

Fixed version (ground truth):
@Override public Message extractData(ResultSet rs) throws SQLException, DataAccessException {
  ResultSetMetaData meta=rs.getMetaData();
  Map<Integer,String> columnHints=getSqlColumnEntityHints(sqlToExecute);
  ArrayList<String> attributeIds=getAttributeIds(meta,columnHints);
  while (rs.next()) {
    if (outputRecCount++ % rowsPerMessage == 0 && message != null) {
      messageTarget.put(message);
      message=null;
    }
    getComponentStatistics().incrementNumberEntitiesProcessed();
    if (message == null) {
      message=createMessage(inputMessage);
      getComponentStatistics().incrementOutboundMessages();
      message.getHeader().setSequenceNumber(getComponentStatistics().getNumberOutboundMessages());
    }
    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 (context.getDeployment() != null && context.getDeployment().asLogLevel() == LogLevel.DEBUG) {
      logEntityAttributes(rowData);
    }
  }
  return message;
}
Program: 167447
Project: 167447
Buggy source:
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  if (inputMessage.getHeader().getOriginatingStepId().equals(sourceStepId)) {
    List<EntityData> datas=inputMessage.getPayload();
    for (    EntityData entityData : datas) {
      lookup.put(entityData.get(keyAttributeId),entityData.get(valueAttributeId));
    }
    lookupInitialized=inputMessage.getHeader().isLastMessage();
    if (lookupInitialized) {
      Iterator<Message> messages=queuedWhileWaitingForLookup.iterator();
      while (messages.hasNext()) {
        Message message=messages.next();
        enhanceAndSend(message,messageTarget);
      }
    }
  }
 else   if (!lookupInitialized) {
    queuedWhileWaitingForLookup.add(inputMessage);
  }
 else   if (lookupInitialized) {
    enhanceAndSend(inputMessage,messageTarget);
  }
}

Fixed version (ground truth):
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  if (sourceStepId.equals(inputMessage.getHeader().getOriginatingStepId())) {
    List<EntityData> datas=inputMessage.getPayload();
    for (    EntityData entityData : datas) {
      lookup.put(entityData.get(keyAttributeId),entityData.get(valueAttributeId));
    }
    lookupInitialized=inputMessage.getHeader().isLastMessage();
    if (lookupInitialized) {
      Iterator<Message> messages=queuedWhileWaitingForLookup.iterator();
      while (messages.hasNext()) {
        Message message=messages.next();
        enhanceAndSend(message,messageTarget);
      }
    }
  }
 else   if (!lookupInitialized) {
    queuedWhileWaitingForLookup.add(inputMessage);
  }
 else   if (lookupInitialized) {
    enhanceAndSend(inputMessage,messageTarget);
  }
}
Program: 167449
Project: 167449
Buggy source:
public void refresh(){
  for (  IDb db : dbs) {
    try {
      BasicDataSource ds=db.getPlatform().getDataSource();
      ds.close();
    }
 catch (    SQLException e) {
    }
  }
  dbs.clear();
  dbs.add(new IDb(){
    @Override public IDatabasePlatform getPlatform(){
      return platform;
    }
    @Override public String getName(){
      return "String_Node_Str";
    }
  }
);
  IAgentManager agentManager=context.getAgentManager();
  Collection<Agent> agents=agentManager.getAvailableAgents();
  for (  Agent agent : agents) {
    AgentRuntime runtime=agentManager.getAgentRuntime(agent);
    Collection<IResourceRuntime> resources=runtime.getDeployedResources();
    for (    IResourceRuntime iResource : resources) {
      if (iResource.getResource().getType().equals(Datasource.TYPE)) {
        DbResource db=new DbResource(agent,iResource);
        dbs.add(db);
      }
    }
  }
  Collections.sort(dbs,new Comparator<IDb>(){
    @Override public int compare(    IDb o1,    IDb o2){
      return o1.getName().compareTo(o2.getName());
    }
  }
);
}

Fixed version (ground truth):
public void refresh(){
  for (  IDb db : dbs) {
    if (db instanceof DbResource) {
      ((DbResource)db).close();
    }
  }
  dbs.clear();
  dbs.add(new IDb(){
    @Override public IDatabasePlatform getPlatform(){
      return platform;
    }
    @Override public String getName(){
      return "String_Node_Str";
    }
  }
);
  IAgentManager agentManager=context.getAgentManager();
  Collection<Agent> agents=agentManager.getAvailableAgents();
  for (  Agent agent : agents) {
    AgentRuntime runtime=agentManager.getAgentRuntime(agent);
    Collection<IResourceRuntime> resources=runtime.getDeployedResources();
    for (    IResourceRuntime iResource : resources) {
      if (iResource.getResource().getType().equals(Datasource.TYPE)) {
        DbResource db=new DbResource(agent,iResource);
        dbs.add(db);
      }
    }
  }
  Collections.sort(dbs,new Comparator<IDb>(){
    @Override public int compare(    IDb o1,    IDb o2){
      return o1.getName().compareTo(o2.getName());
    }
  }
);
}
Program: 167450
Project: 167450
Buggy source:
protected void archive(String archivePath){
  String path=getResourceRuntime().getResourceRuntimeSettings().get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  File srcFile : filesSent) {
    try {
      log(LogLevel.INFO,"String_Node_Str",srcFile.getAbsolutePath(),destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(srcFile,destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}

Fixed version (ground truth):
protected void archive(String archivePath){
  String path=getResourceRuntime().getResourceRuntimeSettings().get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  File srcFile : filesSent) {
    try {
      File targetFile=new File(destDir,srcFile.getName());
      if (targetFile.exists()) {
        info("String_Node_Str");
        FileUtils.deleteQuietly(targetFile);
      }
      log(LogLevel.INFO,"String_Node_Str",srcFile.getAbsolutePath(),destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(srcFile,destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}
Program: 167451
Project: 167451
Buggy source:
protected String getSampleXml(){
  Model model=component.getInputModel();
  String batchXml="String_Node_Str";
  if (model != null) {
    ArrayList<EntityData> inputRows=new ArrayList<EntityData>();
    for (    ModelEntity entity : getMatchingEntities(filterField.getValue())) {
      for (      ModelAttribute attr : entity.getModelAttributes()) {
        EntityData data=new EntityData();
        DataType type=attr.getDataType();
        String value=null;
        if (type.isString()) {
          value=RandomStringUtils.randomAlphanumeric(10);
        }
 else         if (type.isNumeric()) {
          value=String.valueOf(RandomUtils.nextInt());
        }
 else         if (type.isTimestamp()) {
          value=new Date(RandomUtils.nextLong()).toString();
        }
 else         if (type.isBoolean()) {
          value=Boolean.toString(RandomUtils.nextBoolean());
        }
        data.put(attr.getId(),value);
        inputRows.add(data);
      }
    }
    batchXml=XsltProcessor.getBatchXml(model,inputRows,false);
  }
  return batchXml;
}

Fixed version (ground truth):
protected String getSampleXml(){
  Model model=component.getInputModel();
  String batchXml="String_Node_Str";
  if (model != null) {
    ArrayList<EntityData> inputRows=new ArrayList<EntityData>();
    for (    ModelEntity entity : getMatchingEntities(filterField.getValue())) {
      for (      ModelAttribute attr : entity.getModelAttributes()) {
        EntityData data=new EntityData();
        DataType type=attr.getDataType();
        Object value=null;
        if (type.isString()) {
          value=RandomStringUtils.randomAlphanumeric(10);
        }
 else         if (type.isNumeric()) {
          value=String.valueOf(RandomUtils.nextInt());
        }
 else         if (type.isTimestamp()) {
          value=new Date(RandomUtils.nextInt(Integer.MAX_VALUE) * 1000l);
        }
 else         if (type.isBoolean()) {
          value=Boolean.toString(RandomUtils.nextBoolean());
        }
        data.put(attr.getId(),value);
        inputRows.add(data);
      }
    }
    batchXml=XsltProcessor.getBatchXml(model,inputRows,false);
  }
  return batchXml;
}
Program: 167452
Project: 167452
Buggy source:
protected List<Agent> findAgents(Map<String,Object> params,Folder folder){
  List<Agent> list=persistenceManager.find(Agent.class,params,null,null,tableName(Agent.class));
  Map<String,Folder> folderMapById=new HashMap<String,Folder>();
  if (folder != null) {
    folderMapById.put(folder.getId(),folder);
  }
 else {
    folderMapById=foldersById(null,FolderType.AGENT);
  }
  for (  Agent agent : list) {
    agent.setFolder(folderMapById.get(agent.getFolderId()));
    refreshAgentSettings(agent);
    refreshAgentResourceSettings(agent);
    refreshAgentDeployments(agent);
  }
  Collections.sort(list,new Comparator<Agent>(){
    @Override public int compare(    Agent o1,    Agent o2){
      return o1.getCreateTime().compareTo(o2.getCreateTime());
    }
  }
);
  return list;
}

Fixed version (ground truth):
protected List<Agent> findAgents(Map<String,Object> params,Folder folder){
  List<Agent> list=persistenceManager.find(Agent.class,params,null,null,tableName(Agent.class));
  Map<String,Folder> folderMapById=new HashMap<String,Folder>();
  if (folder != null) {
    folderMapById.put(folder.getId(),folder);
  }
 else {
    folderMapById=foldersById(null,FolderType.AGENT);
  }
  for (  Agent agent : list) {
    refreshAgentSettings(agent);
    refreshAgentResourceSettings(agent);
    refreshAgentDeployments(agent);
    agent.setFolder(folderMapById.get(agent.getFolderId()));
  }
  Collections.sort(list,new Comparator<Agent>(){
    @Override public int compare(    Agent o1,    Agent o2){
      return o1.getCreateTime().compareTo(o2.getCreateTime());
    }
  }
);
  return list;
}
Program: 167453
Project: 167453
Buggy source:
@Override public void handle(final Message inputMessage,final IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  if (error == null || !stopProcessingOnError) {
    if (getResourceRuntime() == null) {
      throw new RuntimeException("String_Node_Str");
    }
    ArrayList<EntityData> inputRows=inputMessage.getPayload();
    if (inputRows == null) {
      return;
    }
    ISqlTransaction transaction=platform.getSqlTemplate().startSqlTransaction();
    transaction.setInBatchMode(batchMode);
    try {
      write(transaction,inputRows);
      transaction.commit();
    }
 catch (    Throwable ex) {
      error=ex;
      transaction.rollback();
      if (ex instanceof RuntimeException) {
        throw (RuntimeException)ex;
      }
 else {
        throw new RuntimeException(ex);
      }
    }
 finally {
      transaction.close();
    }
  }
}

Fixed version (ground truth):
@Override public void handle(final Message inputMessage,final IMessageTarget messageTarget){
  lastPreparedDml=null;
  getComponentStatistics().incrementInboundMessages();
  if (error == null || !stopProcessingOnError) {
    if (getResourceRuntime() == null) {
      throw new RuntimeException("String_Node_Str");
    }
    ArrayList<EntityData> inputRows=inputMessage.getPayload();
    if (inputRows == null) {
      return;
    }
    ISqlTransaction transaction=platform.getSqlTemplate().startSqlTransaction();
    transaction.setInBatchMode(batchMode);
    try {
      write(transaction,inputRows);
      transaction.commit();
    }
 catch (    Throwable ex) {
      error=ex;
      transaction.rollback();
      if (ex instanceof RuntimeException) {
        throw (RuntimeException)ex;
      }
 else {
        throw new RuntimeException(ex);
      }
    }
 finally {
      transaction.close();
    }
  }
}
Program: 167454
Project: 167454
Buggy source:
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  if (inputMessage.getHeader().getOriginatingStepId().equals(sourceStepId)) {
    List<EntityData> datas=inputMessage.getPayload();
    multipliers.addAll(datas);
    multipliersInitialized=inputMessage.getHeader().isLastMessage();
    Iterator<Message> messages=queuedWhileWaitingForMultiplier.iterator();
    while (messages.hasNext()) {
      Message message=messages.next();
      multiply(message,messageTarget);
    }
  }
 else   if (!multipliersInitialized) {
    queuedWhileWaitingForMultiplier.add(inputMessage);
  }
 else   if (multipliersInitialized) {
    multiply(inputMessage,messageTarget);
  }
}

Fixed version (ground truth):
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  if (inputMessage.getHeader().getOriginatingStepId().equals(sourceStepId)) {
    List<EntityData> datas=inputMessage.getPayload();
    multipliers.addAll(datas);
    multipliersInitialized=inputMessage.getHeader().isLastMessage();
    if (multipliersInitialized) {
      Iterator<Message> messages=queuedWhileWaitingForMultiplier.iterator();
      while (messages.hasNext()) {
        Message message=messages.next();
        multiply(message,messageTarget);
      }
    }
  }
 else   if (!multipliersInitialized) {
    queuedWhileWaitingForMultiplier.add(inputMessage);
  }
 else   if (multipliersInitialized) {
    multiply(inputMessage,messageTarget);
  }
}
Program: 167455
Project: 167455
Buggy source:
public MessageScriptHelper(ComponentContext context,ComponentStatistics componentStatistics){
  this.context=context;
  this.resource=context.getResourceRuntime();
  this.componentStatistics=componentStatistics;
  this.flow=context.getFlow();
  this.flowStep=context.getFlowStep();
}

Fixed version (ground truth):
public MessageScriptHelper(IComponentRuntime component){
  this.context=component.getComponentContext();
  this.resource=context.getResourceRuntime();
  this.componentStatistics=context.getComponentStatistics();
  this.flow=context.getFlow();
  this.flowStep=context.getFlowStep();
}
Program: 167456
Project: 167456
Buggy source:
private EntityData processInputRow(String inputRow) throws IOException {
  CsvReader csvReader=new CsvReader(new ByteArrayInputStream(inputRow.getBytes()),Charset.forName(encoding));
  csvReader.setDelimiter(delimiter.charAt(0));
  if (isNotBlank(quoteCharacter)) {
    csvReader.setTextQualifier(quoteCharacter.charAt(0));
    csvReader.setUseTextQualifier(true);
  }
  if (csvReader.readRecord()) {
    EntityData data=new EntityData();
    if (attributes.size() > 0) {
      for (      AttributeFormat attribute : attributes) {
        Object value=csvReader.get(attribute.getOrdinal() - 1);
        if (isNotBlank(attribute.getFormatFunction())) {
          value=ModelAttributeScriptHelper.eval(attribute.getAttribute(),value,attribute.getEntity(),data,attribute.getFormatFunction());
        }
        data.put(attribute.getAttributeId(),value);
      }
    }
 else {
      Model model=getComponent().getOutputModel();
      List<ModelEntity> entities=model.getModelEntities();
      int index=0;
      for (      ModelEntity modelEntity : entities) {
        List<ModelAttribute> attributes=modelEntity.getModelAttributes();
        for (        ModelAttribute modelAttribute : attributes) {
          data.put(modelAttribute.getId(),csvReader.get(index));
        }
      }
    }
    return data;
  }
  return null;
}

Fixed version (ground truth):
private EntityData processInputRow(String inputRow) throws IOException {
  CsvReader csvReader=new CsvReader(new ByteArrayInputStream(inputRow.getBytes()),Charset.forName(encoding));
  csvReader.setDelimiter(delimiter.charAt(0));
  if (isNotBlank(quoteCharacter)) {
    csvReader.setTextQualifier(quoteCharacter.charAt(0));
    csvReader.setUseTextQualifier(true);
  }
 else {
    csvReader.setUseTextQualifier(false);
  }
  if (csvReader.readRecord()) {
    EntityData data=new EntityData();
    if (attributes.size() > 0) {
      for (      AttributeFormat attribute : attributes) {
        Object value=csvReader.get(attribute.getOrdinal() - 1);
        if (isNotBlank(attribute.getFormatFunction())) {
          value=ModelAttributeScriptHelper.eval(attribute.getAttribute(),value,attribute.getEntity(),data,attribute.getFormatFunction());
        }
        data.put(attribute.getAttributeId(),value);
      }
    }
 else {
      Model model=getComponent().getOutputModel();
      List<ModelEntity> entities=model.getModelEntities();
      int index=0;
      for (      ModelEntity modelEntity : entities) {
        List<ModelAttribute> attributes=modelEntity.getModelAttributes();
        for (        ModelAttribute modelAttribute : attributes) {
          data.put(modelAttribute.getId(),csvReader.get(index));
        }
      }
    }
    return data;
  }
  return null;
}
Program: 167457
Project: 167457
Buggy source:
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  Resource resource=getComponent().getResource();
  String path=resource.get(LocalFile.LOCALFILE_PATH);
  if (useTriggerFile) {
    File triggerFile=new File(path,triggerFilePath);
    if (triggerFile.exists()) {
      pollForFiles(path,inputMessage,messageTarget);
      FileUtils.deleteQuietly(triggerFile);
    }
 else     if (cancelOnNoFiles) {
      getComponentStatistics().incrementOutboundMessages();
      messageTarget.put(new ShutdownMessage(getFlowStepId(),true));
    }
  }
 else {
    pollForFiles(path,inputMessage,messageTarget);
  }
}

Fixed version (ground truth):
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  IResourceRuntime resourceRuntime=getResourceRuntime();
  String path=resourceRuntime.getAgentOverrides().get(LocalFile.LOCALFILE_PATH);
  if (useTriggerFile) {
    File triggerFile=new File(path,triggerFilePath);
    if (triggerFile.exists()) {
      pollForFiles(path,inputMessage,messageTarget);
      FileUtils.deleteQuietly(triggerFile);
    }
 else     if (cancelOnNoFiles) {
      getComponentStatistics().incrementOutboundMessages();
      messageTarget.put(new ShutdownMessage(getFlowStepId(),true));
    }
  }
 else {
    pollForFiles(path,inputMessage,messageTarget);
  }
}
Program: 167458
Project: 167458
Buggy source:
protected void archive(String archivePath){
  Resource resource=getComponent().getResource();
  String path=resource.get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  File srcFile : filesSent) {
    try {
      log(LogLevel.INFO,"String_Node_Str",srcFile.getAbsolutePath(),destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(srcFile,destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}

Fixed version (ground truth):
protected void archive(String archivePath){
  String path=getResourceRuntime().getAgentOverrides().get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  File srcFile : filesSent) {
    try {
      log(LogLevel.INFO,"String_Node_Str",srcFile.getAbsolutePath(),destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(srcFile,destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}
Program: 167459
Project: 167459
Buggy source:
protected void pollForFiles(String path,Message inputMessage,IMessageTarget messageTarget){
  File pathDir=new File(path);
  ArrayList<String> filePaths=new ArrayList<String>();
  String[] includes=StringUtils.isNotBlank(filePattern) ? filePattern.split("String_Node_Str") : new String[]{"String_Node_Str"};
  DirectoryScanner scanner=new DirectoryScanner();
  scanner.setIncludes(includes);
  scanner.setBasedir(pathDir);
  scanner.setCaseSensitive(false);
  scanner.scan();
  String[] files=scanner.getIncludedFiles();
  if (files.length > 0) {
    for (    String filePath : files) {
      File file=new File(path,filePath);
      filesSent.add(file);
      log(LogLevel.INFO,"String_Node_Str" + file.getAbsolutePath());
      getComponentStatistics().incrementNumberEntitiesProcessed();
      filePaths.add(file.getAbsolutePath());
    }
    getComponentStatistics().incrementOutboundMessages();
    messageTarget.put(inputMessage.copy(getFlowStepId(),filePaths));
  }
 else   if (cancelOnNoFiles) {
    getComponentStatistics().incrementOutboundMessages();
    messageTarget.put(new ShutdownMessage(getFlowStepId(),true));
  }
}

Fixed version (ground truth):
protected void pollForFiles(String path,Message inputMessage,IMessageTarget messageTarget){
  File pathDir=new File(path);
  ArrayList<String> filePaths=new ArrayList<String>();
  ArrayList<File> fileReferences=new ArrayList<File>();
  String[] includes=StringUtils.isNotBlank(filePattern) ? filePattern.split("String_Node_Str") : new String[]{"String_Node_Str"};
  DirectoryScanner scanner=new DirectoryScanner();
  scanner.setIncludes(includes);
  scanner.setBasedir(pathDir);
  scanner.setCaseSensitive(false);
  scanner.scan();
  String[] files=scanner.getIncludedFiles();
  if (files.length > 0) {
    for (    String filePath : files) {
      File file=new File(path,filePath);
      filesSent.add(file);
      fileReferences.add(file);
    }
    Collections.sort(fileReferences,new Comparator<File>(){
      @Override public int compare(      File o1,      File o2){
        return new Long(o1.lastModified()).compareTo(new Long(o2.lastModified()));
      }
    }
);
    for (    File file : fileReferences) {
      log(LogLevel.INFO,"String_Node_Str" + file.getAbsolutePath());
      getComponentStatistics().incrementNumberEntitiesProcessed();
      filePaths.add(file.getAbsolutePath());
    }
    getComponentStatistics().incrementOutboundMessages();
    messageTarget.put(inputMessage.copy(getFlowStepId(),filePaths));
  }
 else   if (cancelOnNoFiles) {
    getComponentStatistics().incrementOutboundMessages();
    messageTarget.put(new ShutdownMessage(getFlowStepId(),true));
  }
}
Program: 167461
Project: 167461
Buggy source:
protected void archive(String archivePath){
  Resource resource=getComponent().getResource();
  String path=resource.get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  String srcFile : filesRead) {
    try {
      log(LogLevel.INFO,"String_Node_Str",srcFile,destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(new File(path,srcFile),destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}

Fixed version (ground truth):
protected void archive(String archivePath){
  String path=getResourceRuntime().getAgentOverrides().get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  String srcFile : filesRead) {
    try {
      log(LogLevel.INFO,"String_Node_Str",srcFile,destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(new File(path,srcFile),destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}
Program: 167463
Project: 167463
Buggy source:
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  ArrayList<String> inputRows=inputMessage.getPayload();
  ArrayList<EntityData> outputPayload=new ArrayList<EntityData>();
  Message outputMessage=inputMessage.copy(getFlowStepId(),outputPayload);
  int headerRowsToSkip=numberOfHeaderLinesToSkip;
  try {
    int rowCount=0;
    for (    String inputRow : inputRows) {
      if (headerRowsToSkip == 0) {
        if (rowCount + numberOfFooterLinesToSkip < inputRows.size()) {
          EntityData data=processInputRow(inputRow);
          if (data != null) {
            outputPayload.add(data);
          }
        }
      }
 else {
        headerRowsToSkip--;
      }
      rowCount++;
    }
  }
 catch (  IOException e) {
    throw new IoException(e);
  }
  getComponentStatistics().incrementOutboundMessages();
  outputMessage.getHeader().setSequenceNumber(getComponentStatistics().getNumberOutboundMessages());
  outputMessage.getHeader().setLastMessage(inputMessage.getHeader().isLastMessage());
  messageTarget.put(outputMessage);
}

Fixed version (ground truth):
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  ArrayList<String> inputRows=inputMessage.getPayload();
  ArrayList<EntityData> outputPayload=new ArrayList<EntityData>();
  Message outputMessage=inputMessage.copy(getFlowStepId(),outputPayload);
  int headerRowsToSkip=numberOfHeaderLinesToSkip;
  try {
    int rowCount=0;
    for (    String inputRow : inputRows) {
      if (headerRowsToSkip == 0) {
        if (!inputMessage.getHeader().isLastMessage() || (rowCount + numberOfFooterLinesToSkip < inputRows.size())) {
          EntityData data=processInputRow(inputRow);
          if (data != null) {
            getComponentStatistics().incrementNumberEntitiesProcessed();
            outputPayload.add(data);
          }
        }
      }
 else {
        headerRowsToSkip--;
      }
      rowCount++;
    }
  }
 catch (  IOException e) {
    throw new IoException(e);
  }
  getComponentStatistics().incrementOutboundMessages();
  outputMessage.getHeader().setSequenceNumber(getComponentStatistics().getNumberOutboundMessages());
  outputMessage.getHeader().setLastMessage(inputMessage.getHeader().isLastMessage());
  messageTarget.put(outputMessage);
}
Program: 167464
Project: 167464
Buggy source:
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  IResourceRuntime resourceRuntime=getResourceRuntime();
  String path=resourceRuntime.getAgentOverrides().get(LocalFile.LOCALFILE_PATH);
  if (useTriggerFile) {
    File triggerFile=new File(path,triggerFilePath);
    if (triggerFile.exists()) {
      pollForFiles(path,inputMessage,messageTarget);
      FileUtils.deleteQuietly(triggerFile);
    }
 else     if (cancelOnNoFiles) {
      getComponentStatistics().incrementOutboundMessages();
      messageTarget.put(new ShutdownMessage(getFlowStepId(),true));
    }
  }
 else {
    pollForFiles(path,inputMessage,messageTarget);
  }
}

Fixed version (ground truth):
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  IResourceRuntime resourceRuntime=getResourceRuntime();
  String path=resourceRuntime.getResourceRuntimeSettings().get(LocalFile.LOCALFILE_PATH);
  if (useTriggerFile) {
    File triggerFile=new File(path,triggerFilePath);
    if (triggerFile.exists()) {
      pollForFiles(path,inputMessage,messageTarget);
      FileUtils.deleteQuietly(triggerFile);
    }
 else     if (cancelOnNoFiles) {
      getComponentStatistics().incrementOutboundMessages();
      messageTarget.put(new ShutdownMessage(getFlowStepId(),true));
    }
  }
 else {
    pollForFiles(path,inputMessage,messageTarget);
  }
}
Program: 167465
Project: 167465
Buggy source:
protected void archive(String archivePath){
  String path=getResourceRuntime().getAgentOverrides().get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  File srcFile : filesSent) {
    try {
      log(LogLevel.INFO,"String_Node_Str",srcFile.getAbsolutePath(),destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(srcFile,destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}

Fixed version (ground truth):
protected void archive(String archivePath){
  String path=getResourceRuntime().getResourceRuntimeSettings().get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  File srcFile : filesSent) {
    try {
      log(LogLevel.INFO,"String_Node_Str",srcFile.getAbsolutePath(),destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(srcFile,destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}
Program: 167467
Project: 167467
Buggy source:
protected void archive(String archivePath){
  String path=getResourceRuntime().getAgentOverrides().get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  String srcFile : filesRead) {
    try {
      log(LogLevel.INFO,"String_Node_Str",srcFile,destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(new File(path,srcFile),destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}

Fixed version (ground truth):
protected void archive(String archivePath){
  String path=getResourceRuntime().getResourceRuntimeSettings().get(LocalFile.LOCALFILE_PATH);
  File destDir=new File(path,archivePath);
  for (  String srcFile : filesRead) {
    try {
      log(LogLevel.INFO,"String_Node_Str",srcFile,destDir.getAbsolutePath());
      FileUtils.moveFileToDirectory(new File(path,srcFile),destDir,true);
    }
 catch (    IOException e) {
      throw new IoException(e);
    }
  }
}
Program: 167468
Project: 167468
Buggy source:
private void initAndSendMessage(ArrayList<String> payload,Message inputMessage,IMessageTarget messageTarget,int numberMessages,boolean lastMessage){
  numberMessages++;
  Message message=new Message(getFlowStepId());
  message.getHeader().setSequenceNumber(numberMessages);
  message.getHeader().setLastMessage(lastMessage);
  message.setPayload(payload);
  getComponentStatistics().incrementOutboundMessages();
  messageTarget.put(message);
}

Fixed version (ground truth):
private void initAndSendMessage(ArrayList<String> payload,Message inputMessage,IMessageTarget messageTarget,int numberMessages,boolean lastMessage){
  Message message=new Message(getFlowStepId());
  message.getHeader().setSequenceNumber(numberMessages);
  message.getHeader().setLastMessage(lastMessage);
  message.setPayload(payload);
  getComponentStatistics().incrementOutboundMessages();
  messageTarget.put(message);
}
Program: 167469
Project: 167469
Buggy source:
private void convertAttributeSettingsToAttributeFormat(){
  List<ComponentAttributeSetting> attributeSettings=getComponent().getAttributeSettings();
  Map<String,AttributeFormat> formats=new HashMap<String,DelimitedParser.AttributeFormat>();
  for (  ComponentAttributeSetting attributeSetting : attributeSettings) {
    AttributeFormat format=formats.get(attributeSetting.getAttributeId());
    if (format == null) {
      Model inputModel=getComponent().getOutputModel();
      ModelAttribute attribute=inputModel.getAttributeById(attributeSetting.getAttributeId());
      ModelEntity entity=inputModel.getEntityById(attribute.getEntityId());
      if (attribute != null) {
        format=new AttributeFormat(attributeSetting.getAttributeId(),entity,attribute);
        formats.put(attributeSetting.getAttributeId(),format);
      }
    }
    if (format != null) {
      if (attributeSetting.getName().equalsIgnoreCase(DELIMITED_FORMATTER_ATTRIBUTE_ORDINAL)) {
        format.setOrdinal(Integer.parseInt(attributeSetting.getValue()));
      }
 else       if (attributeSetting.getName().equalsIgnoreCase(DELIMITED_FORMATTER_ATTRIBUTE_FORMAT_FUNCTION)) {
        format.setFormatFunction(attributeSetting.getValue());
      }
    }
  }
  attributes.addAll(formats.values());
  Collections.sort(attributes,new Comparator<AttributeFormat>(){
    @Override public int compare(    AttributeFormat ordinal1,    AttributeFormat ordinal2){
      return ordinal1.getOrdinal() - ordinal2.getOrdinal();
    }
  }
);
}

Fixed version (ground truth):
private void convertAttributeSettingsToAttributeFormat(){
  List<ComponentAttributeSetting> attributeSettings=getComponent().getAttributeSettings();
  Map<String,AttributeFormat> formats=new HashMap<String,DelimitedParser.AttributeFormat>();
  for (  ComponentAttributeSetting attributeSetting : attributeSettings) {
    AttributeFormat format=formats.get(attributeSetting.getAttributeId());
    if (format == null) {
      Model inputModel=getComponent().getOutputModel();
      ModelAttribute attribute=inputModel.getAttributeById(attributeSetting.getAttributeId());
      if (attribute != null) {
        ModelEntity entity=inputModel.getEntityById(attribute.getEntityId());
        format=new AttributeFormat(attributeSetting.getAttributeId(),entity,attribute);
        formats.put(attributeSetting.getAttributeId(),format);
      }
    }
    if (format != null) {
      if (attributeSetting.getName().equalsIgnoreCase(DELIMITED_FORMATTER_ATTRIBUTE_ORDINAL)) {
        format.setOrdinal(Integer.parseInt(attributeSetting.getValue()));
      }
 else       if (attributeSetting.getName().equalsIgnoreCase(DELIMITED_FORMATTER_ATTRIBUTE_FORMAT_FUNCTION)) {
        format.setFormatFunction(attributeSetting.getValue());
      }
    }
  }
  attributes.addAll(formats.values());
  Collections.sort(attributes,new Comparator<AttributeFormat>(){
    @Override public int compare(    AttributeFormat ordinal1,    AttributeFormat ordinal2){
      return ordinal1.getOrdinal() - ordinal2.getOrdinal();
    }
  }
);
}
Program: 167470
Project: 167470
Buggy source:
protected void addComponent(int x,int y,Component component){
  component.setName(component.getType() + "String_Node_Str" + (countComponentsOfType(component.getType()) + 1));
  component.setProjectVersionId(flow.getProjectVersionId());
  FlowStep flowStep=new FlowStep(component);
  flowStep.setX(x);
  flowStep.setY(y);
  flowStep.setFlowId(flow.getId());
  flow.getFlowSteps().add(flowStep);
  context.getConfigurationService().save(flowStep);
  redrawFlow();
  propertySheet.setSource(component);
  projectNavigator.refresh();
  projectNavigator.select(flowStep);
}

Fixed version (ground truth):
protected void addComponent(int x,int y,Component component){
  component.setName(component.getType() + "String_Node_Str" + (countComponentsOfType(component.getType()) + 1));
  component.setProjectVersionId(flow.getProjectVersionId());
  FlowStep flowStep=new FlowStep(component);
  flowStep.setX(x);
  flowStep.setY(y);
  flowStep.setFlowId(flow.getId());
  flow.getFlowSteps().add(flowStep);
  context.getConfigurationService().save(flowStep);
  selected=flowStep;
  redrawFlow();
  propertySheet.setSource(flowStep);
  projectNavigator.refresh();
}
Program: 167471
Project: 167471
Buggy source:
protected void redrawFlow(){
  delButton.setEnabled(false);
  if (diagram != null) {
    diagramLayout.removeComponent(diagram);
  }
  diagram=new Diagram();
  if (selected != null && selected instanceof FlowStep) {
    diagram.setSelectedNodeId(((FlowStep)selected).getId());
  }
  diagram.setSizeFull();
  diagram.addListener(new DiagramChangedListener());
  diagramLayout.addComponent(diagram);
  diagram.setNodes(getNodes());
}

Fixed version (ground truth):
protected void redrawFlow(){
  if (diagram != null) {
    diagramLayout.removeComponent(diagram);
  }
  diagram=new Diagram();
  if (selected != null && selected instanceof FlowStep) {
    diagram.setSelectedNodeId(((FlowStep)selected).getId());
    delButton.setEnabled(true);
  }
 else {
    delButton.setEnabled(false);
  }
  diagram.setSizeFull();
  diagram.addListener(new DiagramChangedListener());
  diagramLayout.addComponent(diagram);
  diagram.setNodes(getNodes());
}
Program: 167472
Project: 167472
Buggy source:
private Map<Element,Namespace> removeNamespaces(Document document){
  Map<Element,Namespace> namespaces=new HashMap<Element,Namespace>();
  if (ignoreNamespace) {
    document.getRootElement().setNamespace(null);
    for (    Element el : document.getRootElement().getDescendants(new ElementFilter())) {
      Namespace nsp=el.getNamespace();
      if (nsp != null) {
        el.setNamespace(null);
        namespaces.put(el,nsp);
      }
    }
  }
  return namespaces;
}

Fixed version (ground truth):
private Map<Element,Namespace> removeNamespaces(Document document){
  Map<Element,Namespace> namespaces=new HashMap<Element,Namespace>();
  if (ignoreNamespace) {
    namespaces.put(document.getRootElement(),document.getRootElement().getNamespace());
    document.getRootElement().setNamespace(null);
    for (    Element el : document.getRootElement().getDescendants(new ElementFilter())) {
      Namespace nsp=el.getNamespace();
      if (nsp != null) {
        el.setNamespace(null);
        namespaces.put(el,nsp);
      }
    }
  }
  return namespaces;
}
Program: 167473
Project: 167473
Buggy source:
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  ArrayList<EntityData> inputRows=inputMessage.getPayload();
  Message outputMessage=new Message(getFlowStepId());
  ArrayList<String> outputPayload=new ArrayList<String>();
  Document document=templateDocument.clone();
  Namespace rootNamespace=document.getRootElement().getNamespace();
  Map<Element,Namespace> namespaces=removeNamespaces(document);
  for (  XmlFormatterEntitySetting entitySetting : entitySettings.values()) {
    List<Element> matches=entitySetting.getExpression().evaluate(document.getRootElement());
    for (    Element element : matches) {
      entitySetting.setParentElement(element.getParentElement());
    }
  }
  for (  EntityData inputRow : inputRows) {
    processInputRow(document,inputRow);
  }
  restoreNamespaces(document,namespaces);
  document.getRootElement().setNamespace(rootNamespace);
  XMLOutputter xmlOutputter=new XMLOutputter();
  xmlOutputter.setFormat(Format.getPrettyFormat());
  outputPayload.add(xmlOutputter.outputString(document));
  outputMessage.setPayload(outputPayload);
  log(LogLevel.INFO,outputPayload.toString());
  getComponentStatistics().incrementOutboundMessages();
  outputMessage.getHeader().setSequenceNumber(getComponentStatistics().getNumberOutboundMessages());
  outputMessage.getHeader().setLastMessage(inputMessage.getHeader().isLastMessage());
  messageTarget.put(outputMessage);
}

Fixed version (ground truth):
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  getComponentStatistics().incrementInboundMessages();
  ArrayList<EntityData> inputRows=inputMessage.getPayload();
  Message outputMessage=new Message(getFlowStepId());
  ArrayList<String> outputPayload=new ArrayList<String>();
  Document document=templateDocument.clone();
  Map<Element,Namespace> namespaces=removeNamespaces(document);
  for (  XmlFormatterEntitySetting entitySetting : entitySettings.values()) {
    List<Element> matches=entitySetting.getExpression().evaluate(document.getRootElement());
    for (    Element element : matches) {
      entitySetting.setParentElement(element.getParentElement());
    }
  }
  for (  EntityData inputRow : inputRows) {
    processInputRow(document,inputRow);
  }
  restoreNamespaces(document,namespaces);
  XMLOutputter xmlOutputter=new XMLOutputter();
  xmlOutputter.setFormat(Format.getPrettyFormat());
  outputPayload.add(xmlOutputter.outputString(document));
  outputMessage.setPayload(outputPayload);
  log(LogLevel.INFO,outputPayload.toString());
  getComponentStatistics().incrementOutboundMessages();
  outputMessage.getHeader().setSequenceNumber(getComponentStatistics().getNumberOutboundMessages());
  outputMessage.getHeader().setLastMessage(inputMessage.getHeader().isLastMessage());
  messageTarget.put(outputMessage);
}