Program: 74542
Project: 74542
Buggy source:
private boolean _matchPort(Port patternPort,Port hostPort){
  int matchSize=_match.size();
  boolean success=true;
  NamedObj patternContainer=null;
  NamedObj hostContainer=null;
  _match.put(patternPort,hostPort);
  if (!_shallowMatchPort(patternPort,hostPort)) {
    success=false;
  }
  if (success) {
    patternContainer=patternPort.getContainer();
    hostContainer=hostPort.getContainer();
    Object patternObject=_match.get(patternContainer);
    if (patternObject != null && patternObject != hostContainer) {
      success=false;
    }
 else {
      Object hostMatch=_match.getKey(hostContainer);
      if (hostMatch != null && hostMatch != patternContainer) {
        success=false;
      }
    }
  }
  if (success) {
    ObjectList patternList=new ObjectList();
    patternList.add(patternContainer);
    ObjectList hostList=new ObjectList();
    hostList.add(hostContainer);
    Token collapsingToken=_getAttribute(patternContainer.getContainer(),RelationCollapsingAttribute.class);
    boolean collapsing=collapsingToken == null ? true : ((BooleanToken)collapsingToken).booleanValue();
    if (collapsing) {
      _temporaryMatch.put(patternContainer,hostContainer);
      Path patternPath=new Path(patternPort);
      Set<Relation> visitedRelations=new HashSet<Relation>();
      Set<Port> visitedPorts=new HashSet<Port>();
      boolean foundPath=findFirstPath(patternPort,patternPath,visitedRelations,visitedPorts);
      while (foundPath) {
        patternList.add(patternPath.clone());
        foundPath=findNextPath(patternPath,visitedRelations,visitedPorts);
      }
      Path hostPath=new Path(hostPort);
      visitedRelations=new HashSet<Relation>();
      visitedPorts=new HashSet<Port>();
      foundPath=findFirstPath(hostPort,hostPath,visitedRelations,visitedPorts);
      while (foundPath) {
        hostList.add(hostPath.clone());
        foundPath=findNextPath(hostPath,visitedRelations,visitedPorts);
      }
      _temporaryMatch.remove(patternContainer);
    }
 else {
      patternList.addAll((Collection<?>)patternPort.linkedRelationList());
      hostList.addAll((Collection<?>)hostPort.linkedRelationList());
    }
    success=_matchObject(patternList,hostList);
  }
  if (!success) {
    _match.retain(matchSize);
  }
  return success;
}

Fixed version (ground truth):
private boolean _matchPort(Port patternPort,Port hostPort){
  int matchSize=_match.size();
  boolean success=true;
  NamedObj patternContainer=null;
  NamedObj hostContainer=null;
  _match.put(patternPort,hostPort);
  if (!_shallowMatchPort(patternPort,hostPort)) {
    success=false;
  }
  if (success) {
    patternContainer=patternPort.getContainer();
    hostContainer=hostPort.getContainer();
    Object patternObject=_match.get(patternContainer);
    if (patternObject != null && patternObject != hostContainer) {
      success=false;
    }
 else {
      Object hostMatch=_match.getKey(hostContainer);
      if (hostMatch != null && hostMatch != patternContainer) {
        success=false;
      }
    }
  }
  if (success) {
    ObjectList patternList=new ObjectList();
    patternList.add(patternContainer);
    ObjectList hostList=new ObjectList();
    hostList.add(hostContainer);
    Token collapsingToken=_getAttribute(patternContainer.getContainer(),"String_Node_Str",RelationCollapsingAttribute.class);
    boolean collapsing=collapsingToken == null ? true : ((BooleanToken)collapsingToken).booleanValue();
    if (collapsing) {
      _temporaryMatch.put(patternContainer,hostContainer);
      Path patternPath=new Path(patternPort);
      Set<Relation> visitedRelations=new HashSet<Relation>();
      Set<Port> visitedPorts=new HashSet<Port>();
      boolean foundPath=findFirstPath(patternPort,patternPath,visitedRelations,visitedPorts);
      while (foundPath) {
        patternList.add(patternPath.clone());
        foundPath=findNextPath(patternPath,visitedRelations,visitedPorts);
      }
      Path hostPath=new Path(hostPort);
      visitedRelations=new HashSet<Relation>();
      visitedPorts=new HashSet<Port>();
      foundPath=findFirstPath(hostPort,hostPath,visitedRelations,visitedPorts);
      while (foundPath) {
        hostList.add(hostPath.clone());
        foundPath=findNextPath(hostPath,visitedRelations,visitedPorts);
      }
      _temporaryMatch.remove(patternContainer);
    }
 else {
      patternList.addAll((Collection<?>)patternPort.linkedRelationList());
      hostList.addAll((Collection<?>)hostPort.linkedRelationList());
    }
    success=_matchObject(patternList,hostList);
  }
  if (!success) {
    _match.retain(matchSize);
  }
  return success;
}