nus-yam/ex-repair huggingface dataset:
Program: 167521
Project: 167521
Buggy source:
private OutputStream getOutputStream(IStreamableResource conn){
  conn.appendPath(relativePathAndFile,mustExist);
  return conn.getOutputStream();
}

Fixed version (ground truth):
private OutputStream getOutputStream(IStreamableResource conn){
  return conn.getOutputStream(relativePathAndFile,mustExist);
}
Program: 167522
Project: 167522
Buggy source:
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  if (attributes.size() == 0) {
    executionTracker.log(executionId,LogLevel.INFO,this,"String_Node_Str");
  }
  componentStatistics.incrementInboundMessages();
  ArrayList<EntityData> inputRows=inputMessage.getPayload();
  Message outputMessage=new Message(flowStep.getId());
  ArrayList<String> outputPayload=new ArrayList<String>();
  String outputRec;
  for (  EntityData inputRow : inputRows) {
    outputRec=processInputRow(executionId,inputRow);
    outputPayload.add(outputRec);
  }
  outputMessage.setPayload(outputPayload);
  executionTracker.log(executionId,LogLevel.INFO,this,outputPayload.toString());
  componentStatistics.incrementOutboundMessages();
  outputMessage.getHeader().setSequenceNumber(componentStatistics.getNumberOutboundMessages());
  outputMessage.getHeader().setLastMessage(inputMessage.getHeader().isLastMessage());
  messageTarget.put(outputMessage);
}

Fixed version (ground truth):
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  if (attributes.size() == 0) {
    executionTracker.log(executionId,LogLevel.INFO,this,"String_Node_Str");
  }
  componentStatistics.incrementInboundMessages();
  ArrayList<EntityData> inputRows=inputMessage.getPayload();
  Message outputMessage=new Message(flowStep.getId());
  ArrayList<String> outputPayload=new ArrayList<String>();
  String outputRec;
  for (  EntityData inputRow : inputRows) {
    outputRec=processInputRow(inputRow);
    outputPayload.add(outputRec);
  }
  outputMessage.setPayload(outputPayload);
  executionTracker.log(executionId,LogLevel.INFO,this,outputPayload.toString());
  componentStatistics.incrementOutboundMessages();
  outputMessage.getHeader().setSequenceNumber(componentStatistics.getNumberOutboundMessages());
  outputMessage.getHeader().setLastMessage(inputMessage.getHeader().isLastMessage());
  messageTarget.put(outputMessage);
}
Program: 167523
Project: 167523
Buggy source:
private String processInputRow(String executionId,EntityData inputRow){
  Writer writer=new StringWriter();
  CsvWriter csvWriter=new CsvWriter(writer,delimiter.charAt(0));
  if (!StringUtils.isEmpty(quoteCharacter)) {
    csvWriter.setUseTextQualifier(true);
    csvWriter.setTextQualifier(quoteCharacter.charAt(0));
    csvWriter.setForceQualifier(true);
  }
  try {
    if (attributes.size() > 0) {
      for (      AttributeFormat attribute : attributes) {
        Object object=inputRow.get(attribute.getAttributeId());
        if (isNotBlank(attribute.getFormatFunction())) {
          object=ModelAttributeScriptHelper.eval(attribute.getAttribute(),object,attribute.getEntity(),inputRow,attribute.getFormatFunction());
        }
        csvWriter.write(object != null ? object.toString() : null);
      }
    }
 else {
      Collection<Object> values=inputRow.values();
      for (      Object object : values) {
        csvWriter.write(object != null ? object.toString() : null);
      }
    }
  }
 catch (  IOException e) {
    throw new IoException("String_Node_Str" + e.getMessage());
  }
  return writer.toString();
}

Fixed version (ground truth):
private String processInputRow(EntityData inputRow){
  Writer writer=new StringWriter();
  CsvWriter csvWriter=new CsvWriter(writer,delimiter.charAt(0));
  if (!StringUtils.isEmpty(quoteCharacter)) {
    csvWriter.setUseTextQualifier(true);
    csvWriter.setTextQualifier(quoteCharacter.charAt(0));
    csvWriter.setForceQualifier(true);
  }
  try {
    if (attributes.size() > 0) {
      for (      AttributeFormat attribute : attributes) {
        Object object=inputRow.get(attribute.getAttributeId());
        if (isNotBlank(attribute.getFormatFunction())) {
          object=ModelAttributeScriptHelper.eval(attribute.getAttribute(),object,attribute.getEntity(),inputRow,attribute.getFormatFunction());
        }
        csvWriter.write(object != null ? object.toString() : null);
      }
    }
 else {
      Collection<Object> values=inputRow.values();
      for (      Object object : values) {
        csvWriter.write(object != null ? object.toString() : null);
      }
    }
  }
 catch (  IOException e) {
    throw new IoException("String_Node_Str" + e.getMessage());
  }
  return writer.toString();
}
Program: 167524
Project: 167524
Buggy source:
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  componentStatistics.incrementInboundMessages();
  if (inputMessage.getHeader().getOriginatingStepId().equals(sourceStepId)) {
    List<EntityData> datas=inputMessage.getPayload();
    multipliers.addAll(datas);
    multipliersInitialized=inputMessage.getHeader().isLastMessage();
  }
 else   if (!multipliersInitialized) {
    queuedWhileWaitingForMultiplier.add(inputMessage);
  }
 else {
    Iterator<Message> messages=queuedWhileWaitingForMultiplier.iterator();
    while (messages.hasNext()) {
      Message message=messages.next();
      multiply(message,messageTarget);
    }
    multiply(inputMessage,messageTarget);
  }
}

Fixed version (ground truth):
@Override public void handle(Message inputMessage,IMessageTarget messageTarget){
  componentStatistics.incrementInboundMessages();
  if (inputMessage.getHeader().getOriginatingStepId().equals(sourceStepId)) {
    List<EntityData> datas=inputMessage.getPayload();
    multipliers.addAll(datas);
    multipliersInitialized=inputMessage.getHeader().isLastMessage();
  }
 else   if (!multipliersInitialized) {
    queuedWhileWaitingForMultiplier.add(inputMessage);
  }
  if (multipliersInitialized) {
    Iterator<Message> messages=queuedWhileWaitingForMultiplier.iterator();
    while (messages.hasNext()) {
      Message message=messages.next();
      multiply(message,messageTarget);
    }
    multiply(inputMessage,messageTarget);
  }
}
Program: 167525
Project: 167525
Buggy source:
@Override public void handle(String executionId,Message inputMessage,IMessageTarget messageTarget){
  componentStatistics.incrementInboundMessages();
  Map<String,Message> outboundMessages=new HashMap<String,Message>();
  ArrayList<EntityData> inputRows=inputMessage.getPayload();
  for (  EntityData entityData : inputRows) {
    bind(executionId,entityData);
    for (    Route route : routes) {
      try {
        if (Boolean.TRUE.equals(scriptEngine.eval(route.getMatchExpression()))) {
          Message message=outboundMessages.get(route.getTargetStepId());
          if (message == null) {
            message=new Message(flowStep.getId());
            message.setPayload(new ArrayList<EntityData>());
            message.getHeader().getTargetStepIds().add(route.getTargetStepId());
            outboundMessages.put(route.getTargetStepId(),message);
          }
          ArrayList<EntityData> outputRows=message.getPayload();
          outputRows.add(entityData);
          if (outputRows.size() >= rowsPerMessage) {
            outboundMessages.remove(route.getTargetStepId());
            componentStatistics.incrementOutboundMessages();
            messageTarget.put(message);
          }
        }
      }
 catch (      ScriptException e) {
        throw new RuntimeException(e);
      }
    }
  }
  Collection<Message> messages=outboundMessages.values();
  for (  Message message : messages) {
    componentStatistics.incrementOutboundMessages();
    messageTarget.put(message);
  }
}

Fixed version (ground truth):
@Override public void handle(String executionId,Message inputMessage,IMessageTarget messageTarget){
  componentStatistics.incrementInboundMessages();
  Map<String,Message> outboundMessages=new HashMap<String,Message>();
  ArrayList<EntityData> inputRows=inputMessage.getPayload();
  for (  EntityData entityData : inputRows) {
    bind(executionId,entityData);
    if (routes != null) {
      for (      Route route : routes) {
        try {
          if (Boolean.TRUE.equals(scriptEngine.eval(route.getMatchExpression()))) {
            Message message=outboundMessages.get(route.getTargetStepId());
            if (message == null) {
              message=new Message(flowStep.getId());
              message.setPayload(new ArrayList<EntityData>());
              message.getHeader().getTargetStepIds().add(route.getTargetStepId());
              outboundMessages.put(route.getTargetStepId(),message);
            }
            ArrayList<EntityData> outputRows=message.getPayload();
            outputRows.add(entityData);
            if (outputRows.size() >= rowsPerMessage) {
              outboundMessages.remove(route.getTargetStepId());
              componentStatistics.incrementOutboundMessages();
              messageTarget.put(message);
            }
          }
        }
 catch (        ScriptException e) {
          throw new RuntimeException(e);
        }
      }
    }
  }
  Collection<Message> messages=outboundMessages.values();
  for (  Message message : messages) {
    componentStatistics.incrementOutboundMessages();
    messageTarget.put(message);
  }
}
Program: 167527
Project: 167527
Buggy source:
@Override public boolean closing(){
  if (queryPanel != null) {
    save();
    BasicDataSource dataSource=(BasicDataSource)platform.getDataSource();
    try {
      dataSource.close();
    }
 catch (    SQLException e) {
    }
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean closing(){
  if (queryPanel != null) {
    save();
    BasicDataSource dataSource=(BasicDataSource)platform.getDataSource();
    try {
      dataSource.close();
    }
 catch (    SQLException e) {
    }
  }
  if (propertySheet != null) {
    propertySheet.valueChange(component);
  }
  return true;
}
Program: 167530
Project: 167530
Buggy source:
protected void bind(String executionId,EntityData entityData){
  Bindings bindings=scriptEngine.createBindings();
  Model model=flowStep.getComponent().getInputModel();
  List<ModelEntity> entities=model.getModelEntities();
  for (  ModelEntity modelEntity : entities) {
    HashMap<String,Object> boundEntity=new HashMap<String,Object>();
    bindings.put(modelEntity.getName(),boundEntity);
  }
  Set<String> attributeIds=entityData.keySet();
  for (  String attributeId : attributeIds) {
    ModelAttribute attribute=model.getAttributeById(attributeId);
    if (attribute != null) {
      ModelEntity entity=model.getEntityById(attribute.getEntityId());
      Object value=entityData.get(attributeId);
      @SuppressWarnings("String_Node_Str") Map<String,Object> boundEntity=(Map<String,Object>)bindings.get(entity.getName());
      boundEntity.put(attribute.getName(),value);
    }
 else {
      executionTracker.log(executionId,LogLevel.WARN,this,"String_Node_Str" + attributeId);
    }
  }
  scriptEngine.setBindings(bindings,ScriptContext.ENGINE_SCOPE);
}

Fixed version (ground truth):
protected void bind(String executionId,EntityData entityData){
  long ts=System.currentTimeMillis();
  Bindings bindings=scriptEngine.createBindings();
  Model model=flowStep.getComponent().getInputModel();
  List<ModelEntity> entities=model.getModelEntities();
  for (  ModelEntity modelEntity : entities) {
    HashMap<String,Object> boundEntity=new HashMap<String,Object>();
    bindings.put(modelEntity.getName(),boundEntity);
  }
  Set<String> attributeIds=entityData.keySet();
  for (  String attributeId : attributeIds) {
    ModelAttribute attribute=model.getAttributeById(attributeId);
    if (attribute != null) {
      ModelEntity entity=model.getEntityById(attribute.getEntityId());
      Object value=entityData.get(attributeId);
      @SuppressWarnings("String_Node_Str") Map<String,Object> boundEntity=(Map<String,Object>)bindings.get(entity.getName());
      boundEntity.put(attribute.getName(),value);
    }
 else {
      executionTracker.log(executionId,LogLevel.WARN,this,"String_Node_Str" + attributeId);
    }
  }
  scriptEngine.setBindings(bindings,ScriptContext.ENGINE_SCOPE);
  log.info("String_Node_Str" + (System.currentTimeMillis() - ts) + "String_Node_Str");
}
Program: 167531
Project: 167531
Buggy source:
protected void bind(String executionId,EntityData entityData){
  long ts=System.currentTimeMillis();
  Bindings bindings=scriptEngine.createBindings();
  Model model=flowStep.getComponent().getInputModel();
  List<ModelEntity> entities=model.getModelEntities();
  for (  ModelEntity modelEntity : entities) {
    HashMap<String,Object> boundEntity=new HashMap<String,Object>();
    bindings.put(modelEntity.getName(),boundEntity);
  }
  Set<String> attributeIds=entityData.keySet();
  for (  String attributeId : attributeIds) {
    ModelAttribute attribute=model.getAttributeById(attributeId);
    if (attribute != null) {
      ModelEntity entity=model.getEntityById(attribute.getEntityId());
      Object value=entityData.get(attributeId);
      @SuppressWarnings("String_Node_Str") Map<String,Object> boundEntity=(Map<String,Object>)bindings.get(entity.getName());
      boundEntity.put(attribute.getName(),value);
    }
 else {
      executionTracker.log(executionId,LogLevel.WARN,this,"String_Node_Str" + attributeId);
    }
  }
  scriptEngine.setBindings(bindings,ScriptContext.ENGINE_SCOPE);
  log.info("String_Node_Str" + (System.currentTimeMillis() - ts) + "String_Node_Str");
}

Fixed version (ground truth):
protected void bind(String executionId,EntityData entityData){
  Bindings bindings=scriptEngine.createBindings();
  Model model=flowStep.getComponent().getInputModel();
  List<ModelEntity> entities=model.getModelEntities();
  for (  ModelEntity modelEntity : entities) {
    HashMap<String,Object> boundEntity=new HashMap<String,Object>();
    bindings.put(modelEntity.getName(),boundEntity);
  }
  Set<String> attributeIds=entityData.keySet();
  for (  String attributeId : attributeIds) {
    ModelAttribute attribute=model.getAttributeById(attributeId);
    if (attribute != null) {
      ModelEntity entity=model.getEntityById(attribute.getEntityId());
      Object value=entityData.get(attributeId);
      @SuppressWarnings("String_Node_Str") Map<String,Object> boundEntity=(Map<String,Object>)bindings.get(entity.getName());
      boundEntity.put(attribute.getName(),value);
    }
 else {
      executionTracker.log(executionId,LogLevel.WARN,this,"String_Node_Str" + attributeId);
    }
  }
  scriptEngine.setBindings(bindings,ScriptContext.ENGINE_SCOPE);
}
Program: 167532
Project: 167532
Buggy source:
@Override public void handle(String executionId,Message inputMessage,IMessageTarget messageTarget){
  componentStatistics.incrementInboundMessages();
  Map<String,Message> outboundMessages=new HashMap<String,Message>();
  ArrayList<EntityData> inputRows=inputMessage.getPayload();
  for (  EntityData entityData : inputRows) {
    bind(executionId,entityData);
    for (    Route route : routes) {
      try {
        if (Boolean.TRUE.equals(scriptEngine.eval(route.getMatchExpression()))) {
          Message message=outboundMessages.get(route.getTargetStepId());
          if (message == null) {
            message=new Message(flowStep.getId());
            message.setPayload(new ArrayList<EntityData>());
            message.getHeader().getTargetStepIds().add(route.getTargetStepId());
            outboundMessages.put(route.getTargetStepId(),message);
          }
          ArrayList<EntityData> outputRows=message.getPayload();
          outputRows.add(entityData);
          if (outputRows.size() >= rowsPerMessage) {
            outboundMessages.remove(route.getTargetStepId());
            componentStatistics.incrementOutboundMessages();
            messageTarget.put(message);
          }
        }
      }
 catch (      ScriptException e) {
        throw new RuntimeException(e);
      }
    }
    Collection<Message> messages=outboundMessages.values();
    for (    Message message : messages) {
      componentStatistics.incrementOutboundMessages();
      messageTarget.put(message);
    }
  }
}

Fixed version (ground truth):
@Override public void handle(String executionId,Message inputMessage,IMessageTarget messageTarget){
  componentStatistics.incrementInboundMessages();
  Map<String,Message> outboundMessages=new HashMap<String,Message>();
  ArrayList<EntityData> inputRows=inputMessage.getPayload();
  for (  EntityData entityData : inputRows) {
    bind(executionId,entityData);
    for (    Route route : routes) {
      try {
        if (Boolean.TRUE.equals(scriptEngine.eval(route.getMatchExpression()))) {
          Message message=outboundMessages.get(route.getTargetStepId());
          if (message == null) {
            message=new Message(flowStep.getId());
            message.setPayload(new ArrayList<EntityData>());
            message.getHeader().getTargetStepIds().add(route.getTargetStepId());
            outboundMessages.put(route.getTargetStepId(),message);
          }
          ArrayList<EntityData> outputRows=message.getPayload();
          outputRows.add(entityData);
          if (outputRows.size() >= rowsPerMessage) {
            outboundMessages.remove(route.getTargetStepId());
            componentStatistics.incrementOutboundMessages();
            messageTarget.put(message);
          }
        }
      }
 catch (      ScriptException e) {
        throw new RuntimeException(e);
      }
    }
  }
  Collection<Message> messages=outboundMessages.values();
  for (  Message message : messages) {
    componentStatistics.incrementOutboundMessages();
    messageTarget.put(message);
  }
}
Program: 167533
Project: 167533
Buggy source:
public void selected(FlowStep step){
  if (step != null) {
    context.getConfigurationService().refresh(flow.findFlowStepWithId(step.getId()).getComponent());
    diagram.setNodes(getNodes());
    diagram.setSelectedNodeId(step.getId());
    propertySheet.valueChange(step);
  }
 else {
    diagram.setSelectedNodeId(null);
    propertySheet.valueChange((Object)null);
  }
}

Fixed version (ground truth):
public void selected(FlowStep step){
  if (step != null) {
    step=flow.findFlowStepWithId(step.getId());
  }
  if (step != null) {
    context.getConfigurationService().refresh(step.getComponent());
    diagram.setNodes(getNodes());
    diagram.setSelectedNodeId(step.getId());
    propertySheet.valueChange(step);
  }
 else {
    diagram.setSelectedNodeId(null);
    propertySheet.valueChange((Object)null);
  }
}
Program: 167535
Project: 167535
Buggy source:
@Override public Object generateCell(Table source,Object itemId,Object columnId){
  if (itemId instanceof ModelAttribute) {
    ModelAttribute obj=(ModelAttribute)itemId;
    if (lastEditItemIds.contains(itemId)) {
      ComboBox cbox=new ComboBox();
      cbox.setNullSelectionAllowed(false);
      for (      DataType dataType : DataType.values()) {
        cbox.addItem(dataType.name());
      }
      cbox.setValue(obj.getType());
      fields.put(itemId,cbox);
      return cbox;
    }
 else {
      ComboBox t=fields.get(itemId);
      if (t != null) {
        obj.setType((String)t.getValue());
        fields.remove(itemId);
      }
      return obj.getType();
    }
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
@Override public Object generateCell(Table source,Object itemId,Object columnId){
  if (itemId instanceof ModelAttribute) {
    final ModelAttribute obj=(ModelAttribute)itemId;
    if (lastEditItemIds.contains(itemId)) {
      final ComboBox cbox=new ComboBox();
      cbox.setNullSelectionAllowed(false);
      for (      DataType dataType : DataType.values()) {
        cbox.addItem(dataType.name());
      }
      cbox.setValue(obj.getType());
      cbox.addValueChangeListener(new ValueChangeListener(){
        @Override public void valueChange(        ValueChangeEvent event){
          obj.setType((String)cbox.getValue());
          EditModelPanel.this.context.getConfigurationService().save(obj);
        }
      }
);
      return cbox;
    }
 else {
      return obj.getType();
    }
  }
 else {
    return null;
  }
}
Program: 167536
Project: 167536
Buggy source:
public void valueChange(ValueChangeEvent event){
  for (  Object itemId : lastEditItemIds) {
    if (itemId instanceof ModelEntity) {
      ModelEntity e=(ModelEntity)itemId;
      context.getConfigurationService().save(e);
    }
 else     if (itemId instanceof ModelAttribute) {
      ModelAttribute a=(ModelAttribute)itemId;
      context.getConfigurationService().save(a);
    }
  }
  lastEditItemIds=Collections.emptySet();
  treeTable.refreshRowCache();
  setButtonsEnabled(filterField.getValue());
}

Fixed version (ground truth):
public void valueChange(ValueChangeEvent event){
  lastEditItemIds=Collections.emptySet();
  treeTable.refreshRowCache();
  setButtonsEnabled(filterField.getValue());
}
Program: 167537
Project: 167537
Buggy source:
protected void addModelAttribute(String filter,ModelEntity entity,ModelAttribute modelAttribute){
  treeTable.addItem(modelAttribute);
  treeTable.setItemIcon(modelAttribute,FontAwesome.COLUMNS);
  treeTable.setParent(modelAttribute,entity);
  treeTable.setChildrenAllowed(entity,true);
  treeTable.setChildrenAllowed(modelAttribute,false);
}

Fixed version (ground truth):
protected void addModelAttribute(String filter,ModelEntity entity,ModelAttribute modelAttribute){
  treeTable.addItem(modelAttribute);
  treeTable.setItemIcon(modelAttribute,FontAwesome.COLUMNS);
  treeTable.setChildrenAllowed(entity,true);
  treeTable.setParent(modelAttribute,entity);
  treeTable.setChildrenAllowed(modelAttribute,false);
}
Program: 167538
Project: 167538
Buggy source:
public void setButtonsEnabled(String filter){
  boolean noFilter=isBlank(filter);
  Set<Object> selected=getSelectedItems();
  addEntityButton.setEnabled(noFilter);
  importButton.setEnabled(noFilter);
  addAttributeButton.setEnabled(noFilter);
  removeButton.setEnabled(selected.size() > 0);
  editButton.setEnabled(selected.size() > 0);
}

Fixed version (ground truth):
public void setButtonsEnabled(String filter){
  boolean noFilter=isBlank(filter);
  Set<Object> selected=getSelectedItems();
  addEntityButton.setEnabled(noFilter);
  importButton.setEnabled(noFilter);
  addAttributeButton.setEnabled(noFilter && selected.size() > 0);
  removeButton.setEnabled(selected.size() > 0);
  editButton.setEnabled(selected.size() > 0);
}
Program: 167539
Project: 167539
Buggy source:
protected void addModelAttribute(String filter,ModelEntity entity,ModelAttribute modelAttribute){
  treeTable.addItem(modelAttribute);
  treeTable.setItemIcon(modelAttribute,FontAwesome.COLUMNS);
  treeTable.setParent(modelAttribute,entity);
  treeTable.setChildrenAllowed(entity,true);
  treeTable.setChildrenAllowed(modelAttribute,false);
}

Fixed version (ground truth):
protected void addModelAttribute(String filter,ModelEntity entity,ModelAttribute modelAttribute){
  treeTable.addItem(modelAttribute);
  treeTable.setItemIcon(modelAttribute,FontAwesome.COLUMNS);
  treeTable.setChildrenAllowed(entity,true);
  treeTable.setParent(modelAttribute,entity);
  treeTable.setChildrenAllowed(modelAttribute,false);
}
Program: 167540
Project: 167540
Buggy source:
public EditFlowPanel(ApplicationContext context,Flow componentFlow,IDesignNavigator designNavigator,TabbedPanel tabs){
  this.context=context;
  this.tabs=tabs;
  this.flow=componentFlow;
  this.designNavigator=designNavigator;
  this.propertySheet=new PropertySheet(context);
  this.propertySheet.setCaption("String_Node_Str");
  this.componentPalette=new EditFlowPalette(this,context.getComponentFactory());
  addComponent(componentPalette);
  VerticalLayout rightLayout=new VerticalLayout();
  rightLayout.setSizeFull();
  rightLayout.addComponent(buildButtonBar());
  VerticalSplitPanel splitPanel=new VerticalSplitPanel();
  splitPanel.setSizeFull();
  splitPanel.setSplitPosition(50,Unit.PERCENTAGE);
  diagramLayout=new CssLayout();
  diagramLayout.setWidth(10000,Unit.PIXELS);
  diagramLayout.setHeight(10000,Unit.PIXELS);
  DragAndDropWrapper wrapper=new DragAndDropWrapper(diagramLayout);
  wrapper.setSizeUndefined();
  wrapper.setDropHandler(new DropHandler());
  Panel panel=new Panel();
  panel.setSizeFull();
  panel.addStyleName(ValoTheme.PANEL_WELL);
  panel.setContent(wrapper);
  splitPanel.addComponent(panel);
  splitPanel.addComponent(propertySheet);
  rightLayout.addComponent(splitPanel);
  rightLayout.setExpandRatio(splitPanel,1);
  addComponent(rightLayout);
  setExpandRatio(rightLayout,1);
  redrawFlow();
  context.getBackgroundRefresherService().register(this);
}

Fixed version (ground truth):
public EditFlowPanel(ApplicationContext context,Flow flow,IDesignNavigator designNavigator,TabbedPanel tabs){
  context.getConfigurationService().refresh(flow);
  this.flow=flow;
  this.context=context;
  this.tabs=tabs;
  this.designNavigator=designNavigator;
  this.propertySheet=new PropertySheet(context);
  this.propertySheet.setCaption("String_Node_Str");
  this.componentPalette=new EditFlowPalette(this,context.getComponentFactory());
  addComponent(componentPalette);
  VerticalLayout rightLayout=new VerticalLayout();
  rightLayout.setSizeFull();
  rightLayout.addComponent(buildButtonBar());
  VerticalSplitPanel splitPanel=new VerticalSplitPanel();
  splitPanel.setSizeFull();
  splitPanel.setSplitPosition(50,Unit.PERCENTAGE);
  diagramLayout=new CssLayout();
  diagramLayout.setWidth(10000,Unit.PIXELS);
  diagramLayout.setHeight(10000,Unit.PIXELS);
  DragAndDropWrapper wrapper=new DragAndDropWrapper(diagramLayout);
  wrapper.setSizeUndefined();
  wrapper.setDropHandler(new DropHandler());
  Panel panel=new Panel();
  panel.setSizeFull();
  panel.addStyleName(ValoTheme.PANEL_WELL);
  panel.setContent(wrapper);
  splitPanel.addComponent(panel);
  splitPanel.addComponent(propertySheet);
  rightLayout.addComponent(splitPanel);
  rightLayout.setExpandRatio(splitPanel,1);
  addComponent(rightLayout);
  setExpandRatio(rightLayout,1);
  redrawFlow();
  context.getBackgroundRefresherService().register(this);
}
Program: 167541
Project: 167541
Buggy source:
public void itemClick(ItemClickEvent event){
  if (event.getButton() == MouseButton.LEFT) {
    if (event.isDoubleClick()) {
    }
 else {
    }
  }
}

Fixed version (ground truth):
public void itemClick(ItemClickEvent event){
  if (event.getButton() == MouseButton.LEFT) {
    if (event.isDoubleClick()) {
      if (treeTable.hasChildren(event.getItemId())) {
        treeTable.setCollapsed(event.getItemId(),!treeTable.isCollapsed(event.getItemId()));
      }
    }
  }
}
Program: 167543
Project: 167543
Buggy source:
public Object getBackgroundData(){
  Object currentSelection=manageNavigator.getCurrentSelection();
  if (currentSelection != null) {
    Map<String,Object> params=new HashMap<String,Object>();
    if (currentSelection instanceof Agent) {
      params.put("String_Node_Str",((Agent)currentSelection).getId());
    }
 else     if (currentSelection instanceof Flow) {
      params.put("String_Node_Str",((Flow)currentSelection).getId());
    }
 else     if (currentSelection instanceof AgentDeployment) {
      params.put("String_Node_Str",((AgentDeployment)currentSelection).getFlowId());
    }
    if (params.size() > 0) {
      return context.getExecutionService().findExecutions(params,limit);
    }
  }
  return null;
}

Fixed version (ground truth):
public Object getBackgroundData(){
  Object currentSelection=manageNavigator.getCurrentSelection();
  Object currentSelectionParent=manageNavigator.getCurrentSelectionParent();
  if (currentSelection != null) {
    Map<String,Object> params=new HashMap<String,Object>();
    if (currentSelection instanceof Agent) {
      params.put("String_Node_Str",((Agent)currentSelection).getId());
    }
 else     if (currentSelection instanceof Flow) {
      params.put("String_Node_Str",((Flow)currentSelection).getId());
    }
 else     if (currentSelection instanceof AgentDeployment) {
      params.put("String_Node_Str",((AgentDeployment)currentSelection).getFlowId());
    }
    if (currentSelectionParent instanceof Agent) {
      params.put("String_Node_Str",((Agent)currentSelectionParent).getId());
    }
    if (params.size() > 0) {
      return context.getExecutionService().findExecutions(params,limit);
    }
  }
  return null;
}
Program: 167544
Project: 167544
Buggy source:
private String processInputRow(String executionId,EntityData inputRow){
  Writer writer=new StringWriter();
  CsvWriter csvWriter=new CsvWriter(writer,delimiter.charAt(0));
  if (!StringUtils.isEmpty(quoteCharacter)) {
    csvWriter.setTextQualifier(quoteCharacter.charAt(0));
  }
  try {
    if (attributes.size() > 0) {
      for (      AttributeFormat attribute : attributes) {
        csvWriter.write(inputRow.get(attribute.getAttributeId()).toString());
      }
    }
 else {
      Collection<Object> values=inputRow.values();
      for (      Object object : values) {
        csvWriter.write(object != null ? object.toString() : null);
      }
    }
  }
 catch (  IOException e) {
    throw new IoException("String_Node_Str" + e.getMessage());
  }
  return writer.toString();
}

Fixed version (ground truth):
private String processInputRow(String executionId,EntityData inputRow){
  Writer writer=new StringWriter();
  CsvWriter csvWriter=new CsvWriter(writer,delimiter.charAt(0));
  if (!StringUtils.isEmpty(quoteCharacter)) {
    csvWriter.setUseTextQualifier(true);
    csvWriter.setTextQualifier(quoteCharacter.charAt(0));
    csvWriter.setForceQualifier(true);
  }
  try {
    if (attributes.size() > 0) {
      for (      AttributeFormat attribute : attributes) {
        Object object=inputRow.get(attribute.getAttributeId());
        csvWriter.write(object != null ? object.toString() : null);
      }
    }
 else {
      Collection<Object> values=inputRow.values();
      for (      Object object : values) {
        csvWriter.write(object != null ? object.toString() : null);
      }
    }
  }
 catch (  IOException e) {
    throw new IoException("String_Node_Str" + e.getMessage());
  }
  return writer.toString();
}
Program: 167545
Project: 167545
Buggy source:
@Override public void afterHandle(String executionId,IComponent component,Throwable error){
  super.afterHandle(executionId,component,error);
  ExecutionStep step=steps.get(component.getFlowStep().getId());
  step.setEndTime(new Date());
  step.setStatus(error != null ? ExecutionStatus.ERROR.name() : ExecutionStatus.DONE.name());
  step.setMessagesReceived(component.getComponentStatistics().getNumberInboundMessages());
  step.setMessagesProduced(component.getComponentStatistics().getNumberOutboundMessages());
  this.recorder.record(step);
}

Fixed version (ground truth):
@Override public void afterHandle(String executionId,IComponent component,Throwable error){
  super.afterHandle(executionId,component,error);
  ExecutionStep step=steps.get(component.getFlowStep().getId());
  step.setStatus(error != null ? ExecutionStatus.ERROR.name() : ExecutionStatus.RUNNING.name());
  step.setMessagesReceived(component.getComponentStatistics().getNumberInboundMessages());
  step.setMessagesProduced(component.getComponentStatistics().getNumberOutboundMessages());
  this.recorder.record(step);
}
Program: 167546
Project: 167546
Buggy source:
public static String[] getSignatures(){
  List<String> signatures=new ArrayList<String>();
  Method[] methods=Transformer.class.getMethods();
  LocalVariableTableParameterNameDiscoverer discoverer=new LocalVariableTableParameterNameDiscoverer();
  for (  Method method : methods) {
    if (method.getDeclaringClass().equals(Transformer.class) && Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers())) {
      StringBuilder sig=new StringBuilder(method.getName());
      sig.append("String_Node_Str");
      String[] names=discoverer.getParameterNames(method);
      for (      String name : names) {
        sig.append(name);
        sig.append("String_Node_Str");
      }
      if (names.length > 0) {
        sig.replace(sig.length() - 1,sig.length(),"String_Node_Str");
      }
 else {
        sig.append("String_Node_Str");
      }
      signatures.add(sig.toString());
    }
  }
  return signatures.toArray(new String[signatures.size()]);
}

Fixed version (ground truth):
public static String[] getSignatures(){
  List<String> signatures=new ArrayList<String>();
  Method[] methods=Transformer.class.getMethods();
  LocalVariableTableParameterNameDiscoverer discoverer=new LocalVariableTableParameterNameDiscoverer();
  for (  Method method : methods) {
    if (method.getDeclaringClass().equals(Transformer.class) && Modifier.isPublic(method.getModifiers()) && !Modifier.isStatic(method.getModifiers())) {
      StringBuilder sig=new StringBuilder(method.getName());
      sig.append("String_Node_Str");
      String[] names=discoverer.getParameterNames(method);
      for (      String name : names) {
        sig.append(name);
        sig.append("String_Node_Str");
      }
      if (names.length > 0) {
        sig.replace(sig.length() - 1,sig.length(),"String_Node_Str");
      }
 else {
        sig.append("String_Node_Str");
      }
      signatures.add(sig.toString());
    }
  }
  Collections.sort(signatures);
  return signatures.toArray(new String[signatures.size()]);
}
Program: 167547
Project: 167547
Buggy source:
public static Object eval(Object value,String expression){
  ScriptEngine engine=scriptEngine.get();
  if (engine == null) {
    ScriptEngineManager factory=new ScriptEngineManager();
    engine=factory.getEngineByName("String_Node_Str");
    scriptEngine.set(engine);
  }
  engine.put("String_Node_Str",value);
  try {
    String importString="String_Node_Str";
    String code=String.format("String_Node_Str",expression);
    Object obj=engine.eval(importString + code);
    if (obj instanceof RuntimeException) {
      throw (RuntimeException)obj;
    }
 else     if (obj instanceof Throwable) {
      throw new RuntimeException((Throwable)obj);
    }
 else {
      return obj;
    }
  }
 catch (  ScriptException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public static Object eval(Object value,String expression){
  ScriptEngine engine=scriptEngine.get();
  if (engine == null) {
    ScriptEngineManager factory=new ScriptEngineManager();
    engine=factory.getEngineByName("String_Node_Str");
    scriptEngine.set(engine);
  }
  engine.put("String_Node_Str",value);
  try {
    String importString="String_Node_Str";
    String code=String.format("String_Node_Str",expression);
    return engine.eval(importString + code);
  }
 catch (  ScriptException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 167548
Project: 167548
Buggy source:
private void shutdown() throws InterruptedException {
  for (  StepRuntime targetStepRuntime : targetStepRuntimes) {
    targetStepRuntime.put(new ShutdownMessage(component.getFlowStep().getId()));
  }
  this.component.stop();
  running=false;
}

Fixed version (ground truth):
private void shutdown() throws InterruptedException {
  for (  StepRuntime targetStepRuntime : targetStepRuntimes) {
    targetStepRuntime.put(new ShutdownMessage(component.getFlowStep().getId()));
  }
  this.component.stop();
  running=false;
  executionTracker.flowStepFinished(executionId,component,error);
}
Program: 167549
Project: 167549
Buggy source:
protected void addNewModel(){
  Folder folder=findFolderWithName("String_Node_Str");
  if (folder != null) {
    ProjectVersion projectVersion=findProjectVersion();
    Model model=new Model();
    model.setName("String_Node_Str");
    model.setProjectVersionId(projectVersion.getId());
    context.getConfigurationService().save(model);
    treeTable.addItem(model);
    treeTable.setItemIcon(model,Icons.MODEL);
    treeTable.setParent(model,folder);
    this.treeTable.setChildrenAllowed(model,false);
    treeTable.setCollapsed(folder,false);
    startEditingItem(model);
  }
}

Fixed version (ground truth):
protected void addNewModel(){
  Folder folder=findFolderWithName("String_Node_Str");
  if (folder != null) {
    treeTable.setChildrenAllowed(folder,true);
    ProjectVersion projectVersion=findProjectVersion();
    Model model=new Model();
    model.setName("String_Node_Str");
    model.setProjectVersionId(projectVersion.getId());
    context.getConfigurationService().save(model);
    treeTable.addItem(model);
    treeTable.setItemIcon(model,Icons.MODEL);
    treeTable.setParent(model,folder);
    this.treeTable.setChildrenAllowed(model,false);
    treeTable.setCollapsed(folder,false);
    startEditingItem(model);
  }
}
Program: 167550
Project: 167550
Buggy source:
protected void addNewFlow(){
  Folder folder=findFolderWithName("String_Node_Str");
  if (folder != null) {
    ProjectVersion projectVersion=findProjectVersion();
    Flow flow=new Flow();
    flow.setProjectVersionId(projectVersion.getId());
    flow.setName("String_Node_Str");
    context.getConfigurationService().save(flow);
    treeTable.addItem(flow);
    treeTable.setItemIcon(flow,Icons.FLOW);
    treeTable.setParent(flow,folder);
    treeTable.setChildrenAllowed(flow,false);
    treeTable.setCollapsed(folder,false);
    treeTable.setCollapsed(projectVersion,false);
    treeTable.setValue(flow);
    startEditingItem(flow);
  }
}

Fixed version (ground truth):
protected void addNewFlow(){
  Folder folder=findFolderWithName("String_Node_Str");
  if (folder != null) {
    treeTable.setChildrenAllowed(folder,true);
    ProjectVersion projectVersion=findProjectVersion();
    Flow flow=new Flow();
    flow.setProjectVersionId(projectVersion.getId());
    flow.setName("String_Node_Str");
    context.getConfigurationService().save(flow);
    treeTable.addItem(flow);
    treeTable.setItemIcon(flow,Icons.FLOW);
    treeTable.setParent(flow,folder);
    treeTable.setChildrenAllowed(flow,false);
    treeTable.setCollapsed(folder,false);
    treeTable.setCollapsed(projectVersion,false);
    treeTable.setValue(flow);
    startEditingItem(flow);
  }
}
Program: 167551
Project: 167551
Buggy source:
protected void addNewResource(String type,String defaultName,FontAwesome icon){
  Folder folder=findFolderWithName("String_Node_Str");
  if (folder != null) {
    ProjectVersion projectVersion=findProjectVersion();
    Resource resource=new Resource();
    resource.setName(defaultName);
    resource.setProjectVersionId(projectVersion.getId());
    resource.setType(type);
    context.getConfigurationService().save(resource);
    treeTable.addItem(resource);
    treeTable.setItemIcon(resource,icon);
    treeTable.setParent(resource,folder);
    treeTable.setCollapsed(folder,false);
    startEditingItem(resource);
  }
}

Fixed version (ground truth):
protected void addNewResource(String type,String defaultName,FontAwesome icon){
  Folder folder=findFolderWithName("String_Node_Str");
  if (folder != null) {
    treeTable.setChildrenAllowed(folder,true);
    ProjectVersion projectVersion=findProjectVersion();
    Resource resource=new Resource();
    resource.setName(defaultName);
    resource.setProjectVersionId(projectVersion.getId());
    resource.setType(type);
    context.getConfigurationService().save(resource);
    treeTable.addItem(resource);
    treeTable.setItemIcon(resource,icon);
    treeTable.setParent(resource,folder);
    treeTable.setCollapsed(folder,false);
    startEditingItem(resource);
  }
}
Program: 167552
Project: 167552
Buggy source:
@Override public void itemClick(ItemClickEvent event){
  if (event.isDoubleClick()) {
    Object object=event.getPropertyId();
    if (!object.toString().equals("String_Node_Str")) {
      Object prop=event.getPropertyId();
      String header=logTable.getColumnHeader(prop);
      Property<?> p=event.getItem().getItemProperty(prop);
      String data=String.valueOf(p.getValue());
      new ReadOnlyTextAreaDialog(header,data,false).showAtSize(.5);
    }
  }
}

Fixed version (ground truth):
@Override public void itemClick(ItemClickEvent event){
  if (event.isDoubleClick()) {
    Object object=event.getPropertyId();
    if (!object.toString().equals("String_Node_Str")) {
      Object prop=event.getPropertyId();
      String header=logTable.getColumnHeader(prop);
      Property<?> p=event.getItem().getItemProperty(prop);
      if (p != null) {
        String data=String.valueOf(p.getValue());
        new ReadOnlyTextAreaDialog(header,data,false).showAtSize(.5);
      }
    }
  }
}
Program: 167554
Project: 167554
Buggy source:
public void buttonClick(ClickEvent event){
  System.out.println("String_Node_Str");
  for (  ModelEntity entity : component.getInputModel().getModelEntities()) {
    for (    ModelAttribute attr : entity.getModelAttributes()) {
      for (      ModelEntity entity2 : component.getOutputModel().getModelEntities()) {
        for (        ModelAttribute attr2 : entity2.getModelAttributes()) {
          autoMap(attr,attr2);
        }
      }
    }
  }
}

Fixed version (ground truth):
public void buttonClick(ClickEvent event){
  for (  ModelEntity entity : component.getInputModel().getModelEntities()) {
    for (    ModelAttribute attr : entity.getModelAttributes()) {
      for (      ModelEntity entity2 : component.getOutputModel().getModelEntities()) {
        for (        ModelAttribute attr2 : entity2.getModelAttributes()) {
          autoMap(attr,attr2);
        }
      }
    }
  }
}
Program: 167555
Project: 167555
Buggy source:
public void call(JsonArray arguments){
  if (arguments.length() > 0) {
    JsonObject json=arguments.getObject(0);
    String sourceId=json.getString("String_Node_Str").substring(3);
    String targetId=json.getString("String_Node_Str").substring(3);
    boolean removed=json.getBoolean("String_Node_Str");
    if (removed) {
      removeConnection(sourceId,targetId);
    }
 else {
      ComponentAttributeSetting setting=new ComponentAttributeSetting();
      setting.setAttributeId(sourceId);
      setting.setComponentId(component.getId());
      setting.setName(MappingProcessor.ATTRIBUTE_MAPS_TO);
      component.addAttributeSetting(setting);
      setting.setValue(targetId);
      context.getConfigurationService().save(setting);
    }
  }
}

Fixed version (ground truth):
public void call(JsonArray arguments){
  if (arguments.length() > 0) {
    JsonObject json=arguments.getObject(0);
    String sourceId=json.getString("String_Node_Str").substring(3);
    String targetId=json.getString("String_Node_Str").substring(3);
    boolean removed=json.getBoolean("String_Node_Str");
    if (removed) {
      removeConnection(sourceId,targetId);
    }
 else {
      ComponentAttributeSetting setting=new ComponentAttributeSetting();
      setting.setAttributeId(sourceId);
      setting.setComponentId(component.getId());
      setting.setName(MappingProcessor.ATTRIBUTE_MAPS_TO);
      component.addAttributeSetting(setting);
      setting.setValue(targetId);
      context.getConfigurationService().save(setting);
      markAsDirty();
    }
  }
}
Program: 167556
Project: 167556
Buggy source:
public void removeSelected(){
  if (selectedSourceId != null) {
    removeConnection(selectedSourceId,selectedTargetId);
    selectedSourceId=selectedTargetId=null;
    markAsDirty();
  }
}

Fixed version (ground truth):
public void removeSelected(){
  if (selectedSourceId != null) {
    removeConnection(selectedSourceId,selectedTargetId);
    selectedSourceId=selectedTargetId=null;
  }
}
Program: 167557
Project: 167557
Buggy source:
protected void removeConnection(String sourceId,String targetId){
  List<ComponentAttributeSetting> settings=component.getAttributeSetting(sourceId,MappingProcessor.ATTRIBUTE_MAPS_TO);
  for (  ComponentAttributeSetting setting : settings) {
    if (setting.getValue().equals(targetId)) {
      component.getAttributeSettings().remove(setting);
      context.getConfigurationService().delete(setting);
    }
  }
}

Fixed version (ground truth):
protected void removeConnection(String sourceId,String targetId){
  List<ComponentAttributeSetting> settings=component.getAttributeSetting(sourceId,MappingProcessor.ATTRIBUTE_MAPS_TO);
  for (  ComponentAttributeSetting setting : settings) {
    if (setting.getValue().equals(targetId)) {
      component.getAttributeSettings().remove(setting);
      context.getConfigurationService().delete(setting);
      markAsDirty();
    }
  }
}
Program: 167558
Project: 167558
Buggy source:
protected Folder addVirtualFolder(String name,ProjectVersion projectVersion){
  String folderId=name + "String_Node_Str" + projectVersion.getId();
  Folder folder=new Folder();
  folder.makeVirtual();
  folder.getProjectVersionId();
  folder.setId(folderId);
  folder.setName(name);
  treeTable.addItem(folder);
  treeTable.setItemIcon(folder,Icons.FOLDER_CLOSED);
  treeTable.setItemCaption(folder,name);
  treeTable.setParent(folder,projectVersion);
  return folder;
}

Fixed version (ground truth):
protected Folder addVirtualFolder(String name,ProjectVersion projectVersion){
  String folderId=name + "String_Node_Str" + projectVersion.getId();
  Folder folder=new Folder();
  folder.makeVirtual();
  folder.getProjectVersionId();
  folder.setId(folderId);
  folder.setName(name);
  treeTable.addItem(folder);
  treeTable.setItemIcon(folder,Icons.FOLDER_CLOSED);
  treeTable.setItemCaption(folder,name);
  treeTable.setParent(folder,projectVersion);
  treeTable.setChildrenAllowed(folder,false);
  return folder;
}
Program: 167559
Project: 167559
Buggy source:
protected void addFlowsToFolder(Folder folder,ProjectVersion projectVersion){
  IConfigurationService configurationService=context.getConfigurationService();
  List<Flow> flows=configurationService.findFlowsInProject(projectVersion.getId());
  for (  Flow flow : flows) {
    this.treeTable.addItem(flow);
    this.treeTable.setItemIcon(flow,Icons.FLOW);
    this.treeTable.setParent(flow,folder);
    List<FlowStep> flowSteps=flow.getFlowSteps();
    this.treeTable.setChildrenAllowed(flow,flowSteps.size() > 0);
    for (    FlowStep flowStep : flowSteps) {
      this.treeTable.addItem(flowStep);
      this.treeTable.setItemCaption(flowStep,flowStep.getName());
      this.treeTable.setItemIcon(flowStep,Icons.COMPONENT);
      this.treeTable.setParent(flowStep,flow);
      this.treeTable.setChildrenAllowed(flowStep,false);
    }
  }
}

Fixed version (ground truth):
protected void addFlowsToFolder(Folder folder,ProjectVersion projectVersion){
  IConfigurationService configurationService=context.getConfigurationService();
  List<Flow> flows=configurationService.findFlowsInProject(projectVersion.getId());
  for (  Flow flow : flows) {
    this.treeTable.setChildrenAllowed(folder,true);
    this.treeTable.addItem(flow);
    this.treeTable.setItemIcon(flow,Icons.FLOW);
    this.treeTable.setParent(flow,folder);
    List<FlowStep> flowSteps=flow.getFlowSteps();
    this.treeTable.setChildrenAllowed(flow,flowSteps.size() > 0);
    for (    FlowStep flowStep : flowSteps) {
      this.treeTable.addItem(flowStep);
      this.treeTable.setItemCaption(flowStep,flowStep.getName());
      this.treeTable.setItemIcon(flowStep,Icons.COMPONENT);
      this.treeTable.setParent(flowStep,flow);
      this.treeTable.setChildrenAllowed(flowStep,false);
    }
  }
}
Program: 167560
Project: 167560
Buggy source:
protected void addModelsToFolder(Folder folder,ProjectVersion projectVersion){
  IConfigurationService configurationService=context.getConfigurationService();
  List<Model> models=configurationService.findModelsInProject(projectVersion.getId());
  for (  Model model : models) {
    this.treeTable.addItem(model);
    this.treeTable.setItemIcon(model,Icons.MODEL);
    this.treeTable.setParent(model,folder);
    this.treeTable.setChildrenAllowed(model,false);
  }
}

Fixed version (ground truth):
protected void addModelsToFolder(Folder folder,ProjectVersion projectVersion){
  IConfigurationService configurationService=context.getConfigurationService();
  List<Model> models=configurationService.findModelsInProject(projectVersion.getId());
  for (  Model model : models) {
    this.treeTable.setChildrenAllowed(folder,true);
    this.treeTable.addItem(model);
    this.treeTable.setItemIcon(model,Icons.MODEL);
    this.treeTable.setParent(model,folder);
    this.treeTable.setChildrenAllowed(model,false);
  }
}