Program: 45343
Project: 45343
Buggy source:
void sendMsgThroSocket(Message message){
  ObjectOutputStream oos=null;
  try {
    sendData=null;
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    oos=new ObjectOutputStream(bos);
synchronized (message) {
      try {
        oos.writeObject((Object)message);
      }
 catch (      ConcurrentModificationException e) {
        if (Preferences.DEBUG_MODE)         System.out.println("String_Node_Str");
      }
    }
    oos.flush();
    sendData=bos.toByteArray();
    DatagramPacket udpsendPacket=null;
    DatagramSocket udpClientSocket=null;
    prop=new Properties();
    prop.load(new FileInputStream(conf_file));
    udpClientSocket=new DatagramSocket();
    udpClientSocket.setReceiveBufferSize(5000);
    udpClientSocket.setSendBufferSize(5000);
    if (message instanceof MulticastMessage) {
      if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.GET_MUTEX) {
synchronized (process_state) {
synchronized (arrMutexAckReceived) {
            arrMutexAckReceived[(this.nodes.get(host_name)).getIndex()]=true;
          }
        }
      }
 else       if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.RELEASE_MUTEX) {
synchronized (process_state) {
synchronized (arrMutexAckReceived) {
synchronized (mutexQueue) {
              process_state=Process_State.RELEASED;
              for (int i=0; i < arrMutexAckReceived.length; i++) {
                arrMutexAckReceived[i]=false;
              }
              while (!mutexQueue.isEmpty()) {
                MulticastMessage mutexAckMsg=new MulticastMessage(mutexQueue.remove(0),MulticastMessage.MessageType.MUTEX_ACK);
                mutexAckMsg.setDest(mutexAckMsg.getSource());
                mutexAckMsg.setSource(host_name);
                sendMsgThroSocket(mutexAckMsg);
              }
              return;
            }
          }
        }
      }
      if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.UPDATE_STATE || ((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.RUT || ((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.MUTEX_ACK) {
        if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.MUTEX_ACK) {
          System.out.println("String_Node_Str" + message.getDest());
        }
        if (message.getDest().equalsIgnoreCase(Preferences.LOGGER_NAME)) {
          udpsendPacket=new DatagramPacket(sendData,sendData.length,InetAddress.getByName(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")),Integer.parseInt(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")));
        }
 else {
          if (this.nodes.containsKey(message.getDest())) {
            udpsendPacket=new DatagramPacket(sendData,sendData.length,this.nodes.get(message.getDest()).getAdrress(),this.nodes.get(message.getDest()).getNodePort());
          }
        }
        if (this.nodes.get(host_name) != null && this.nodes.get(host_name).getBatteryLevel() >= Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND) {
          udpClientSocket.send(udpsendPacket);
        }
        if (this.nodes.get(host_name) != null && !message.getDest().equals(Preferences.LOGGER_NAME) && !message.getSource().equals(Preferences.LOGGER_NAME)) {
          this.nodes.get(host_name).decrBatteryLevel(Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND);
        }
      }
 else {
        Object[] node_names=this.node_addresses.keySet().toArray();
        for (int i=0; i < node_names.length; i++) {
          if (!host_name.equalsIgnoreCase((String)node_names[i]) && !Preferences.crashNode.equalsIgnoreCase((String)node_names[i])) {
            if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.GET_MUTEX) {
              System.out.println("String_Node_Str" + message.getDest());
            }
            if (message.getDest().equalsIgnoreCase(Preferences.LOGGER_NAME)) {
              udpsendPacket=new DatagramPacket(sendData,sendData.length,InetAddress.getByName(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")),Integer.parseInt(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")));
            }
 else {
              if (this.nodes.containsKey(message.getDest())) {
                udpsendPacket=new DatagramPacket(sendData,sendData.length,this.nodes.get(node_names[i]).getAdrress(),this.nodes.get(node_names[i]).getNodePort());
              }
            }
            if (this.nodes.get(host_name) != null && this.nodes.get(host_name).getBatteryLevel() >= Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND) {
              udpClientSocket.send(udpsendPacket);
            }
            if (this.nodes.get(host_name) != null && !message.getDest().equals(Preferences.LOGGER_NAME) && !message.getSource().equals(Preferences.LOGGER_NAME)) {
              this.nodes.get(host_name).decrBatteryLevel(Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND);
            }
          }
        }
      }
    }
 else {
      if (message.getDest().equalsIgnoreCase(Preferences.LOGGER_NAME)) {
        udpsendPacket=new DatagramPacket(sendData,sendData.length,InetAddress.getByName(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")),Integer.parseInt(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")));
      }
 else {
        if (this.nodes.containsKey(message.getDest())) {
          udpsendPacket=new DatagramPacket(sendData,sendData.length,this.nodes.get(message.getDest()).getAdrress(),this.nodes.get(message.getDest()).getNodePort());
        }
      }
      if (this.nodes.get(host_name) != null && this.nodes.get(host_name).getBatteryLevel() >= Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND) {
        if (udpsendPacket != null)         udpClientSocket.send(udpsendPacket);
      }
      if (this.nodes.get(host_name) != null && !message.getDest().equals(Preferences.LOGGER_NAME) && !message.getSource().equals(Preferences.LOGGER_NAME)) {
        this.nodes.get(host_name).decrBatteryLevel(Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND);
      }
    }
  }
 catch (  IOException ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      oos.close();
    }
 catch (    IOException ex) {
      ex.printStackTrace();
    }
  }
}

Fixed version (ground truth):
void sendMsgThroSocket(Message message){
  ObjectOutputStream oos=null;
  try {
    sendData=null;
    ByteArrayOutputStream bos=new ByteArrayOutputStream();
    oos=new ObjectOutputStream(bos);
synchronized (message) {
      try {
        oos.writeObject((Object)message);
      }
 catch (      ConcurrentModificationException e) {
        if (Preferences.DEBUG_MODE)         System.out.println("String_Node_Str");
      }
    }
    oos.flush();
    sendData=bos.toByteArray();
    DatagramPacket udpsendPacket=null;
    DatagramSocket udpClientSocket=null;
    prop=new Properties();
    prop.load(new FileInputStream(conf_file));
    udpClientSocket=new DatagramSocket();
    udpClientSocket.setReceiveBufferSize(5000);
    udpClientSocket.setSendBufferSize(5000);
    if (message instanceof MulticastMessage) {
      if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.GET_MUTEX) {
synchronized (process_state) {
synchronized (arrMutexAckReceived) {
            arrMutexAckReceived[(this.nodes.get(host_name)).getIndex()]=true;
          }
        }
      }
 else       if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.RELEASE_MUTEX) {
synchronized (process_state) {
synchronized (arrMutexAckReceived) {
synchronized (mutexQueue) {
              process_state=Process_State.RELEASED;
              for (int i=0; i < arrMutexAckReceived.length; i++) {
                arrMutexAckReceived[i]=false;
              }
              while (!mutexQueue.isEmpty()) {
                MulticastMessage mutexAckMsg=new MulticastMessage(mutexQueue.remove(0),MulticastMessage.MessageType.MUTEX_ACK);
                mutexAckMsg.setDest(mutexAckMsg.getSource());
                mutexAckMsg.setSource(host_name);
                sendMsgThroSocket(mutexAckMsg);
              }
              return;
            }
          }
        }
      }
      if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.UPDATE_STATE || ((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.RUT || ((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.MUTEX_ACK) {
        if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.MUTEX_ACK) {
          System.out.println("String_Node_Str" + message.getDest());
        }
        if (message.getDest().equalsIgnoreCase(Preferences.LOGGER_NAME)) {
          udpsendPacket=new DatagramPacket(sendData,sendData.length,InetAddress.getByName(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")),Integer.parseInt(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")));
        }
 else {
          if (this.nodes.containsKey(message.getDest())) {
            udpsendPacket=new DatagramPacket(sendData,sendData.length,this.nodes.get(message.getDest()).getAdrress(),this.nodes.get(message.getDest()).getNodePort());
          }
        }
        if (host_name.equalsIgnoreCase(Preferences.LOGGER_NAME) || (this.nodes.get(host_name) != null && this.nodes.get(host_name).getBatteryLevel() >= Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND)) {
          udpClientSocket.send(udpsendPacket);
        }
        if (!host_name.equalsIgnoreCase(Preferences.LOGGER_NAME) && this.nodes.get(host_name) != null && !message.getDest().equals(Preferences.LOGGER_NAME) && !message.getSource().equals(Preferences.LOGGER_NAME)) {
          this.nodes.get(host_name).decrBatteryLevel(Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND);
        }
      }
 else {
        Object[] node_names=this.node_addresses.keySet().toArray();
        for (int i=0; i < node_names.length; i++) {
          if (!host_name.equalsIgnoreCase((String)node_names[i]) && !Preferences.crashNode.equalsIgnoreCase((String)node_names[i])) {
            if (((MulticastMessage)message).getMessageType() == MulticastMessage.MessageType.GET_MUTEX) {
              System.out.println("String_Node_Str" + message.getDest());
            }
            if (message.getDest().equalsIgnoreCase(Preferences.LOGGER_NAME)) {
              udpsendPacket=new DatagramPacket(sendData,sendData.length,InetAddress.getByName(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")),Integer.parseInt(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")));
            }
 else {
              if (this.nodes.containsKey(message.getDest())) {
                udpsendPacket=new DatagramPacket(sendData,sendData.length,this.nodes.get(node_names[i]).getAdrress(),this.nodes.get(node_names[i]).getNodePort());
              }
            }
            if (host_name.equalsIgnoreCase(Preferences.LOGGER_NAME) || (this.nodes.get(host_name) != null && this.nodes.get(host_name).getBatteryLevel() >= Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND)) {
              udpClientSocket.send(udpsendPacket);
            }
            if (!host_name.equalsIgnoreCase(Preferences.LOGGER_NAME) && this.nodes.get(host_name) != null && !message.getDest().equals(Preferences.LOGGER_NAME) && !message.getSource().equals(Preferences.LOGGER_NAME)) {
              this.nodes.get(host_name).decrBatteryLevel(Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND);
            }
          }
        }
      }
    }
 else {
      if (message.getDest().equalsIgnoreCase(Preferences.LOGGER_NAME)) {
        udpsendPacket=new DatagramPacket(sendData,sendData.length,InetAddress.getByName(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")),Integer.parseInt(prop.getProperty("String_Node_Str" + message.getDest() + "String_Node_Str")));
      }
 else {
        if (this.nodes.containsKey(message.getDest())) {
          udpsendPacket=new DatagramPacket(sendData,sendData.length,this.nodes.get(message.getDest()).getAdrress(),this.nodes.get(message.getDest()).getNodePort());
        }
      }
      if (host_name.equalsIgnoreCase(Preferences.LOGGER_NAME) || (this.nodes.get(host_name) != null && this.nodes.get(host_name).getBatteryLevel() >= Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND)) {
        if (udpsendPacket != null)         udpClientSocket.send(udpsendPacket);
      }
      if (!host_name.equalsIgnoreCase(Preferences.LOGGER_NAME) && this.nodes.get(host_name) != null && !message.getDest().equals(Preferences.LOGGER_NAME) && !message.getSource().equals(Preferences.LOGGER_NAME)) {
        this.nodes.get(host_name).decrBatteryLevel(Preferences.BATTERY_SPENT_IN_COMMUNICATION_SEND);
      }
    }
  }
 catch (  IOException ex) {
    ex.printStackTrace();
  }
 finally {
    try {
      oos.close();
    }
 catch (    IOException ex) {
      ex.printStackTrace();
    }
  }
}