Program: 87165
Project: 87165
Buggy source:
public void performOperation(AtomicOperation executionOperation,ExecutionEntity execution){
  List<DebugSession> openSessions=debugSessionFactory.getSessions();
  final ExecutionEntity executionEntity=(ExecutionEntity)execution;
  if (openSessions.isEmpty()) {
    if (debugSessionFactory.isSuspend()) {
      debugSessionFactory.waitForOpenSession(new SuspendedExecutionImpl(executionEntity,executionOperation));
    }
 else {
      super.performOperation(executionOperation,executionEntity);
      return;
    }
  }
  DebugSessionImpl currentSession=null;
  BreakPoint breakPoint=null;
  if (NEXT_STEP_BREAK_POINT.get() != null) {
    StepBreakPoint stepBreakPoint=NEXT_STEP_BREAK_POINT.get();
    if (stepBreakPoint.breakOnOperation(executionOperation,executionEntity)) {
      NEXT_STEP_BREAK_POINT.remove();
      breakPoint=stepBreakPoint;
      currentSession=stepBreakPoint.getSession();
    }
  }
 else {
synchronized (DebugSessionFactory.getInstance()) {
      openSessions=debugSessionFactory.getSessions();
      for (      DebugSession debugSession : openSessions) {
        if (execution.getProcessInstanceId().equals(debugSession.getProcessInstanceId())) {
          currentSession=(DebugSessionImpl)debugSession;
          try {
            breakPoint=findBreakPoint(debugSession,executionOperation,executionEntity);
          }
 catch (          RuntimeException e) {
            currentSession.execption(e,execution,executionOperation);
            throw e;
          }
          break;
        }
 else         if (debugSession.getProcessInstanceId() == null) {
          if (currentSession == null) {
            try {
              breakPoint=findBreakPoint(debugSession,executionOperation,execution);
            }
 catch (            RuntimeException e) {
              ((DebugSessionImpl)debugSession).execption(e,execution,executionOperation);
              throw e;
            }
            if (breakPoint != null) {
              currentSession=(DebugSessionImpl)debugSession;
            }
          }
        }
      }
    }
  }
  boolean isSuspended=false;
  if (currentSession != null && breakPoint != null) {
    if (currentSession.getProcessInstanceId() == null) {
      currentSession.setProcessInstanceId(execution.getProcessInstanceId());
    }
    isSuspended=true;
    SuspendedExecutionImpl suspendedExecution=new SuspendedExecutionImpl((ExecutionEntity)execution,executionOperation,breakPoint);
    currentSession.suspend(suspendedExecution);
    if (suspendedExecution.isStep) {
      NEXT_STEP_BREAK_POINT.set(new StepBreakPoint(BEFORE_ACTIVITY.equals(breakPoint.getBreakPointSpec()) ? AFTER_ACTIVITY : BEFORE_ACTIVITY,currentSession));
    }
  }
  try {
    super.performOperation(executionOperation,execution);
    if (currentSession != null) {
      ExecutionEntity processInstance=execution.getProcessInstance();
      if (processInstance.isEnded()) {
        currentSession.setProcessInstanceId(null);
      }
    }
  }
 catch (  RuntimeException e) {
    if (isSuspended) {
      currentSession.execption(e,execution,executionOperation);
    }
    throw e;
  }
}

Fixed version (ground truth):
public void performOperation(AtomicOperation executionOperation,ExecutionEntity execution,boolean async){
  List<DebugSession> openSessions=debugSessionFactory.getSessions();
  final ExecutionEntity executionEntity=(ExecutionEntity)execution;
  if (openSessions.isEmpty()) {
    if (debugSessionFactory.isSuspend()) {
      debugSessionFactory.waitForOpenSession(new SuspendedExecutionImpl(executionEntity,executionOperation));
    }
 else {
      super.performOperation(executionOperation,executionEntity,async);
      return;
    }
  }
  DebugSessionImpl currentSession=null;
  BreakPoint breakPoint=null;
  if (NEXT_STEP_BREAK_POINT.get() != null) {
    StepBreakPoint stepBreakPoint=NEXT_STEP_BREAK_POINT.get();
    if (stepBreakPoint.breakOnOperation(executionOperation,executionEntity)) {
      NEXT_STEP_BREAK_POINT.remove();
      breakPoint=stepBreakPoint;
      currentSession=stepBreakPoint.getSession();
    }
  }
 else {
synchronized (DebugSessionFactory.getInstance()) {
      openSessions=debugSessionFactory.getSessions();
      for (      DebugSession debugSession : openSessions) {
        if (execution.getProcessInstanceId().equals(debugSession.getProcessInstanceId())) {
          currentSession=(DebugSessionImpl)debugSession;
          try {
            breakPoint=findBreakPoint(debugSession,executionOperation,executionEntity);
          }
 catch (          RuntimeException e) {
            currentSession.execption(e,execution,executionOperation);
            throw e;
          }
          break;
        }
 else         if (debugSession.getProcessInstanceId() == null) {
          if (currentSession == null) {
            try {
              breakPoint=findBreakPoint(debugSession,executionOperation,execution);
            }
 catch (            RuntimeException e) {
              ((DebugSessionImpl)debugSession).execption(e,execution,executionOperation);
              throw e;
            }
            if (breakPoint != null) {
              currentSession=(DebugSessionImpl)debugSession;
            }
          }
        }
      }
    }
  }
  boolean isSuspended=false;
  if (currentSession != null && breakPoint != null) {
    if (currentSession.getProcessInstanceId() == null) {
      currentSession.setProcessInstanceId(execution.getProcessInstanceId());
    }
    isSuspended=true;
    SuspendedExecutionImpl suspendedExecution=new SuspendedExecutionImpl((ExecutionEntity)execution,executionOperation,breakPoint);
    currentSession.suspend(suspendedExecution);
    if (suspendedExecution.isStep) {
      NEXT_STEP_BREAK_POINT.set(new StepBreakPoint(BEFORE_ACTIVITY.equals(breakPoint.getBreakPointSpec()) ? AFTER_ACTIVITY : BEFORE_ACTIVITY,currentSession));
    }
  }
  try {
    super.performOperation(executionOperation,execution,async);
    if (currentSession != null) {
      ExecutionEntity processInstance=execution.getProcessInstance();
      if (processInstance.isEnded()) {
        currentSession.setProcessInstanceId(null);
      }
    }
  }
 catch (  RuntimeException e) {
    if (isSuspended) {
      currentSession.execption(e,execution,executionOperation);
    }
    throw e;
  }
}