Program: 89236
Project: 89236
Buggy source:
protected HashMap<String,Pair<String,State>> deltaClusterSync(Connection conn){
  HashMap<String,Pair<String,State>> newStates;
  HashMap<String,Pair<String,State>> oldStates=null;
  final HashMap<String,Pair<String,State>> changes=new HashMap<String,Pair<String,State>>();
  newStates=getAllVms(conn);
  if (newStates == null) {
    s_logger.warn("String_Node_Str");
    return null;
  }
synchronized (s_vms) {
    oldStates=new HashMap<String,Pair<String,State>>(s_vms.size(_cluster));
    oldStates.putAll(s_vms.getClusterVmState(_cluster));
    for (    final Map.Entry<String,Pair<String,State>> entry : newStates.entrySet()) {
      final String vm=entry.getKey();
      State newState=entry.getValue().second();
      String host_uuid=entry.getValue().first();
      final Pair<String,State> oldState=oldStates.remove(vm);
      if (host_uuid != null && oldState != null) {
        if (!host_uuid.equals(oldState.first()) && newState != State.Stopped && newState != State.Stopping) {
          changes.put(vm,new Pair<String,State>(host_uuid,newState));
          s_vms.put(_cluster,host_uuid,vm,newState);
          continue;
        }
      }
      if (newState == State.Stopped && oldState != null && oldState.second() != State.Stopping && oldState.second() != State.Stopped) {
        newState=getRealPowerState(conn,vm);
      }
      if (s_logger.isTraceEnabled()) {
        s_logger.trace("String_Node_Str" + vm + "String_Node_Str"+ newState+ "String_Node_Str"+ (oldState != null ? oldState.toString() : "String_Node_Str"));
      }
      if (vm.startsWith("String_Node_Str")) {
        s_logger.warn("String_Node_Str");
        continue;
      }
      if (oldState == null) {
        s_vms.put(_cluster,host_uuid,vm,newState);
        s_logger.warn("String_Node_Str" + vm);
        changes.put(vm,new Pair<String,State>(host_uuid,newState));
      }
 else       if (oldState.second() == State.Starting) {
        if (newState == State.Running) {
          s_vms.put(_cluster,host_uuid,vm,newState);
        }
 else         if (newState == State.Stopped) {
          s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
        }
      }
 else       if (oldState.second() == State.Migrating) {
        if (newState == State.Running) {
          s_logger.debug("String_Node_Str" + vm);
          s_vms.put(_cluster,host_uuid,vm,newState);
        }
      }
 else       if (oldState.second() == State.Stopping) {
        if (newState == State.Stopped) {
          s_vms.put(_cluster,host_uuid,vm,newState);
        }
 else         if (newState == State.Running) {
          s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
        }
      }
 else       if (oldState.second() != newState) {
        s_vms.put(_cluster,host_uuid,vm,newState);
        if (newState == State.Stopped) {
        }
        changes.put(vm,new Pair<String,State>(host_uuid,newState));
      }
    }
    for (    final Map.Entry<String,Pair<String,State>> entry : oldStates.entrySet()) {
      final String vm=entry.getKey();
      final State oldState=entry.getValue().second();
      String host_uuid=entry.getValue().first();
      if (s_logger.isTraceEnabled()) {
        s_logger.trace("String_Node_Str" + vm + "String_Node_Str");
      }
      if (oldState == State.Stopping) {
        s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
        s_vms.remove(_cluster,host_uuid,vm);
      }
 else       if (oldState == State.Starting) {
        s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
      }
 else       if (oldState == State.Stopped) {
        s_vms.remove(_cluster,host_uuid,vm);
      }
 else       if (oldState == State.Migrating) {
        s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
      }
 else {
      }
    }
  }
  return changes;
}

Fixed version (ground truth):
protected HashMap<String,Pair<String,State>> deltaClusterSync(Connection conn){
  HashMap<String,Pair<String,State>> newStates;
  HashMap<String,Pair<String,State>> oldStates=null;
  final HashMap<String,Pair<String,State>> changes=new HashMap<String,Pair<String,State>>();
  newStates=getAllVms(conn);
  if (newStates == null) {
    s_logger.warn("String_Node_Str");
    return null;
  }
synchronized (s_vms) {
    oldStates=new HashMap<String,Pair<String,State>>(s_vms.size(_cluster));
    oldStates.putAll(s_vms.getClusterVmState(_cluster));
    for (    final Map.Entry<String,Pair<String,State>> entry : newStates.entrySet()) {
      final String vm=entry.getKey();
      State newState=entry.getValue().second();
      String host_uuid=entry.getValue().first();
      final Pair<String,State> oldState=oldStates.remove(vm);
      if (host_uuid != null && oldState != null) {
        if (!host_uuid.equals(oldState.first()) && newState != State.Stopped && newState != State.Stopping) {
          s_logger.warn("String_Node_Str" + vm);
          changes.put(vm,new Pair<String,State>(host_uuid,newState));
          s_vms.put(_cluster,host_uuid,vm,newState);
          continue;
        }
      }
      if (newState == State.Stopped && oldState != null && oldState.second() != State.Stopping && oldState.second() != State.Stopped) {
        newState=getRealPowerState(conn,vm);
      }
      if (s_logger.isTraceEnabled()) {
        s_logger.trace("String_Node_Str" + vm + "String_Node_Str"+ newState+ "String_Node_Str"+ (oldState != null ? oldState.toString() : "String_Node_Str"));
      }
      if (vm.startsWith("String_Node_Str")) {
        s_logger.warn("String_Node_Str");
        continue;
      }
      if (oldState == null) {
        s_vms.put(_cluster,host_uuid,vm,newState);
        s_logger.warn("String_Node_Str" + vm);
        changes.put(vm,new Pair<String,State>(host_uuid,newState));
      }
 else       if (oldState.second() == State.Starting) {
        if (newState == State.Running) {
          s_vms.put(_cluster,host_uuid,vm,newState);
        }
 else         if (newState == State.Stopped) {
          s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
        }
      }
 else       if (oldState.second() == State.Migrating) {
        if (newState == State.Running) {
          s_logger.debug("String_Node_Str" + vm);
          s_vms.put(_cluster,host_uuid,vm,newState);
        }
      }
 else       if (oldState.second() == State.Stopping) {
        if (newState == State.Stopped) {
          s_vms.put(_cluster,host_uuid,vm,newState);
        }
 else         if (newState == State.Running) {
          s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
        }
      }
 else       if (oldState.second() != newState) {
        s_vms.put(_cluster,host_uuid,vm,newState);
        if (newState == State.Stopped) {
        }
        changes.put(vm,new Pair<String,State>(host_uuid,newState));
      }
    }
    for (    final Map.Entry<String,Pair<String,State>> entry : oldStates.entrySet()) {
      final String vm=entry.getKey();
      final State oldState=entry.getValue().second();
      String host_uuid=entry.getValue().first();
      if (s_logger.isTraceEnabled()) {
        s_logger.trace("String_Node_Str" + vm + "String_Node_Str");
      }
      if (oldState == State.Stopping) {
        s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
        s_vms.remove(_cluster,host_uuid,vm);
      }
 else       if (oldState == State.Starting) {
        s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
      }
 else       if (oldState == State.Stopped) {
        s_vms.remove(_cluster,host_uuid,vm);
      }
 else       if (oldState == State.Migrating) {
        s_logger.warn("String_Node_Str" + vm + "String_Node_Str");
      }
 else {
        State newState=State.Stopped;
        changes.put(vm,new Pair<String,State>(host_uuid,newState));
      }
    }
  }
  return changes;
}