Program: 73724
Project: 73724
Buggy source:
public void actionPerformed(ActionEvent e){
  super.actionPerformed(e);
  SearchResultsFrame searchResultsFrame=new SearchResultsFrame(new NamedObj(),DbSearchFrame.this,DbSearchFrame.this.getConfiguration());
  SearchResultBuffer searchResultBuffer=new SearchResultBuffer();
  searchResultBuffer.addObserver(searchResultsFrame);
  SearchCriteria searchCriteria=new SearchCriteria();
  TransformationRule rule=getFrameController().getTransformationRule();
  Pattern pattern=rule.getPattern();
  ArrayList<Attribute> attributesList=new ArrayList<Attribute>();
  List<NamedObj> attributes=pattern.attributeList();
  for (Iterator iterator=attributes.iterator(); iterator.hasNext(); ) {
    NamedObj attribute=(NamedObj)iterator.next();
    if (attribute instanceof Variable) {
      attributesList.add((Variable)attribute);
    }
  }
  searchCriteria.setAttributes(attributesList);
  DBGraphSearchCriteria dbGraphSearchCriteria=new DBGraphSearchCriteria();
  List<Port> portsList=pattern.portList();
  ArrayList<Port> ports=new ArrayList<Port>();
  for (Iterator iterator=portsList.iterator(); iterator.hasNext(); ) {
    Port port=(Port)iterator.next();
    ports.add(port);
  }
  dbGraphSearchCriteria.setPortsList(ports);
  List<Relation> relationsList=pattern.relationList();
  ArrayList<Relation> relations=new ArrayList<Relation>();
  for (Iterator iterator=relationsList.iterator(); iterator.hasNext(); ) {
    Relation relation=(Relation)iterator.next();
    relations.add(relation);
  }
  dbGraphSearchCriteria.setRelationsList(relations);
  ArrayList<ComponentEntity> componentEntities=new ArrayList<ComponentEntity>();
  ArrayList<CompositeEntity> compositeEntities=new ArrayList<CompositeEntity>();
  for (Iterator iterator=pattern.entityList().iterator(); iterator.hasNext(); ) {
    Entity entity=(Entity)iterator.next();
    if (entity instanceof CompositeEntity) {
      compositeEntities.add((CompositeEntity)entity);
    }
 else     if (entity instanceof ComponentEntity) {
      componentEntities.add((ComponentEntity)entity);
    }
  }
  dbGraphSearchCriteria.setComponentEntitiesList(componentEntities);
  dbGraphSearchCriteria.setCompositeEntities(compositeEntities);
  searchCriteria.setDBGraphSearchCriteria(dbGraphSearchCriteria);
  if (attributesList.size() == 0 && pattern.portList().isEmpty() && pattern.relationList().isEmpty() && pattern.entityList().isEmpty()) {
    JOptionPane.showMessageDialog(DbSearchFrame.this,"String_Node_Str");
  }
 else {
    searchResultsFrame.pack();
    searchResultsFrame.setVisible(true);
    SearchManager searchManager=new SearchManager();
    try {
      searchManager.search(searchCriteria,searchResultBuffer);
    }
 catch (    DBConnectionException e1) {
      searchResultsFrame.setVisible(false);
      searchResultsFrame.dispose();
      MessageHandler.error("String_Node_Str",e1);
    }
catch (    DBExecutionException e2) {
      searchResultsFrame.setVisible(false);
      searchResultsFrame.dispose();
      MessageHandler.error("String_Node_Str",e2);
    }
  }
}

Fixed version (ground truth):
public void actionPerformed(ActionEvent e){
  super.actionPerformed(e);
  SearchResultsFrame searchResultsFrame=new SearchResultsFrame(new NamedObj(),DbSearchFrame.this,DbSearchFrame.this.getConfiguration());
  SearchResultBuffer searchResultBuffer=new SearchResultBuffer();
  searchResultBuffer.addObserver(searchResultsFrame);
  SearchCriteria searchCriteria=new SearchCriteria();
  TransformationRule rule=getFrameController().getTransformationRule();
  Pattern pattern=rule.getPattern();
  ArrayList<Attribute> attributesList=new ArrayList<Attribute>();
  List<NamedObj> attributes=pattern.attributeList();
  for (Iterator iterator=attributes.iterator(); iterator.hasNext(); ) {
    NamedObj attribute=(NamedObj)iterator.next();
    if (attribute instanceof Variable) {
      attributesList.add((Variable)attribute);
    }
  }
  searchCriteria.setAttributes(attributesList);
  DBGraphSearchCriteria dbGraphSearchCriteria=new DBGraphSearchCriteria();
  List<Port> portsList=pattern.portList();
  ArrayList<Port> ports=new ArrayList<Port>();
  for (Iterator iterator=portsList.iterator(); iterator.hasNext(); ) {
    Port port=(Port)iterator.next();
    ports.add(port);
  }
  dbGraphSearchCriteria.setPortsList(ports);
  List<Relation> relationsList=pattern.relationList();
  ArrayList<Relation> relations=new ArrayList<Relation>();
  for (Iterator iterator=relationsList.iterator(); iterator.hasNext(); ) {
    Relation relation=(Relation)iterator.next();
    relations.add(relation);
  }
  dbGraphSearchCriteria.setRelationsList(relations);
  ArrayList<ComponentEntity> componentEntities=new ArrayList<ComponentEntity>();
  ArrayList<CompositeEntity> compositeEntities=new ArrayList<CompositeEntity>();
  for (Iterator iterator=pattern.entityList().iterator(); iterator.hasNext(); ) {
    Entity entity=(Entity)iterator.next();
    if (entity instanceof CompositeEntity) {
      compositeEntities.add((CompositeEntity)entity);
    }
 else     if (entity instanceof ComponentEntity) {
      componentEntities.add((ComponentEntity)entity);
    }
  }
  dbGraphSearchCriteria.setComponentEntitiesList(componentEntities);
  dbGraphSearchCriteria.setCompositeEntities(compositeEntities);
  dbGraphSearchCriteria.setPattern(pattern);
  searchCriteria.setDBGraphSearchCriteria(dbGraphSearchCriteria);
  if (attributesList.size() == 0 && pattern.portList().isEmpty() && pattern.relationList().isEmpty() && pattern.entityList().isEmpty()) {
    JOptionPane.showMessageDialog(DbSearchFrame.this,"String_Node_Str");
  }
 else {
    searchResultsFrame.pack();
    searchResultsFrame.setVisible(true);
    SearchManager searchManager=new SearchManager();
    try {
      searchManager.search(searchCriteria,searchResultBuffer);
    }
 catch (    DBConnectionException e1) {
      searchResultsFrame.setVisible(false);
      searchResultsFrame.dispose();
      MessageHandler.error("String_Node_Str",e1);
    }
catch (    DBExecutionException e2) {
      searchResultsFrame.setVisible(false);
      searchResultsFrame.dispose();
      MessageHandler.error("String_Node_Str",e2);
    }
  }
}