Program: 115932
Project: 115932
Buggy source:
@Override public void terminateInstance(String memberId) throws InvalidMemberException, InvalidCartridgeTypeException, CloudControllerException {
  try {
    handleNullObject(memberId,"String_Node_Str");
    MemberContext memberContext=CloudControllerContext.getInstance().getMemberContextOfMemberId(memberId);
    if (memberContext == null) {
      String msg="String_Node_Str" + memberId;
      log.error(msg);
      throw new InvalidMemberException(msg);
    }
    if (StringUtils.isBlank(memberContext.getInstanceId())) {
      if (log.isErrorEnabled()) {
        log.error(String.format("String_Node_Str" + "String_Node_Str",memberContext.getMemberId()));
      }
      CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext);
    }
    TopologyManager.acquireWriteLock();
    Topology topology=TopologyManager.getTopology();
    org.apache.stratos.messaging.domain.topology.Service service=topology.getService(memberContext.getCartridgeType());
    if (service != null) {
      Cluster cluster=service.getCluster(memberContext.getClusterId());
      if (cluster != null) {
        Member member=cluster.getMember(memberId);
        if (member != null) {
          if (fixMemberStatus(member,topology)) {
            memberContext.setObsoleteInitTime(System.currentTimeMillis());
          }
          if (isMemberExpired(member,memberContext.getObsoleteInitTime(),memberContext.getObsoleteExpiryTime())) {
            if (log.isInfoEnabled()) {
              log.info(String.format("String_Node_Str",memberContext.getMemberId()));
            }
            CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext);
            return;
          }
        }
      }
    }
    executorService.execute(new InstanceTerminator(memberContext));
  }
 catch (  InvalidMemberException e) {
    String message="String_Node_Str" + memberId;
    log.error(message,e);
    throw e;
  }
catch (  Exception e) {
    String message="String_Node_Str" + memberId;
    log.error(message,e);
    throw new CloudControllerException(message,e);
  }
 finally {
    TopologyManager.releaseWriteLock();
  }
}

Fixed version (ground truth):
@Override public void terminateInstance(String memberId) throws InvalidMemberException, InvalidCartridgeTypeException, CloudControllerException {
  try {
    handleNullObject(memberId,"String_Node_Str");
    MemberContext memberContext=CloudControllerContext.getInstance().getMemberContextOfMemberId(memberId);
    if (memberContext == null) {
      String msg="String_Node_Str" + memberId;
      log.error(msg);
      throw new InvalidMemberException(msg);
    }
    if (StringUtils.isBlank(memberContext.getInstanceId())) {
      if (log.isErrorEnabled()) {
        log.error(String.format("String_Node_Str" + "String_Node_Str",memberContext.getMemberId()));
      }
      CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext);
    }
    TopologyManager.acquireWriteLock();
    Topology topology=TopologyManager.getTopology();
    org.apache.stratos.messaging.domain.topology.Service service=topology.getService(memberContext.getCartridgeType());
    if (service != null) {
      Cluster cluster=service.getCluster(memberContext.getClusterId());
      if (cluster != null) {
        Member member=cluster.getMember(memberId);
        if (member != null) {
          if (isMemberExpired(member,memberContext.getObsoleteInitTime(),memberContext.getObsoleteExpiryTime())) {
            if (log.isInfoEnabled()) {
              log.info(String.format("String_Node_Str",memberContext.getMemberId()));
            }
            CloudControllerServiceUtil.executeMemberTerminationPostProcess(memberContext);
            return;
          }
        }
      }
    }
    executorService.execute(new InstanceTerminator(memberContext));
  }
 catch (  InvalidMemberException e) {
    String message="String_Node_Str" + memberId;
    log.error(message,e);
    throw e;
  }
catch (  Exception e) {
    String message="String_Node_Str" + memberId;
    log.error(message,e);
    throw new CloudControllerException(message,e);
  }
 finally {
    TopologyManager.releaseWriteLock();
  }
}