Program: 73063
Project: 73063
Buggy source:
/** 
 * Implement fire() with MetroII event handling.  In each iteration, getfire() waits until all other threads are blocked  and yield returns MetroII events. When getfire() continues, notify the  threads blocked on MetroII events based on the event status. A thread  blocked on MetroII event is not notified until the blocking MetroII  event is NOTIFIED.  The rest of the function is copied from fire() of ProcessDirector
 */
@Override public void getfire(ResultHandler<Iterable<Builder>> resultHandler) throws CollectionAbortedException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  Workspace workspace=workspace();
  CompositeActor container=(CompositeActor)getContainer();
  Director outsideDirector=container.getExecutiveDirector();
  if (!(outsideDirector instanceof ProcessDirector)) {
    outsideDirector=null;
  }
  int depth=0;
  try {
synchronized (this) {
      while (!_areThreadsDeadlocked() && !_areAllThreadsStopped() && !_stopRequested) {
        if (_stopRequested) {
          return;
        }
        if (_debugging) {
          _debug("String_Node_Str");
        }
        try {
          if (outsideDirector != null) {
            ((ProcessDirector)outsideDirector).threadBlocked(Thread.currentThread(),null);
          }
          if (depth == 0) {
            depth=workspace.releaseReadPermission();
          }
          System.out.println(_getActiveThreadsCount());
          System.out.println(_getMetroIIEventBlockedThreadsCount());
          System.out.println(_getStoppedThreadsCount());
          System.out.println(_getBlockedThreadsCount());
          while (!_areThreadsDeadlocked() && !_areAllThreadsStopped() && _getActiveThreadsCount() != _getMetroIIEventBlockedThreadsCount() + _getBlockedThreadsCount()) {
            wait(1);
          }
          if (!_areThreadsDeadlocked() && !_areAllThreadsStopped()) {
            System.out.println("String_Node_Str" + _proposedMetroIIEventList.size());
            ArrayList<Event.Builder> tmp_events=new ArrayList<Event.Builder>(_proposedMetroIIEventList);
            System.out.println("String_Node_Str" + tmp_events.size());
            _proposedMetroIIEventList.clear();
            resultHandler.handleResult(tmp_events);
            for (            Builder etb : tmp_events) {
              if (etb.getStatus() == Event.Status.NOTIFIED) {
                String event_name=etb.getName();
                Object lock=_eventLock.get(_eventName2Id(event_name));
synchronized (lock) {
                  lock.notifyAll();
                  System.out.println("String_Node_Str" + event_name);
                }
              }
 else {
                _proposedMetroIIEventList.add(etb);
              }
            }
          }
        }
 catch (        InterruptedException e) {
          stop();
          return;
        }
 finally {
          if (outsideDirector != null) {
            ((ProcessDirector)outsideDirector).threadUnblocked(Thread.currentThread(),null);
          }
        }
      }
      if (_debugging) {
        _debug("String_Node_Str");
      }
      if (_areThreadsDeadlocked() && !_stopRequested) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
        try {
          _notDone=_resolveDeadlock();
        }
 catch (        IllegalActionException e) {
          stop();
          try {
            throw e;
          }
 catch (          IllegalActionException e1) {
            e1.printStackTrace();
          }
        }
      }
    }
  }
  finally {
    if (depth > 0) {
      workspace.reacquireReadPermission(depth);
    }
  }
}

Fixed version (ground truth):
/** 
 * Implement fire() with MetroII event handling.  In each iteration, getfire() waits until all other threads are blocked  and yield returns MetroII events. When getfire() continues, notify the  threads blocked on MetroII events based on the event status. A thread  blocked on MetroII event is not notified until the blocking MetroII  event is NOTIFIED.  The rest of the function is copied from fire() of ProcessDirector
 */
@Override public void getfire(ResultHandler<Iterable<Builder>> resultHandler) throws CollectionAbortedException {
  if (_debugging) {
    _debug("String_Node_Str");
  }
  Workspace workspace=workspace();
  CompositeActor container=(CompositeActor)getContainer();
  Director outsideDirector=container.getExecutiveDirector();
  if (!(outsideDirector instanceof ProcessDirector)) {
    outsideDirector=null;
  }
  int depth=0;
  try {
synchronized (this) {
      while (!_areThreadsDeadlocked() && !_areAllThreadsStopped() && !_stopRequested) {
        if (_stopRequested) {
          return;
        }
        if (_debugging) {
          _debug("String_Node_Str");
        }
        try {
          if (outsideDirector != null) {
            ((ProcessDirector)outsideDirector).threadBlocked(Thread.currentThread(),null);
          }
          if (depth == 0) {
            depth=workspace.releaseReadPermission();
          }
          System.out.println("String_Node_Str" + _getActiveThreadsCount());
          System.out.println("String_Node_Str" + _getMetroIIEventBlockedThreadsCount());
          System.out.println("String_Node_Str" + _getStoppedThreadsCount());
          System.out.println("String_Node_Str" + _getBlockedThreadsCount());
          while (!_areThreadsDeadlocked() && !_areAllThreadsStopped() && _getActiveThreadsCount() != _getMetroIIEventBlockedThreadsCount() + _getBlockedThreadsCount()) {
            wait(1);
          }
          if (!_areThreadsDeadlocked() && !_areAllThreadsStopped()) {
            System.out.println("String_Node_Str" + _proposedMetroIIEventList.size());
            ArrayList<Event.Builder> tmp_events=new ArrayList<Event.Builder>(_proposedMetroIIEventList);
            System.out.println("String_Node_Str" + tmp_events.size());
            _proposedMetroIIEventList.clear();
            resultHandler.handleResult(tmp_events);
            for (            Builder etb : tmp_events) {
              if (etb.getStatus() == Event.Status.NOTIFIED) {
                String event_name=etb.getName();
                Object lock=_eventLock.get(_eventName2Id(event_name));
synchronized (lock) {
                  lock.notifyAll();
                  System.out.println("String_Node_Str" + event_name);
                }
              }
 else {
                _proposedMetroIIEventList.add(etb);
              }
            }
          }
        }
 catch (        InterruptedException e) {
          stop();
          return;
        }
 finally {
          if (outsideDirector != null) {
            ((ProcessDirector)outsideDirector).threadUnblocked(Thread.currentThread(),null);
          }
        }
      }
      if (_debugging) {
        _debug("String_Node_Str");
      }
      if (_areThreadsDeadlocked() && !_stopRequested) {
        if (_debugging) {
          _debug("String_Node_Str");
        }
        try {
          _notDone=_resolveDeadlock();
        }
 catch (        IllegalActionException e) {
          stop();
          try {
            throw e;
          }
 catch (          IllegalActionException e1) {
            e1.printStackTrace();
          }
        }
      }
    }
  }
  finally {
    if (depth > 0) {
      workspace.reacquireReadPermission(depth);
    }
  }
}