Program: 3167
Project: 3167
Buggy source:
public void setPlayer(final Player player) throws ConnectorException {
synchronized (playingFieldsMutex) {
    Connector.setInstance(this);
    Connector.getInstance().connect();
    if (this.player != null) {
      clearPlayer();
    }
    this.player=player;
    playingLister=new AbstractConnectorListener(){
      @Override public void messageSent(      ConnectorMessageEvent event){
synchronized (sentMessageFieldsMutex) {
          while (sentMessage != null) {
            try {
              sentMessageFieldsMutex.wait();
            }
 catch (            InterruptedException e) {
              return;
            }
          }
          sentMessage=event.getMessage();
          sentMessageFieldsMutex.notify();
        }
      }
    }
;
    Connector.getInstance().addConnectorListener(playingLister);
    playerCleared=false;
    playerThread=new Thread("String_Node_Str"){
      @Override public void run(){
        try {
          player.init();
          long startTime=System.currentTimeMillis();
          while (player.hasNextMessage()) {
            PlayerMessage message=player.getNextMessage();
switch (message.getType()) {
case SENT:
synchronized (sentMessageFieldsMutex) {
                while (sentMessage == null) {
                  try {
                    sentMessageFieldsMutex.wait();
                  }
 catch (                  InterruptedException e) {
                    if (playerCleared) {
                      return;
                    }
                  }
                }
                String sentMessage=TestConnector.this.sentMessage;
                TestConnector.this.sentMessage=null;
                sentMessageFieldsMutex.notify();
                if (!message.getMessage().equals(sentMessage)) {
                  throw new IllegalStateException("String_Node_Str" + sentMessage + "String_Node_Str"+ message.getMessage()+ "String_Node_Str");
                }
              }
            break;
case RECEIVED:
          long period=System.currentTimeMillis() - startTime - message.getTime();
        if (0 < period) {
          try {
            Thread.sleep(period);
          }
 catch (          InterruptedException e) {
            if (playerCleared) {
              return;
            }
          }
        }
      fireMessageReceived(message.getMessage());
    break;
}
if (playerCleared) {
  return;
}
}
}
  finally {
player.destory();
}
}
}
;
playerThread.setDaemon(true);
playerThread.start();
}
}

Fixed version (ground truth):
public void setPlayer(final Player player) throws ConnectorException {
synchronized (playingFieldsMutex) {
    Connector.setInstance(this);
    Connector.getInstance().connect();
    if (this.player != null) {
      clearPlayer();
    }
    this.player=player;
    playingLister=new AbstractConnectorListener(){
      @Override public void messageSent(      ConnectorMessageEvent event){
synchronized (sentMessageFieldsMutex) {
          while (sentMessage != null) {
            try {
              sentMessageFieldsMutex.wait();
            }
 catch (            InterruptedException e) {
              return;
            }
          }
          sentMessage=event.getMessage();
          sentMessageFieldsMutex.notify();
        }
      }
    }
;
    Connector.getInstance().addConnectorListener(playingLister);
    playerCleared=false;
    playerThread=new Thread("String_Node_Str"){
      @Override public void run(){
        try {
          player.init();
          long startTime=System.currentTimeMillis();
          while (player.hasNextMessage()) {
            PlayerMessage message=player.getNextMessage();
switch (message.getType()) {
case SENT:
synchronized (sentMessageFieldsMutex) {
                while (sentMessage == null) {
                  try {
                    sentMessageFieldsMutex.wait();
                  }
 catch (                  InterruptedException e) {
                    if (playerCleared) {
                      return;
                    }
                  }
                }
                String sentMessage=TestConnector.this.sentMessage;
                TestConnector.this.sentMessage=null;
                sentMessageFieldsMutex.notify();
                if (!message.getMessage().equals(sentMessage)) {
                  throw new IllegalStateException("String_Node_Str" + sentMessage + "String_Node_Str"+ message.getMessage()+ "String_Node_Str");
                }
              }
            break;
case RECEIVED:
          long period=System.currentTimeMillis() - startTime - message.getTime();
        if (period < 0) {
          try {
            Thread.sleep(-period);
          }
 catch (          InterruptedException e) {
            if (playerCleared) {
              return;
            }
          }
        }
      fireMessageReceived(message.getMessage());
    break;
}
if (playerCleared) {
  return;
}
}
}
  finally {
player.destory();
}
}
}
;
playerThread.setDaemon(true);
playerThread.start();
}
}