nus-yam/ex-repair huggingface dataset:
Program: 190277
Project: 190277
Buggy source:
public void goAlgo(){
  graph=graphModel.getHierarchicalGraphVisible();
  Node[] nodes=graph.getNodes().toArray();
  for (  Node n : nodes) {
    if (n.getNodeData().getLayoutData() == null || !(n.getNodeData().getLayoutData() instanceof ForceVector)) {
      n.getNodeData().setLayoutData(new ForceVector());
    }
  }
  QuadTree tree=QuadTree.buildTree(graph,getQuadTreeMaxLevel());
  BarnesHut barnes=new BarnesHut(getNodeForce());
  barnes.setTheta(getBarnesHutTheta());
  for (  Node node : nodes) {
    NodeData data=node.getNodeData();
    ForceVector layoutData=data.getLayoutData();
    ForceVector f=barnes.calculateForce(data,tree);
    layoutData.add(f);
  }
  for (  Edge e : graph.getEdgesAndMetaEdges()) {
    NodeData n1=e.getSource().getNodeData();
    NodeData n2=e.getTarget().getNodeData();
    ForceVector f1=n1.getLayoutData();
    ForceVector f2=n2.getLayoutData();
    ForceVector f=getEdgeForce().calculateForce(n1,n2);
    f1.add(f);
    f2.subtract(f);
  }
  energy0=energy;
  energy=0;
  double maxForce=1;
  for (  Node n : nodes) {
    NodeData data=n.getNodeData();
    ForceVector force=data.getLayoutData();
    energy+=force.getNorm();
    maxForce=Math.max(maxForce,force.getNorm());
  }
  for (  Node n : nodes) {
    NodeData data=n.getNodeData();
    ForceVector force=data.getLayoutData();
    force.multiply((float)(1.0 / maxForce));
    getDisplacement().moveNode(data,force);
  }
  postAlgo();
}

Fixed version (ground truth):
public void goAlgo(){
  graph=graphModel.getHierarchicalGraphVisible();
  Node[] nodes=graph.getNodes().toArray();
  for (  Node n : nodes) {
    if (n.getNodeData().getLayoutData() == null || !(n.getNodeData().getLayoutData() instanceof ForceVector)) {
      n.getNodeData().setLayoutData(new ForceVector());
    }
  }
  QuadTree tree=QuadTree.buildTree(graph,getQuadTreeMaxLevel());
  BarnesHut barnes=new BarnesHut(getNodeForce());
  barnes.setTheta(getBarnesHutTheta());
  for (  Node node : nodes) {
    NodeData data=node.getNodeData();
    ForceVector layoutData=data.getLayoutData();
    ForceVector f=barnes.calculateForce(data,tree);
    layoutData.add(f);
  }
  for (  Edge e : graph.getEdgesAndMetaEdges()) {
    NodeData n1=e.getSource().getNodeData();
    NodeData n2=e.getTarget().getNodeData();
    ForceVector f1=n1.getLayoutData();
    ForceVector f2=n2.getLayoutData();
    ForceVector f=getEdgeForce().calculateForce(n1,n2);
    f1.add(f);
    f2.subtract(f);
  }
  energy0=energy;
  energy=0;
  double maxForce=1;
  for (  Node n : nodes) {
    NodeData data=n.getNodeData();
    ForceVector force=data.getLayoutData();
    energy+=force.getNorm();
    maxForce=Math.max(maxForce,force.getNorm());
  }
  for (  Node n : nodes) {
    NodeData data=n.getNodeData();
    if (!data.isFixed()) {
      ForceVector force=data.getLayoutData();
      force.multiply((float)(1.0 / maxForce));
      getDisplacement().moveNode(data,force);
    }
  }
  postAlgo();
}
Program: 190278
Project: 190278
Buggy source:
private void importXML(InputStream stream,Importer importer,final Container container){
  final Document document=getDocument(stream);
  final XMLImporter xmlImporter=(XMLImporter)importer;
  final Report report=container.getReport();
  LongTask task=null;
  if (importer instanceof LongTask) {
    task=(LongTask)importer;
  }
  final LongTaskErrorHandler errorHandler=new LongTaskErrorHandler(){
    public void fatalError(    Throwable t){
      if (t instanceof OutOfMemoryError) {
        return;
      }
      Logger.getLogger("String_Node_Str").log(Level.WARNING,"String_Node_Str",t.getCause());
    }
  }
;
  executor.execute(task,new Runnable(){
    public void run(){
      try {
        if (xmlImporter.importData(document,container.getLoader(),report)) {
          finishImport(container);
        }
      }
 catch (      Exception ex) {
        throw new RuntimeException(ex);
      }
    }
  }
,"String_Node_Str" + container.getSource(),errorHandler);
}

Fixed version (ground truth):
private void importXML(final InputStream stream,Importer importer,final Container container){
  final XMLImporter xmlImporter=(XMLImporter)importer;
  final Report report=container.getReport();
  LongTask task=null;
  if (importer instanceof LongTask) {
    task=(LongTask)importer;
  }
  final LongTaskErrorHandler errorHandler=new LongTaskErrorHandler(){
    public void fatalError(    Throwable t){
      if (t instanceof OutOfMemoryError) {
        return;
      }
      t.printStackTrace();
      NotifyDescriptor.Message msg=new NotifyDescriptor.Message(t.getCause().getMessage(),NotifyDescriptor.WARNING_MESSAGE);
      DialogDisplayer.getDefault().notify(msg);
    }
  }
;
  executor.execute(task,new Runnable(){
    public void run(){
      try {
        final Document document=getDocument(stream);
        if (xmlImporter.importData(document,container.getLoader(),report)) {
          finishImport(container);
        }
      }
 catch (      Exception ex) {
        throw new RuntimeException(ex);
      }
    }
  }
,"String_Node_Str" + container.getSource(),errorHandler);
}
Program: 190279
Project: 190279
Buggy source:
private void importText(InputStream stream,Importer importer,final Container container){
  final LineNumberReader reader=getTextReader(stream);
  final TextImporter textImporter=(TextImporter)importer;
  final Report report=container.getReport();
  LongTask task=null;
  if (importer instanceof LongTask) {
    task=(LongTask)importer;
  }
  final LongTaskErrorHandler errorHandler=new LongTaskErrorHandler(){
    public void fatalError(    Throwable t){
      Logger.getLogger("String_Node_Str").log(Level.WARNING,"String_Node_Str",t.getCause());
    }
  }
;
  executor.execute(task,new Runnable(){
    public void run(){
      try {
        if (textImporter.importData(reader,container.getLoader(),report)) {
          finishImport(container);
        }
      }
 catch (      Exception ex) {
        throw new RuntimeException(ex);
      }
    }
  }
,"String_Node_Str" + container.getSource(),errorHandler);
}

Fixed version (ground truth):
private void importText(InputStream stream,Importer importer,final Container container){
  final LineNumberReader reader=getTextReader(stream);
  final TextImporter textImporter=(TextImporter)importer;
  final Report report=container.getReport();
  LongTask task=null;
  if (importer instanceof LongTask) {
    task=(LongTask)importer;
  }
  final LongTaskErrorHandler errorHandler=new LongTaskErrorHandler(){
    public void fatalError(    Throwable t){
      t.printStackTrace();
      NotifyDescriptor.Message msg=new NotifyDescriptor.Message(t.getCause().getMessage(),NotifyDescriptor.WARNING_MESSAGE);
      DialogDisplayer.getDefault().notify(msg);
    }
  }
;
  executor.execute(task,new Runnable(){
    public void run(){
      try {
        if (textImporter.importData(reader,container.getLoader(),report)) {
          finishImport(container);
        }
      }
 catch (      Exception ex) {
        throw new RuntimeException(ex);
      }
    }
  }
,"String_Node_Str" + container.getSource(),errorHandler);
}
Program: 190280
Project: 190280
Buggy source:
public TextLine(String text){
  this.text=text;
}

Fixed version (ground truth):
public TextLine(String text,Rectangle2D bounds){
  this.text=text;
  this.bounds=bounds;
}
Program: 190281
Project: 190281
Buggy source:
public void setLine(String line){
  this.line=new TextLine(line);
}

Fixed version (ground truth):
public void setLine(String line){
  this.line=new TextLine(line,this.line.bounds);
}
Program: 190282
Project: 190282
Buggy source:
private void deleteNode(AbstractNode node){
  for (DescendantAndSelfIterator itr=new DescendantAndSelfIterator(treeStructure,node,Tautology.instance); itr.hasNext(); ) {
    AbstractNode descendant=itr.next();
    if (descendant.isEnabled()) {
      edgeProcessor.clearMetaEdges(descendant);
      view.decNodesEnabled(1);
    }
    edgeProcessor.clearEdges(descendant);
    dhns.getGraphStructure().getNodeDictionnary().remove(descendant);
  }
  treeStructure.deleteDescendantAndSelf(node);
}

Fixed version (ground truth):
private void deleteNode(AbstractNode node){
  for (DescendantAndSelfIterator itr=new DescendantAndSelfIterator(treeStructure,node,Tautology.instance); itr.hasNext(); ) {
    AbstractNode descendant=itr.next();
    if (descendant.isEnabled()) {
      edgeProcessor.clearMetaEdges(descendant);
      view.decNodesEnabled(1);
    }
    edgeProcessor.clearEdges(descendant);
    if (node.countInViews() == 1) {
      dhns.getGraphStructure().getNodeDictionnary().remove(descendant);
    }
  }
  treeStructure.deleteDescendantAndSelf(node);
}
Program: 190283
Project: 190283
Buggy source:
public Node getOpposite(Node node,Edge edge){
  checkNode(node);
  AbstractEdge absEdge=checkEdge(edge);
  if (absEdge.getSource(view.getViewId()) == node) {
    return absEdge.getTarget();
  }
 else   if (absEdge.getTarget(view.getViewId()) == node) {
    return absEdge.getSource(view.getViewId());
  }
  throw new IllegalArgumentException("String_Node_Str");
}

Fixed version (ground truth):
public Node getOpposite(Node node,Edge edge){
  checkNode(node);
  AbstractEdge absEdge=checkEdge(edge);
  if (absEdge.getSource(view.getViewId()) == node) {
    return absEdge.getTarget(view.getViewId());
  }
 else   if (absEdge.getTarget(view.getViewId()) == node) {
    return absEdge.getSource(view.getViewId());
  }
  throw new IllegalArgumentException("String_Node_Str");
}
Program: 190284
Project: 190284
Buggy source:
protected void setSyntax(StreamTokenizer tk){
  tk.resetSyntax();
  tk.eolIsSignificant(false);
  tk.slashStarComments(true);
  tk.slashSlashComments(true);
  tk.whitespaceChars(0,' ');
  tk.wordChars(' ' + 1,'\u00ff');
  tk.ordinaryChar('[');
  tk.ordinaryChar(']');
  tk.ordinaryChar('{');
  tk.ordinaryChar('}');
  tk.ordinaryChar('-');
  tk.ordinaryChar('>');
  tk.ordinaryChar('/');
  tk.ordinaryChar('*');
  tk.quoteChar('"');
  tk.whitespaceChars(';',';');
  tk.ordinaryChar('=');
}

Fixed version (ground truth):
protected void setSyntax(StreamTokenizer tk){
  tk.resetSyntax();
  tk.eolIsSignificant(false);
  tk.slashStarComments(true);
  tk.slashSlashComments(true);
  tk.whitespaceChars(0,' ');
  tk.wordChars(' ' + 1,'\u00ff');
  tk.ordinaryChar('[');
  tk.ordinaryChar(']');
  tk.ordinaryChar('{');
  tk.ordinaryChar('}');
  tk.ordinaryChar('-');
  tk.ordinaryChar('>');
  tk.ordinaryChar('/');
  tk.ordinaryChar('*');
  tk.ordinaryChar(',');
  tk.quoteChar('"');
  tk.whitespaceChars(';',';');
  tk.ordinaryChar('=');
}
Program: 190285
Project: 190285
Buggy source:
public Node getPredecessor(Node node){
  return predecessors.get(node).getSource();
}

Fixed version (ground truth):
public Node getPredecessor(Node node){
  Edge edge=predecessors.get(node);
  if (edge != null) {
    if (edge.getSource() != node) {
      return edge.getSource();
    }
 else {
      return edge.getTarget();
    }
  }
  return null;
}
Program: 190286
Project: 190286
Buggy source:
public void compute(){
  graph.readLock();
  Set<Node> nodes=new HashSet<Node>();
  int nodeCount=0;
  for (  Node node : graph.getNodes()) {
    distances.put(node,Double.POSITIVE_INFINITY);
    nodes.add(node);
    nodeCount++;
  }
  distances.put(sourceNode,0d);
  while (!nodes.isEmpty()) {
    Double minDistance=Double.POSITIVE_INFINITY;
    Node minDistanceNode=null;
    for (    Node k : nodes) {
      Double dist=distances.get(k);
      if (dist.compareTo(minDistance) < 0) {
        minDistance=dist;
        minDistanceNode=k;
      }
    }
    Node currentNode=minDistanceNode;
    nodes.remove(currentNode);
    for (    Edge edge : graph.getEdges(currentNode)) {
      Node neighbor=graph.getOpposite(currentNode,edge);
      if (distances.get(neighbor).equals(Double.POSITIVE_INFINITY)) {
        double dist=edgeWeight(edge) + distances.get(currentNode);
        distances.put(neighbor,dist);
        maxDistance=Math.max(maxDistance,dist);
      }
 else {
        double testDistance=distances.get(currentNode) + edgeWeight(edge);
        if (testDistance < distances.get(neighbor)) {
          distances.put(neighbor,testDistance);
          maxDistance=Math.max(maxDistance,testDistance);
        }
      }
    }
  }
  graph.readUnlock();
}

Fixed version (ground truth):
public void compute(){
  graph.readLock();
  Set<Node> nodes=new HashSet<Node>();
  int nodeCount=0;
  for (  Node node : graph.getNodes()) {
    distances.put(node,Double.POSITIVE_INFINITY);
    nodes.add(node);
    nodeCount++;
  }
  distances.put(sourceNode,0d);
  while (!nodes.isEmpty()) {
    Double minDistance=Double.POSITIVE_INFINITY;
    Node minDistanceNode=null;
    for (    Node k : nodes) {
      Double dist=distances.get(k);
      if (dist.compareTo(minDistance) < 0) {
        minDistance=dist;
        minDistanceNode=k;
      }
    }
    Node currentNode=minDistanceNode;
    nodes.remove(currentNode);
    for (    Edge edge : graph.getEdges(currentNode)) {
      Node neighbor=graph.getOpposite(currentNode,edge);
      double dist=edgeWeight(edge) + distances.get(currentNode);
      if (distances.get(neighbor).equals(Double.POSITIVE_INFINITY)) {
        distances.put(neighbor,dist);
        maxDistance=Math.max(maxDistance,dist);
        predecessors.put(neighbor,edge);
      }
 else {
        if (dist < distances.get(neighbor)) {
          distances.put(neighbor,dist);
          maxDistance=Math.max(maxDistance,dist);
          predecessors.put(neighbor,edge);
        }
      }
    }
  }
  graph.readUnlock();
}
Program: 190287
Project: 190287
Buggy source:
public DijkstraShortestPathAlgorithm(Graph graph,Node sourceNode){
  super(sourceNode);
  this.graph=graph;
}

Fixed version (ground truth):
public DijkstraShortestPathAlgorithm(Graph graph,Node sourceNode){
  super(sourceNode);
  this.graph=graph;
  predecessors=new HashMap<Node,Edge>();
}
Program: 190288
Project: 190288
Buggy source:
/** 
 * Returns the Processing font related to the given classic font.
 * @param font  a classic font
 * @return      the related Processing font
 */
private PFont getPFont(Font font){
  if (fontMap.containsKey(font)) {
    return fontMap.get(font);
  }
  PFont pFont=createFont(font);
  fontMap.put(font,pFont);
  return pFont;
}

Fixed version (ground truth):
/** 
 * Returns the Processing font related to the given classic font.
 * @param font  a classic font
 * @return      the related Processing font
 */
private PFont getPFont(Font font){
  String fontName=font.getName();
  if (fontMap.containsKey(fontName)) {
    return fontMap.get(fontName);
  }
  PFont pFont=createFont(font);
  fontMap.put(fontName,pFont);
  return pFont;
}
Program: 190289
Project: 190289
Buggy source:
public void renderEdgeLabel(EdgeLabel label){
  textFont(getPFont(label.getFont()));
  textAlign(CENTER,BASELINE);
  pushMatrix();
  fill(label.getColor().getRed(),label.getColor().getGreen(),label.getColor().getBlue());
  translate(label.getPosition().getX(),label.getPosition().getY());
  rotate(label.getAngle());
  text(label.getValue(),0,0);
  popMatrix();
}

Fixed version (ground truth):
public void renderEdgeLabel(EdgeLabel label){
  textFont(label.getFont());
  textAlign(CENTER,BASELINE);
  pushMatrix();
  fill(label.getColor().getRed(),label.getColor().getGreen(),label.getColor().getBlue());
  translate(label.getPosition().getX(),label.getPosition().getY());
  rotate(label.getAngle());
  text(label.getValue(),0,0);
  popMatrix();
}
Program: 190290
Project: 190290
Buggy source:
/** 
 * Refreshes the preview using the current graph from the preview controller.
 */
public void refresh(){
  PreviewController controller=Lookup.getDefault().lookup(PreviewController.class);
  PreviewModel model=controller.getModel();
  fontMap.clear();
  if (model != null) {
    uniEdgeMiniLabelFont=getPFont(model.getUniEdgeSupervisor().getMiniLabelFont());
    biEdgeMiniLabelFont=getPFont(model.getBiEdgeSupervisor().getMiniLabelFont());
  }
  redraw();
}

Fixed version (ground truth):
/** 
 * Refreshes the preview using the current graph from the preview controller.
 */
public void refresh(){
  PreviewController controller=Lookup.getDefault().lookup(PreviewController.class);
  PreviewModel model=controller.getModel();
  if (model != null) {
    uniEdgeMiniLabelFont=getPFont(model.getUniEdgeSupervisor().getMiniLabelFont());
    biEdgeMiniLabelFont=getPFont(model.getBiEdgeSupervisor().getMiniLabelFont());
  }
  redraw();
}
Program: 190291
Project: 190291
Buggy source:
public void renderNodeLabel(NodeLabel label){
  textFont(getPFont(label.getFont()));
  textAlign(CENTER,CENTER);
  fill(label.getColor().getRed(),label.getColor().getGreen(),label.getColor().getBlue());
  text(label.getValue(),label.getPosition().getX(),label.getPosition().getY() - (textAscent() + textDescent()) * 0.1f);
}

Fixed version (ground truth):
public void renderNodeLabel(NodeLabel label){
  textFont(label.getFont());
  textAlign(CENTER,CENTER);
  fill(label.getColor().getRed(),label.getColor().getGreen(),label.getColor().getBlue());
  text(label.getValue(),label.getPosition().getX(),label.getPosition().getY() - (textAscent() + textDescent()) * 0.1f);
}
Program: 190292
Project: 190292
Buggy source:
/** 
 * Creates a Processing font from a classic font.
 * @param font  a font to transform
 * @return      a Processing font
 */
private PFont createFont(Font font){
  return createFont(font.getName(),font.getSize());
}

Fixed version (ground truth):
/** 
 * Creates a Processing font from a classic font.
 * @param font  a font to transform
 * @return      a Processing font
 */
private PFont createFont(Font font){
  return createFont(font.getName(),1);
}
Program: 190293
Project: 190293
Buggy source:
public void applyPreset(PreviewPreset preset){
  Map<String,String> propertiesMap=preset.getProperties();
  for (  Property p : getPropertiesMap().values()) {
    try {
      PropertyEditor editor=p.getPropertyEditor();
      if (editor == null) {
        editor=PropertyEditorManager.findEditor(p.getValueType());
      }
      if (editor != null) {
        String valueStr=propertiesMap.get(p.getName());
        if (valueStr != null && !valueStr.isEmpty()) {
          editor.setAsText(valueStr);
          Object value=editor.getValue();
          if (value != null) {
            p.setValue(value);
          }
        }
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}

Fixed version (ground truth):
public void applyPreset(PreviewPreset preset){
  Map<String,String> propertiesMap=preset.getProperties();
  for (  Property p : getPropertiesMap().values()) {
    try {
      PropertyEditor editor=p.getPropertyEditor();
      if (editor == null) {
        editor=PropertyEditorManager.findEditor(p.getValueType());
      }
      if (editor != null) {
        String valueStr=propertiesMap.get(p.getName());
        if (valueStr != null && !valueStr.isEmpty()) {
          editor.setAsText(valueStr);
          if (p.getValueType().equals(Font.class)) {
            editor.setValue(Font.decode(valueStr));
          }
          Object value=editor.getValue();
          if (value != null) {
            p.setValue(value);
          }
        }
      }
    }
 catch (    Exception e) {
      e.printStackTrace();
    }
  }
}
Program: 190294
Project: 190294
Buggy source:
public void actionPerformed(ActionEvent e){
  select(tool);
  propertiesBar.select(toolUI.getPropertiesBar(tool));
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  if (tool == currentTool) {
    toolbar.clearSelection();
    unselect();
  }
 else {
    select(tool);
    propertiesBar.select(toolUI.getPropertiesBar(tool));
  }
}
Program: 190295
Project: 190295
Buggy source:
public void stateChanged(ChangeEvent e){
  SelectionManager selectionManager=VizController.getInstance().getSelectionManager();
  if (selectionManager.isRectangleSelection() && currentTool != null) {
    toolbar.clearSelection();
    unselect();
  }
 else   if (selectionManager.isSelectionEnabled() && currentTool != null && currentTool.getSelectionType() == ToolSelectionType.NONE) {
    toolbar.clearSelection();
    unselect();
  }
}

Fixed version (ground truth):
public void stateChanged(ChangeEvent e){
  SelectionManager selectionManager=VizController.getInstance().getSelectionManager();
  if (selectionManager.isRectangleSelection() && currentTool != null) {
    toolbar.clearSelection();
    unselect();
  }
 else   if (selectionManager.isSelectionEnabled() && currentTool != null && currentTool.getSelectionType() == ToolSelectionType.NONE) {
    toolbar.clearSelection();
    unselect();
  }
 else   if (selectionManager.isDraggingEnabled() && currentTool != null) {
    toolbar.clearSelection();
    unselect();
  }
}
Program: 190297
Project: 190297
Buggy source:
public void setDraggingMouseSelection(){
  engine.setRectangleSelection(false);
  vizConfig.setDraggingEnable(true);
  vizConfig.setSelectionEnable(true);
  vizConfig.setCustomSelection(false);
  this.blocked=false;
  fireChangeEvent();
}

Fixed version (ground truth):
public void setDraggingMouseSelection(){
  engine.setRectangleSelection(false);
  vizConfig.setDraggingEnable(true);
  vizConfig.setMouseSelectionUpdateWhileDragging(false);
  vizConfig.setSelectionEnable(true);
  vizConfig.setCustomSelection(false);
  this.blocked=false;
  fireChangeEvent();
}
Program: 190298
Project: 190298
Buggy source:
public void renameProject(Project project,final String name){
  project.getLookup().lookup(ProjectInformationImpl.class);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      JFrame frame=(JFrame)WindowManager.getDefault().getMainWindow();
      String title=frame.getTitle();
      title=title.substring(0,title.indexOf('-') - 1);
      title+="String_Node_Str" + name;
      frame.setTitle(title);
    }
  }
);
}

Fixed version (ground truth):
public void renameProject(Project project,final String name){
  project.getLookup().lookup(ProjectInformationImpl.class).setName(name);
  SwingUtilities.invokeLater(new Runnable(){
    public void run(){
      JFrame frame=(JFrame)WindowManager.getDefault().getMainWindow();
      String title=frame.getTitle();
      title=title.substring(0,title.indexOf('-') - 1);
      title+="String_Node_Str" + name;
      frame.setTitle(title);
    }
  }
);
}
Program: 190299
Project: 190299
Buggy source:
public void save(Project project){
  ProjectInformation info=project.getLookup().lookup(ProjectInformation.class);
  if (info != null) {
    if (!titleTextField.getText().isEmpty() && !titleTextField.getText().equals(info.getName())) {
      ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
      pc.renameProject(project,titleTextField.getText());
    }
  }
  ProjectMetaData metaData=project.getLookup().lookup(ProjectMetaData.class);
  if (metaData != null) {
    metaData.setTitle(nameTextField.getText());
    metaData.setAuthor(authorTextField.getText());
    metaData.setKeywords(keywordsTextField.getText());
    metaData.setDescription(descriptionTextArea.getText());
  }
}

Fixed version (ground truth):
public void save(Project project){
  ProjectInformation info=project.getLookup().lookup(ProjectInformation.class);
  if (info != null) {
    if (!nameTextField.getText().isEmpty() && !nameTextField.getText().equals(info.getName())) {
      ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
      pc.renameProject(project,nameTextField.getText());
    }
  }
  ProjectMetaData metaData=project.getLookup().lookup(ProjectMetaData.class);
  if (metaData != null) {
    metaData.setTitle(titleTextField.getText());
    metaData.setAuthor(authorTextField.getText());
    metaData.setKeywords(keywordsTextField.getText());
    metaData.setDescription(descriptionTextArea.getText());
  }
}
Program: 190300
Project: 190300
Buggy source:
public ProjectControllerImpl(){
  longTaskExecutor=new LongTaskExecutor(true,"String_Node_Str");
  longTaskExecutor.setDefaultErrorHandler(new LongTaskErrorHandler(){
    public void fatalError(    Throwable t){
      unlockProjectActions();
      Logger.getLogger("String_Node_Str").log(Level.WARNING,"String_Node_Str",t.getCause());
    }
  }
);
  longTaskExecutor.setLongTaskListener(new LongTaskListener(){
    public void taskFinished(    LongTask task){
      unlockProjectActions();
    }
  }
);
  listeners=new ArrayList<WorkspaceListener>();
  listeners.addAll(Lookup.getDefault().lookupAll(WorkspaceListener.class));
  saveProject=false;
  saveAsProject=false;
  projectProperties=false;
  closeProject=false;
  newWorkspace=false;
  deleteWorkspace=false;
  cleanWorkspace=false;
  duplicateWorkspace=false;
}

Fixed version (ground truth):
public ProjectControllerImpl(){
  longTaskExecutor=new LongTaskExecutor(true,"String_Node_Str");
  longTaskExecutor.setDefaultErrorHandler(new LongTaskErrorHandler(){
    public void fatalError(    Throwable t){
      unlockProjectActions();
      if (t instanceof GephiFormatException && t.getCause() == null) {
        NotifyDescriptor.Message msg=new NotifyDescriptor.Message(t.getMessage(),NotifyDescriptor.WARNING_MESSAGE);
        DialogDisplayer.getDefault().notify(msg);
      }
      Logger.getLogger("String_Node_Str").log(Level.WARNING,"String_Node_Str",t.getCause());
    }
  }
);
  longTaskExecutor.setLongTaskListener(new LongTaskListener(){
    public void taskFinished(    LongTask task){
      unlockProjectActions();
    }
  }
);
  listeners=new ArrayList<WorkspaceListener>();
  listeners.addAll(Lookup.getDefault().lookupAll(WorkspaceListener.class));
  saveProject=false;
  saveAsProject=false;
  projectProperties=false;
  closeProject=false;
  newWorkspace=false;
  deleteWorkspace=false;
  cleanWorkspace=false;
  duplicateWorkspace=false;
}
Program: 190301
Project: 190301
Buggy source:
public void fatalError(Throwable t){
  unlockProjectActions();
  Logger.getLogger("String_Node_Str").log(Level.WARNING,"String_Node_Str",t.getCause());
}

Fixed version (ground truth):
public void fatalError(Throwable t){
  unlockProjectActions();
  if (t instanceof GephiFormatException && t.getCause() == null) {
    NotifyDescriptor.Message msg=new NotifyDescriptor.Message(t.getMessage(),NotifyDescriptor.WARNING_MESSAGE);
    DialogDisplayer.getDefault().notify(msg);
  }
  Logger.getLogger("String_Node_Str").log(Level.WARNING,"String_Node_Str",t.getCause());
}
Program: 190304
Project: 190304
Buggy source:
public boolean canFree(){
  this.graph=graphController.getModel().getHierarchicalGraphVisible();
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  for (  ModelImpl metaModelImpl : selectedNodeModels) {
    NodeData nodeData=(NodeData)metaModelImpl.getObj();
    if (nodeData.isFixed()) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean canFree(){
  GraphModel graphModel=graphController.getModel();
  if (graphModel == null) {
    return false;
  }
  this.graph=graphController.getModel().getHierarchicalGraphVisible();
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  for (  ModelImpl metaModelImpl : selectedNodeModels) {
    NodeData nodeData=(NodeData)metaModelImpl.getObj();
    if (nodeData.isFixed()) {
      return true;
    }
  }
  return false;
}
Program: 190305
Project: 190305
Buggy source:
public boolean canSettle(){
  this.graph=graphController.getModel().getHierarchicalGraphVisible();
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  for (  ModelImpl metaModelImpl : selectedNodeModels) {
    NodeData nodeData=(NodeData)metaModelImpl.getObj();
    if (!nodeData.isFixed()) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean canSettle(){
  GraphModel graphModel=graphController.getModel();
  if (graphModel == null) {
    return false;
  }
  this.graph=graphController.getModel().getHierarchicalGraphVisible();
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  for (  ModelImpl metaModelImpl : selectedNodeModels) {
    NodeData nodeData=(NodeData)metaModelImpl.getObj();
    if (!nodeData.isFixed()) {
      return true;
    }
  }
  return false;
}
Program: 190306
Project: 190306
Buggy source:
public boolean canUngroup(){
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  return selectedNodeModels.length >= 1;
}

Fixed version (ground truth):
public boolean canUngroup(){
  GraphModel graphModel=graphController.getModel();
  if (graphModel == null) {
    return false;
  }
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  return selectedNodeModels.length >= 1;
}
Program: 190307
Project: 190307
Buggy source:
public boolean canGroup(){
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  return selectedNodeModels.length >= 1;
}

Fixed version (ground truth):
public boolean canGroup(){
  GraphModel graphModel=graphController.getModel();
  if (graphModel == null) {
    return false;
  }
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  return selectedNodeModels.length >= 1;
}
Program: 190308
Project: 190308
Buggy source:
public boolean canExpand(){
  this.graph=graphController.getModel().getHierarchicalGraphVisible();
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  for (  ModelImpl metaModelImpl : selectedNodeModels) {
    NodeData nodeData=(NodeData)metaModelImpl.getObj();
    Node node=nodeData.getNode(graph.getView().getViewId());
    if (graph.getDescendantCount(node) > 0) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean canExpand(){
  GraphModel graphModel=graphController.getModel();
  if (graphModel == null) {
    return false;
  }
  this.graph=graphController.getModel().getHierarchicalGraphVisible();
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  for (  ModelImpl metaModelImpl : selectedNodeModels) {
    NodeData nodeData=(NodeData)metaModelImpl.getObj();
    Node node=nodeData.getNode(graph.getView().getViewId());
    if (graph.getDescendantCount(node) > 0) {
      return true;
    }
  }
  return false;
}
Program: 190309
Project: 190309
Buggy source:
public boolean canDelete(){
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  return selectedNodeModels.length >= 1;
}

Fixed version (ground truth):
public boolean canDelete(){
  GraphModel graphModel=graphController.getModel();
  if (graphModel == null) {
    return false;
  }
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  return selectedNodeModels.length >= 1;
}
Program: 190310
Project: 190310
Buggy source:
public boolean canContract(){
  this.graph=graphController.getModel().getHierarchicalGraphVisible();
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  for (  ModelImpl metaModelImpl : selectedNodeModels) {
    NodeData nodeData=(NodeData)metaModelImpl.getObj();
    Node node=nodeData.getNode(graph.getView().getViewId());
    if (graph.getParent(node) != null) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean canContract(){
  GraphModel graphModel=graphController.getModel();
  if (graphModel == null) {
    return false;
  }
  this.graph=graphController.getModel().getHierarchicalGraphVisible();
  ModelImpl[] selectedNodeModels=engine.getSelectedObjects(AbstractEngine.CLASS_NODE);
  for (  ModelImpl metaModelImpl : selectedNodeModels) {
    NodeData nodeData=(NodeData)metaModelImpl.getObj();
    Node node=nodeData.getNode(graph.getView().getViewId());
    if (graph.getParent(node) != null) {
      return true;
    }
  }
  return false;
}
Program: 190311
Project: 190311
Buggy source:
/** 
 * Set the default error handler. Use error handlers to get errors and exceptions thrown during tasks execution.
 * @param errorHandler the default error handler
 */
public void setDefaultErrorHandler(LongTaskErrorHandler errorHandler){
  if (errorHandler != null) {
    this.errorHandler=errorHandler;
  }
}

Fixed version (ground truth):
/** 
 * Set the default error handler. Use error handlers to get errors and exceptions thrown during tasks execution.
 * @param errorHandler the default error handler
 */
public void setDefaultErrorHandler(LongTaskErrorHandler errorHandler){
  if (errorHandler != null) {
    this.defaultErrorHandler=errorHandler;
  }
}
Program: 190314
Project: 190314
Buggy source:
public boolean requireUpdate(){
  if (graph == null) {
    GraphModel graphModel=controller.getModel();
    if (graphModel != null) {
      if (!graphModel.isDirected() && !graphModel.isUndirected() && !graphModel.isMixed()) {
        return false;
      }
 else {
        graph=graphModel.getHierarchicalGraphVisible();
      }
    }
  }
  if (graph != null) {
    if (graph.getGraphModel().getVisibleView().getViewId() != graphView) {
      reset();
    }
    return graph.getNodeVersion() > nodeVersion || graph.getEdgeVersion() > edgeVersion;
  }
  return false;
}

Fixed version (ground truth):
public boolean requireUpdate(){
  if (graph == null) {
    GraphModel graphModel=controller.getModel();
    if (graphModel != null) {
      graph=graphModel.getHierarchicalGraphVisible();
    }
  }
  if (graph != null) {
    if (graph.getGraphModel().getVisibleView().getViewId() != graphView) {
      reset();
    }
    return graph.getNodeVersion() > nodeVersion || graph.getEdgeVersion() > edgeVersion;
  }
  return false;
}
Program: 190315
Project: 190315
Buggy source:
public Element writeXML(Document document,Workspace workspace){
  Dhns dhns=workspace.getLookup().lookup(Dhns.class);
  DHNSSerializer serializer=new DHNSSerializer();
  return serializer.writeDhns(document,dhns);
}

Fixed version (ground truth):
public Element writeXML(Document document,Workspace workspace){
  DhnsGraphController graphController=Lookup.getDefault().lookup(DhnsGraphController.class);
  Dhns dhns=(Dhns)graphController.getModel(workspace);
  DHNSSerializer serializer=new DHNSSerializer();
  return serializer.writeDhns(document,dhns);
}
Program: 190317
Project: 190317
Buggy source:
private void initEvents(){
  model=new RankingUIModel();
  final ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  pc.addWorkspaceListener(new WorkspaceListener(){
    public void initialize(    Workspace workspace){
      workspace.add(new RankingUIModel());
    }
    public void select(    Workspace workspace){
      enabled=true;
      RankingUIModel newModel=workspace.getLookup().lookup(RankingUIModel.class);
      if (newModel != null) {
        model.loadModel(newModel);
      }
      refreshModel();
    }
    public void unselect(    Workspace workspace){
      RankingUIModel oldModel=workspace.getLookup().lookup(RankingUIModel.class);
      if (oldModel != null) {
        workspace.remove(oldModel);
      }
      workspace.add(model.saveModel());
    }
    public void close(    Workspace workspace){
    }
    public void disable(){
      enabled=false;
      refreshModel();
    }
  }
);
  if (pc.getCurrentWorkspace() != null) {
    RankingUIModel newModel=pc.getCurrentWorkspace().getLookup().lookup(RankingUIModel.class);
    if (newModel != null) {
      model.loadModel(newModel);
    }
  }
}

Fixed version (ground truth):
private void initEvents(){
  model=new RankingUIModel();
  final ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  pc.addWorkspaceListener(new WorkspaceListener(){
    public void initialize(    Workspace workspace){
      workspace.add(new RankingUIModel());
    }
    public void select(    Workspace workspace){
      enabled=true;
      RankingUIModel newModel=workspace.getLookup().lookup(RankingUIModel.class);
      if (newModel != null) {
        model.loadModel(newModel);
      }
      refreshModel();
    }
    public void unselect(    Workspace workspace){
      RankingUIModel oldModel=workspace.getLookup().lookup(RankingUIModel.class);
      if (oldModel != null) {
        workspace.remove(oldModel);
      }
      workspace.add(model.saveModel());
    }
    public void close(    Workspace workspace){
    }
    public void disable(){
      enabled=false;
      refreshModel();
    }
  }
);
  if (pc.getCurrentWorkspace() != null) {
    enabled=true;
    RankingUIModel newModel=pc.getCurrentWorkspace().getLookup().lookup(RankingUIModel.class);
    if (newModel != null) {
      model.loadModel(newModel);
    }
  }
}
Program: 190318
Project: 190318
Buggy source:
private RankingTopComponent(){
  setName(NbBundle.getMessage(RankingTopComponent.class,"String_Node_Str"));
  setToolTipText(NbBundle.getMessage(RankingTopComponent.class,"String_Node_Str"));
  setIcon(ImageUtilities.loadImage(ICON_PATH));
  RankingController rankingController=Lookup.getDefault().lookup(RankingController.class);
  rankingModel=rankingController.getRankingModel();
  initEvents();
  initComponents();
  initSouth();
  if (UIUtils.isAquaLookAndFeel()) {
    mainPanel.setBackground(UIManager.getColor("String_Node_Str"));
  }
  refreshModel();
}

Fixed version (ground truth):
private RankingTopComponent(){
  setName(NbBundle.getMessage(RankingTopComponent.class,"String_Node_Str"));
  setToolTipText(NbBundle.getMessage(RankingTopComponent.class,"String_Node_Str"));
  setIcon(ImageUtilities.loadImage(ICON_PATH));
  RankingController rankingController=Lookup.getDefault().lookup(RankingController.class);
  rankingModel=rankingController.getRankingModel();
  initEvents();
  initComponents();
  initSouth();
  if (UIUtils.isAquaLookAndFeel()) {
    mainPanel.setBackground(UIManager.getColor("String_Node_Str"));
  }
  refreshModel();
  final ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  if (pc.getCurrentWorkspace() != null) {
    ((RankingChooser)rankingChooser).refreshModel();
  }
}
Program: 190319
Project: 190319
Buggy source:
public RankingModelImpl(){
  final ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  final AttributeController ac=Lookup.getDefault().lookup(AttributeController.class);
  pc.addWorkspaceListener(new WorkspaceListener(){
    public void initialize(    Workspace workspace){
    }
    public void select(    Workspace workspace){
      nodeColumnsResult=ac.getModel().getNodeTable().getLookup().lookupResult(AttributeColumn.class);
      edgeColumnsResult=ac.getModel().getEdgeTable().getLookup().lookupResult(AttributeColumn.class);
      nodeColumnsResult.addLookupListener(RankingModelImpl.this);
      edgeColumnsResult.addLookupListener(RankingModelImpl.this);
    }
    public void unselect(    Workspace workspace){
      nodeColumnsResult.removeLookupListener(RankingModelImpl.this);
      edgeColumnsResult.removeLookupListener(RankingModelImpl.this);
      nodeColumnsResult=null;
      edgeColumnsResult=null;
    }
    public void close(    Workspace workspace){
    }
    public void disable(){
    }
  }
);
}

Fixed version (ground truth):
public RankingModelImpl(){
  final ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  final AttributeController ac=Lookup.getDefault().lookup(AttributeController.class);
  pc.addWorkspaceListener(new WorkspaceListener(){
    public void initialize(    Workspace workspace){
    }
    public void select(    Workspace workspace){
      nodeColumnsResult=ac.getModel().getNodeTable().getLookup().lookupResult(AttributeColumn.class);
      edgeColumnsResult=ac.getModel().getEdgeTable().getLookup().lookupResult(AttributeColumn.class);
      nodeColumnsResult.addLookupListener(RankingModelImpl.this);
      edgeColumnsResult.addLookupListener(RankingModelImpl.this);
    }
    public void unselect(    Workspace workspace){
      nodeColumnsResult.removeLookupListener(RankingModelImpl.this);
      edgeColumnsResult.removeLookupListener(RankingModelImpl.this);
      nodeColumnsResult=null;
      edgeColumnsResult=null;
    }
    public void close(    Workspace workspace){
    }
    public void disable(){
    }
  }
);
  if (pc.getCurrentWorkspace() != null) {
    nodeColumnsResult=ac.getModel().getNodeTable().getLookup().lookupResult(AttributeColumn.class);
    edgeColumnsResult=ac.getModel().getEdgeTable().getLookup().lookupResult(AttributeColumn.class);
    nodeColumnsResult.addLookupListener(RankingModelImpl.this);
    edgeColumnsResult.addLookupListener(RankingModelImpl.this);
  }
}
Program: 190320
Project: 190320
Buggy source:
public void actionPerformed(ActionEvent e){
  ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  pc.closeCurrentProject();
  DialogFileFilter filter=new DialogFileFilter(NbBundle.getMessage(OpenProject.class,"String_Node_Str"));
  filter.addExtension("String_Node_Str");
  String lastPathDefault=NbPreferences.forModule(OpenProject.class).get(LAST_PATH_DEFAULT,null);
  String lastPath=NbPreferences.forModule(OpenProject.class).get(LAST_PATH,lastPathDefault);
  final JFileChooser chooser=new JFileChooser(lastPath);
  chooser.addChoosableFileFilter(filter);
  int returnFile=chooser.showOpenDialog(null);
  if (returnFile == JFileChooser.APPROVE_OPTION) {
    File file=chooser.getSelectedFile();
    file=FileUtil.normalizeFile(file);
    FileObject fileObject=FileUtil.toFileObject(file);
    NbPreferences.forModule(OpenProject.class).put(LAST_PATH,file.getAbsolutePath());
    try {
      DataObject doe=DataObject.find(fileObject);
      pc.loadProject(doe);
    }
 catch (    Exception ew) {
      Exceptions.printStackTrace(ew);
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  ProjectController pc=Lookup.getDefault().lookup(ProjectController.class);
  if (!pc.closeCurrentProject()) {
    return;
  }
  DialogFileFilter filter=new DialogFileFilter(NbBundle.getMessage(OpenProject.class,"String_Node_Str"));
  filter.addExtension("String_Node_Str");
  String lastPathDefault=NbPreferences.forModule(OpenProject.class).get(LAST_PATH_DEFAULT,null);
  String lastPath=NbPreferences.forModule(OpenProject.class).get(LAST_PATH,lastPathDefault);
  final JFileChooser chooser=new JFileChooser(lastPath);
  chooser.addChoosableFileFilter(filter);
  int returnFile=chooser.showOpenDialog(null);
  if (returnFile == JFileChooser.APPROVE_OPTION) {
    File file=chooser.getSelectedFile();
    file=FileUtil.normalizeFile(file);
    FileObject fileObject=FileUtil.toFileObject(file);
    NbPreferences.forModule(OpenProject.class).put(LAST_PATH,file.getAbsolutePath());
    try {
      DataObject doe=DataObject.find(fileObject);
      pc.loadProject(doe);
    }
 catch (    Exception ew) {
      Exceptions.printStackTrace(ew);
    }
  }
}
Program: 190321
Project: 190321
Buggy source:
public void closeCurrentProject();

Fixed version (ground truth):
public boolean closeCurrentProject();
Program: 190322
Project: 190322
Buggy source:
public void newProject(){
  closeCurrentProject();
  ProjectImpl project=new ProjectImpl();
  projects.addProject(project);
  openProject(project);
}

Fixed version (ground truth):
public void newProject(){
  if (closeCurrentProject()) {
    ProjectImpl project=new ProjectImpl();
    projects.addProject(project);
    openProject(project);
  }
}
Program: 190323
Project: 190323
Buggy source:
public void removeProject(Project project){
  if (projects.getCurrentProject() == project) {
    closeCurrentProject();
  }
  projects.removeProject(project);
}

Fixed version (ground truth):
public void removeProject(Project project){
  if (projects.getCurrentProject() == project) {
    if (!closeCurrentProject()) {
      return;
    }
  }
  projects.removeProject(project);
}
Program: 190326
Project: 190326
Buggy source:
public boolean init(Graph graph){
  values=new ArrayList<Object>();
  return true;
}

Fixed version (ground truth):
public boolean init(Graph graph){
  if (range == null) {
    getValues();
    refreshRange();
  }
  values=new ArrayList<Object>();
  return true;
}
Program: 190327
Project: 190327
Buggy source:
public boolean init(Graph graph){
  values=new ArrayList<Float>(graph.getEdgeCount());
  min=Float.POSITIVE_INFINITY;
  max=Float.NEGATIVE_INFINITY;
  return true;
}

Fixed version (ground truth):
public boolean init(Graph graph){
  if (range == null) {
    getValues();
    refreshRange();
  }
  values=new ArrayList<Float>(graph.getEdgeCount());
  min=Float.POSITIVE_INFINITY;
  max=Float.NEGATIVE_INFINITY;
  return true;
}
Program: 190328
Project: 190328
Buggy source:
private void refreshRange(){
  Float lowerBound=range.getLowerFloat();
  Float upperBound=range.getUpperFloat();
  if ((Float)min > lowerBound || (Float)max < lowerBound || lowerBound.equals(upperBound)) {
    lowerBound=(Float)min;
  }
  if ((Float)min > upperBound || (Float)max < upperBound || lowerBound.equals(upperBound)) {
    upperBound=(Float)max;
  }
  range=new Range(lowerBound,upperBound);
}

Fixed version (ground truth):
private void refreshRange(){
  if (range == null) {
    range=new Range(min,max);
  }
 else {
    range.trimBounds(min,max);
  }
}
Program: 190329
Project: 190329
Buggy source:
public boolean init(Graph graph){
  values=new ArrayList<Integer>(graph.getNodeCount());
  min=Integer.MAX_VALUE;
  max=Integer.MIN_VALUE;
  return true;
}

Fixed version (ground truth):
public boolean init(Graph graph){
  if (range == null) {
    getValues();
    refreshRange();
  }
  values=new ArrayList<Integer>(graph.getNodeCount());
  min=Integer.MAX_VALUE;
  max=Integer.MIN_VALUE;
  return true;
}
Program: 190330
Project: 190330
Buggy source:
private void refreshRange(){
  Integer lowerBound=range.getLowerInteger();
  Integer upperBound=range.getUpperInteger();
  if ((Integer)min > lowerBound || (Integer)max < lowerBound || lowerBound.equals(upperBound)) {
    lowerBound=(Integer)min;
  }
  if ((Integer)min > upperBound || (Integer)max < upperBound || lowerBound.equals(upperBound)) {
    upperBound=(Integer)max;
  }
  range=new Range(lowerBound,upperBound);
}

Fixed version (ground truth):
private void refreshRange(){
  if (range == null) {
    range=new Range(min,max);
  }
 else {
    range.trimBounds(min,max);
  }
}
Program: 190331
Project: 190331
Buggy source:
public boolean init(Graph graph){
  if (!(graph instanceof DirectedGraph)) {
    return false;
  }
  values=new ArrayList<Integer>(graph.getNodeCount());
  min=Integer.MAX_VALUE;
  max=Integer.MIN_VALUE;
  return true;
}

Fixed version (ground truth):
public boolean init(Graph graph){
  if (!(graph instanceof DirectedGraph)) {
    return false;
  }
  if (range == null) {
    getValues();
    refreshRange();
  }
  values=new ArrayList<Integer>(graph.getNodeCount());
  min=Integer.MAX_VALUE;
  max=Integer.MIN_VALUE;
  return true;
}
Program: 190332
Project: 190332
Buggy source:
private void refreshRange(){
  Integer lowerBound=range.getLowerInteger();
  Integer upperBound=range.getUpperInteger();
  if ((Integer)min > lowerBound || (Integer)max < lowerBound || lowerBound.equals(upperBound)) {
    lowerBound=(Integer)min;
  }
  if ((Integer)min > upperBound || (Integer)max < upperBound || lowerBound.equals(upperBound)) {
    upperBound=(Integer)max;
  }
  range=new Range(lowerBound,upperBound);
}

Fixed version (ground truth):
private void refreshRange(){
  if (range == null) {
    range=new Range(min,max);
  }
 else {
    range.trimBounds(min,max);
  }
}
Program: 190333
Project: 190333
Buggy source:
public boolean init(Graph graph){
  if (!(graph instanceof DirectedGraph)) {
    return false;
  }
  values=new ArrayList<Integer>(graph.getNodeCount());
  min=Integer.MAX_VALUE;
  max=Integer.MIN_VALUE;
  return true;
}

Fixed version (ground truth):
public boolean init(Graph graph){
  if (!(graph instanceof DirectedGraph)) {
    return false;
  }
  if (range == null) {
    getValues();
    refreshRange();
  }
  values=new ArrayList<Integer>(graph.getNodeCount());
  min=Integer.MAX_VALUE;
  max=Integer.MIN_VALUE;
  return true;
}
Program: 190334
Project: 190334
Buggy source:
private void refreshRange(){
  Integer lowerBound=range.getLowerInteger();
  Integer upperBound=range.getUpperInteger();
  if ((Integer)min > lowerBound || (Integer)max < lowerBound || lowerBound.equals(upperBound)) {
    lowerBound=(Integer)min;
  }
  if ((Integer)min > upperBound || (Integer)max < upperBound || lowerBound.equals(upperBound)) {
    upperBound=(Integer)max;
  }
  range=new Range(lowerBound,upperBound);
}

Fixed version (ground truth):
private void refreshRange(){
  if (range == null) {
    range=new Range(min,max);
  }
 else {
    range.trimBounds(min,max);
  }
}