Program: 113332
Project: 113332
Buggy source:
private void processLeaseStateChanged(StageRequest method){
  try {
    final ASCIIString cellId=(ASCIIString)method.getArgs()[0];
    final Flease lease=(Flease)method.getArgs()[1];
    final FleaseException error=(FleaseException)method.getArgs()[2];
    if (error == null) {
      if (Logging.isDebug()) {
        Logging.logMessage(Logging.LEVEL_DEBUG,Category.replication,this,"String_Node_Str",localID,cellId,lease);
      }
    }
 else {
      Logging.logMessage(Logging.LEVEL_WARN,Category.replication,this,"String_Node_Str",localID,cellId,error);
    }
    final String fileId=cellToFileId.get(cellId);
    if (fileId != null) {
      ReplicatedFileState state=files.get(fileId);
      assert(state != null);
      if (state.isInvalidated()) {
        doInvalidated(state);
      }
      boolean leaseOk=false;
      if (error == null) {
        boolean localIsPrimary=(lease.getLeaseHolder() != null) && (lease.getLeaseHolder().equals(localID));
        ReplicaState oldState=state.getState();
        state.setLocalIsPrimary(localIsPrimary);
        state.setLease(lease);
        if (oldState == ReplicaState.PRIMARY && lease.getLeaseHolder() == null && lease.getLeaseTimeout_ms() == 0) {
          Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",localID,cellId,lease,error);
          failed(state,ErrorUtils.getInternalServerError(new IOException(fileId + "String_Node_Str")),"String_Node_Str");
        }
 else {
          if ((oldState == ReplicaState.BACKUP) || (oldState == ReplicaState.PRIMARY) || (oldState == ReplicaState.WAITING_FOR_LEASE)) {
            if (localIsPrimary) {
              if (oldState != ReplicaState.PRIMARY) {
                state.setMasterEpoch(lease.getMasterEpochNumber());
                doPrimary(state);
              }
            }
 else {
              if (oldState != ReplicaState.BACKUP) {
                state.setMasterEpoch(FleaseMessage.IGNORE_MASTER_EPOCH);
                doBackup(state);
              }
            }
          }
        }
      }
 else {
        failed(state,ErrorUtils.getInternalServerError(error),"String_Node_Str");
      }
    }
  }
 catch (  Exception ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + "String_Node_Str");
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
  }
}

Fixed version (ground truth):
private void processLeaseStateChanged(StageRequest method){
  try {
    final ASCIIString cellId=(ASCIIString)method.getArgs()[0];
    final Flease lease=(Flease)method.getArgs()[1];
    final FleaseException error=(FleaseException)method.getArgs()[2];
    if (error == null) {
      if (Logging.isDebug()) {
        Logging.logMessage(Logging.LEVEL_DEBUG,Category.replication,this,"String_Node_Str",localID,cellId,lease);
      }
    }
 else {
      Logging.logMessage(Logging.LEVEL_WARN,Category.replication,this,"String_Node_Str",localID,cellId,error);
    }
    final String fileId=cellToFileId.get(cellId);
    if (fileId != null) {
      ReplicatedFileState state=files.get(fileId);
      assert(state != null);
      if (state.isInvalidated()) {
        doInvalidated(state);
        return;
      }
      boolean leaseOk=false;
      if (error == null) {
        boolean localIsPrimary=(lease.getLeaseHolder() != null) && (lease.getLeaseHolder().equals(localID));
        ReplicaState oldState=state.getState();
        state.setLocalIsPrimary(localIsPrimary);
        state.setLease(lease);
        if (oldState == ReplicaState.PRIMARY && lease.getLeaseHolder() == null && lease.getLeaseTimeout_ms() == 0) {
          Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",localID,cellId,lease,error);
          failed(state,ErrorUtils.getInternalServerError(new IOException(fileId + "String_Node_Str")),"String_Node_Str");
        }
 else {
          if ((oldState == ReplicaState.BACKUP) || (oldState == ReplicaState.PRIMARY) || (oldState == ReplicaState.WAITING_FOR_LEASE)) {
            if (localIsPrimary) {
              if (oldState != ReplicaState.PRIMARY) {
                state.setMasterEpoch(lease.getMasterEpochNumber());
                doPrimary(state);
              }
            }
 else {
              if (oldState != ReplicaState.BACKUP) {
                state.setMasterEpoch(FleaseMessage.IGNORE_MASTER_EPOCH);
                doBackup(state);
              }
            }
          }
        }
      }
 else {
        failed(state,ErrorUtils.getInternalServerError(error),"String_Node_Str");
      }
    }
  }
 catch (  Exception ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,"String_Node_Str" + "String_Node_Str");
    Logging.logError(Logging.LEVEL_ERROR,this,ex);
  }
}