Program: 107215
Project: 107215
Buggy source:
@Override @DB public Pair<NetworkGuru,NetworkVO> implementNetwork(long networkId,DeployDestination dest,ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
  Transaction.currentTxn();
  Pair<NetworkGuru,NetworkVO> implemented=new Pair<NetworkGuru,NetworkVO>(null,null);
  NetworkVO network=_networksDao.acquireInLockTable(networkId);
  if (network == null) {
    throw new ConcurrentOperationException("String_Node_Str" + networkId);
  }
  try {
    NetworkGuru guru=_networkGurus.get(network.getGuruName());
    Network.State state=network.getState();
    if (state == Network.State.Implemented || state == Network.State.Setup) {
      implemented.set(guru,network);
      return implemented;
    }
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + guru + "String_Node_Str"+ network);
    }
    NetworkOfferingVO offering=_networkOfferingDao.findById(network.getNetworkOfferingId());
    network.setState(Network.State.Implementing);
    network.setReservationId(context.getReservationId());
    _networksDao.update(networkId,network);
    Network result=guru.implement(network,offering,dest,context);
    network.setCidr(result.getCidr());
    network.setBroadcastUri(result.getBroadcastUri());
    network.setGateway(result.getGateway());
    network.setDns1(result.getDns1());
    network.setDns2(result.getDns2());
    network.setMode(result.getMode());
    _networksDao.update(networkId,network);
    for (    NetworkElement element : _networkElements) {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + element.getName() + "String_Node_Str"+ network);
      }
      element.implement(network,offering,dest,context);
    }
    network.setState(Network.State.Implemented);
    _networksDao.update(network.getId(),network);
    implemented.set(guru,network);
    return implemented;
  }
  finally {
    if (implemented.first() == null) {
      s_logger.debug("String_Node_Str" + network);
    }
    _networksDao.releaseFromLockTable(networkId);
  }
}

Fixed version (ground truth):
@Override @DB public Pair<NetworkGuru,NetworkVO> implementNetwork(long networkId,DeployDestination dest,ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
  Transaction.currentTxn();
  Pair<NetworkGuru,NetworkVO> implemented=new Pair<NetworkGuru,NetworkVO>(null,null);
  NetworkVO network=_networksDao.acquireInLockTable(networkId);
  if (network == null) {
    throw new ConcurrentOperationException("String_Node_Str" + networkId);
  }
  try {
    NetworkGuru guru=_networkGurus.get(network.getGuruName());
    Network.State state=network.getState();
    if (state == Network.State.Implemented || state == Network.State.Setup) {
      implemented.set(guru,network);
      return implemented;
    }
    if (s_logger.isDebugEnabled()) {
      s_logger.debug("String_Node_Str" + guru + "String_Node_Str"+ network);
    }
    NetworkOfferingVO offering=_networkOfferingDao.findById(network.getNetworkOfferingId());
    network.setState(Network.State.Implementing);
    _networksDao.update(networkId,network);
    Network result=guru.implement(network,offering,dest,context);
    network.setCidr(result.getCidr());
    network.setBroadcastUri(result.getBroadcastUri());
    network.setGateway(result.getGateway());
    network.setDns1(result.getDns1());
    network.setDns2(result.getDns2());
    network.setMode(result.getMode());
    _networksDao.update(networkId,network);
    for (    NetworkElement element : _networkElements) {
      if (s_logger.isDebugEnabled()) {
        s_logger.debug("String_Node_Str" + element.getName() + "String_Node_Str"+ network);
      }
      element.implement(network,offering,dest,context);
    }
    network.setReservationId(context.getReservationId());
    network.setState(Network.State.Implemented);
    _networksDao.update(network.getId(),network);
    implemented.set(guru,network);
    return implemented;
  }
  finally {
    if (implemented.first() == null) {
      s_logger.debug("String_Node_Str" + network);
    }
    _networksDao.releaseFromLockTable(networkId);
  }
}