Program: 98430
Project: 98430
Buggy source:
public final void sendJingleTerminate(final Message msg,final SipChannel sipChannel){
  try {
    final CallSession callSession=callSessions.getSession(msg);
    Participants mainParticipants;
    try {
      mainParticipants=msg.getParticipants();
    }
 catch (    SipParsingException e) {
      log.debug("String_Node_Str",e);
      return;
    }
    if (callSession == null) {
      log.debug("String_Node_Str" + msg.toString());
      return;
    }
    JID initiator;
    JID responder;
    JID to;
    if (callSession.getLastSentJingle() != null) {
      initiator=new JID(callSession.getLastSentJingle().getJingle().getInitiator());
      responder=new JID(callSession.getLastSentJingle().getJingle().getResponder());
    }
 else     if (callSession.getLastReceivedJingle() != null) {
      initiator=new JID(callSession.getLastReceivedJingle().getJingle().getInitiator());
      responder=new JID(callSession.getLastReceivedJingle().getJingle().getResponder());
    }
 else {
      log.info("String_Node_Str");
      return;
    }
    if (msg.isRequest()) {
      to=mainParticipants.getResponder();
    }
 else {
      to=mainParticipants.getInitiator();
    }
    if (initiator.getResource() == null) {
      if (initiator.toBareJID().equals(mainParticipants.getInitiator().toBareJID())) {
        initiator=mainParticipants.getInitiator();
      }
 else {
        initiator=mainParticipants.getResponder();
      }
    }
 else     if (responder.getResource() == null) {
      if (responder.toBareJID().equals(mainParticipants.getResponder().toBareJID())) {
        responder=mainParticipants.getResponder();
      }
 else {
        responder=mainParticipants.getInitiator();
      }
    }
    final Message lastMsg=callSession.getLastMessage();
    if (lastMsg != null) {
      mainParticipants=lastMsg.getParticipants();
    }
    if (mainParticipants == null) {
      log.info("String_Node_Str" + msg);
      return;
    }
    if (initiator.getResource() == null) {
      if (initiator.toBareJID().equals(mainParticipants.getInitiator().toBareJID())) {
        initiator=mainParticipants.getInitiator();
      }
 else {
        initiator=mainParticipants.getResponder();
      }
    }
 else     if (responder.getResource() == null) {
      if (responder.toBareJID().equals(mainParticipants.getResponder().toBareJID())) {
        responder=mainParticipants.getResponder();
      }
 else {
        responder=mainParticipants.getInitiator();
      }
    }
    if (sipToJingleBind != null) {
      to=sipToJingleBind.getXmppTo(to,callSession.getLastReceivedJingle());
    }
    for (    final JID usr : callSession.getUsers()) {
      if (to == null || to.toBareJID().equals(usr.toBareJID())) {
        to=usr;
      }
    }
    if (to != null && to.getResource() == null) {
      if (to.toBareJID().equals(mainParticipants.getInitiator().toBareJID())) {
        to=mainParticipants.getInitiator();
      }
 else       if (to.toBareJID().equals(mainParticipants.getResponder().toBareJID())) {
        to=mainParticipants.getResponder();
      }
    }
    final int code=getCode(msg);
    final Reason reason=getReason(msg,code);
    final JingleIQ terminate=JingleProcessor.createJingleTermination(initiator,responder,to.toString(),reason,msg.getCallIdHeader().getCallId());
    if (callSession.getProceeds() != null) {
      for (      final CallPreparation preparation : callSession.getProceeds()) {
        preparation.proceedSIPTerminate(terminate,callSession,null);
      }
    }
    callSessions.addSentJingle(terminate);
    gatewayRouter.send(terminate);
  }
 catch (  JingleException e) {
    log.debug("String_Node_Str",e);
  }
catch (  SipParsingException e) {
    log.debug("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public final void sendJingleTerminate(final Message msg,final SipChannel sipChannel){
  try {
    final CallSession callSession=callSessions.getSession(msg);
    Participants mainParticipants;
    try {
      mainParticipants=msg.getParticipants();
    }
 catch (    SipParsingException e) {
      log.debug("String_Node_Str",e);
      return;
    }
    if (callSession == null) {
      log.debug("String_Node_Str" + msg.toString());
      return;
    }
    JID initiator;
    JID responder;
    JID to;
    if (callSession.getLastSentJingle() != null) {
      initiator=new JID(callSession.getLastSentJingle().getJingle().getInitiator());
      responder=new JID(callSession.getLastSentJingle().getJingle().getResponder());
    }
 else     if (callSession.getLastReceivedJingle() != null) {
      initiator=new JID(callSession.getLastReceivedJingle().getJingle().getInitiator());
      responder=new JID(callSession.getLastReceivedJingle().getJingle().getResponder());
    }
 else {
      log.info("String_Node_Str");
      return;
    }
    if (msg.isRequest()) {
      to=mainParticipants.getResponder();
    }
 else {
      to=mainParticipants.getInitiator();
    }
    if (initiator.getResource() == null) {
      if (initiator.toBareJID().equals(mainParticipants.getInitiator().toBareJID())) {
        initiator=mainParticipants.getInitiator();
      }
 else {
        initiator=mainParticipants.getResponder();
      }
    }
 else     if (responder.getResource() == null) {
      if (responder.toBareJID().equals(mainParticipants.getResponder().toBareJID())) {
        responder=mainParticipants.getResponder();
      }
 else {
        responder=mainParticipants.getInitiator();
      }
    }
    final Message lastMsg=callSession.getLastMessage();
    if (lastMsg != null) {
      mainParticipants=lastMsg.getParticipants();
    }
    if (mainParticipants == null) {
      log.info("String_Node_Str" + msg);
      return;
    }
    if (initiator.getResource() == null) {
      if (initiator.toBareJID().equals(mainParticipants.getInitiator().toBareJID())) {
        initiator=mainParticipants.getInitiator();
      }
 else {
        initiator=mainParticipants.getResponder();
      }
    }
 else     if (responder.getResource() == null) {
      if (responder.toBareJID().equals(mainParticipants.getResponder().toBareJID())) {
        responder=mainParticipants.getResponder();
      }
 else {
        responder=mainParticipants.getInitiator();
      }
    }
    if (sipToJingleBind != null) {
      to=sipToJingleBind.getXmppTo(to,callSession.getLastReceivedJingle());
    }
    for (    final JID usr : callSession.getUsers()) {
      if (to == null || to.toBareJID().equals(usr.toBareJID())) {
        to=usr;
      }
    }
    if (to != null && to.getResource() == null) {
      if (to.toBareJID().equals(mainParticipants.getInitiator().toBareJID())) {
        to=mainParticipants.getInitiator();
      }
 else       if (to.toBareJID().equals(mainParticipants.getResponder().toBareJID())) {
        to=mainParticipants.getResponder();
      }
    }
    final int code=getCode(msg);
    final Reason reason=getReason(msg,code);
    JingleIQ terminate=JingleProcessor.createJingleTermination(initiator,responder,to.toString(),reason,msg.getCallIdHeader().getCallId());
    if (callSession.getProceeds() != null) {
      for (      final CallPreparation preparation : callSession.getProceeds()) {
        terminate=preparation.proceedSIPTerminate(terminate,callSession,null);
      }
    }
    callSessions.addSentJingle(terminate);
    gatewayRouter.send(terminate);
  }
 catch (  JingleException e) {
    log.debug("String_Node_Str",e);
  }
catch (  SipParsingException e) {
    log.debug("String_Node_Str",e);
  }
}