Program: 19571
Project: 19571
Buggy source:
protected void execute() throws Exception {
  if (job == null) {
    throw new OddjobConfigException("String_Node_Str");
  }
  Object proxy;
  if (childHelper.size() == 0) {
    OddjobComponentResolver resolver=new OddjobComponentResolver();
    proxy=resolver.resolve(job,getArooaSession());
    if (proxy != job && proxy instanceof ArooaSessionAware) {
      ((ArooaSessionAware)proxy).setArooaSession(getArooaSession());
    }
    childHelper.addChild(proxy);
  }
 else {
    proxy=childHelper.getChild();
  }
  final LinkedList<State> states=new LinkedList<State>();
  StateListener listener=null;
  if (job instanceof Stateful) {
    listener=new StateListener(){
      synchronized public void jobStateChange(      StateEvent event){
synchronized (states) {
          states.add(event.getState());
          stateHandler().waitToWhen(new IsAnyState(),new Runnable(){
            public void run(){
              stateHandler.wake();
            }
          }
);
        }
      }
    }
;
    ((Stateful)job).addStateListener(listener);
  }
  if (proxy instanceof Runnable) {
    Runnable runnable=(Runnable)proxy;
    runnable.run();
  }
  if (job instanceof Stateful) {
    boolean executed=false;
    try {
      while (!stop) {
        State now=null;
synchronized (states) {
          if (!states.isEmpty()) {
            now=states.removeFirst();
            logger().debug("String_Node_Str" + now);
          }
        }
        if (now != null) {
          if (now.isDestroyed()) {
            childHelper.removeAllChildren();
            throw new IllegalStateException("String_Node_Str");
          }
          if (now.isStoppable()) {
            executed=true;
          }
          if (now.isPassable() && (executed || !now.isReady())) {
            logger().debug("String_Node_Str" + now);
            break;
          }
          continue;
        }
        logger().debug("String_Node_Str");
        sleep(0);
      }
    }
  finally {
      ((Stateful)job).removeStateListener(listener);
    }
  }
}

Fixed version (ground truth):
protected void execute() throws Exception {
  if (job == null) {
    throw new OddjobConfigException("String_Node_Str");
  }
  Object proxy;
  if (childHelper.size() == 0) {
    OddjobComponentResolver resolver=new OddjobComponentResolver();
    proxy=resolver.resolve(job,getArooaSession());
    if (proxy != job && proxy instanceof ArooaSessionAware) {
      ((ArooaSessionAware)proxy).setArooaSession(getArooaSession());
    }
    childHelper.addChild(proxy);
  }
 else {
    proxy=childHelper.getChild();
  }
  final LinkedList<State> states=new LinkedList<State>();
  StateListener listener=null;
  if (job instanceof Stateful) {
    listener=new StateListener(){
      public void jobStateChange(      StateEvent event){
synchronized (states) {
          states.add(event.getState());
          states.notifyAll();
        }
      }
    }
;
    ((Stateful)job).addStateListener(listener);
  }
  if (proxy instanceof Runnable) {
    Runnable runnable=(Runnable)proxy;
    runnable.run();
  }
  if (job instanceof Stateful) {
    boolean executed=false;
    try {
      while (!stop) {
        State now=null;
synchronized (states) {
          if (!states.isEmpty()) {
            now=states.removeFirst();
            logger().debug("String_Node_Str" + now);
          }
 else {
            logger().debug("String_Node_Str");
            iconHelper.changeIcon(IconHelper.SLEEPING);
            try {
              states.wait(0);
            }
 catch (            InterruptedException e) {
              logger().debug("String_Node_Str");
              Thread.currentThread().interrupt();
            }
            if (!stop) {
              iconHelper.changeIcon(IconHelper.EXECUTING);
            }
          }
        }
        if (now != null) {
          if (now.isDestroyed()) {
            childHelper.removeAllChildren();
            throw new IllegalStateException("String_Node_Str");
          }
          if (now.isStoppable()) {
            executed=true;
          }
          if (now.isPassable() && (executed || !now.isReady())) {
            logger().debug("String_Node_Str" + now);
            break;
          }
          continue;
        }
      }
    }
  finally {
      ((Stateful)job).removeStateListener(listener);
    }
  }
}