Program: 103478
Project: 103478
Buggy source:
/** 
 * Init and establish the specified call.
 * @param call the <tt>CallJabberImpl</tt> that will be usedto initiate the call
 * @param calleeAddress the address of the callee that we'd like to connectwith.
 * @param sessionInitiateExtensions a collection of additional and optional<tt>PacketExtension</tt>s to be added to the <tt>session-initiate</tt> {@link JingleIQ} which is to init the specified <tt>call</tt>
 * @return the <tt>CallPeer</tt> that represented by the specified uri. Allfollowing state change events will be delivered through that call peer. The <tt>Call</tt> that this peer is a member of could be retrieved from the <tt>CallPeer</tt> instance with the use of the corresponding method.
 * @throws OperationFailedException with the corresponding code if we failto create the call.
 */
CallPeerJabberImpl createOutgoingCall(CallJabberImpl call,String calleeAddress,Iterable<PacketExtension> sessionInitiateExtensions) throws OperationFailedException {
  if (logger.isInfoEnabled())   logger.info("String_Node_Str");
  if (protocolProvider.getConnection() == null || call == null) {
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR);
  }
  String fullCalleeURI=null;
  DiscoverInfo di=null;
  int bestPriority=0;
  Iterator<Presence> it=getProtocolProvider().getConnection().getRoster().getPresences(calleeAddress);
  while (it.hasNext()) {
    Presence presence=it.next();
    String calleeURI=presence.getFrom();
    int priority=(presence.getPriority() == Integer.MIN_VALUE) ? 0 : presence.getPriority();
    try {
      DiscoverInfo discoverInfo=protocolProvider.getDiscoveryManager().discoverInfo(calleeURI);
      if (discoverInfo.containsFeature(ProtocolProviderServiceJabberImpl.URN_XMPP_JINGLE)) {
        if (priority > bestPriority) {
          bestPriority=priority;
          di=discoverInfo;
          fullCalleeURI=calleeURI;
        }
      }
    }
 catch (    XMPPException ex) {
      logger.warn("String_Node_Str" + fullCalleeURI,ex);
    }
  }
  if (di != null) {
    if (logger.isInfoEnabled())     logger.info(calleeAddress + "String_Node_Str");
  }
 else {
    if (logger.isInfoEnabled())     logger.info(calleeAddress + "String_Node_Str");
    throw new OperationFailedException("String_Node_Str" + calleeAddress + "String_Node_Str",OperationFailedException.INTERNAL_ERROR);
  }
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + fullCalleeURI + "String_Node_Str"+ bestPriority);
  }
  CallPeerJabberImpl peer=null;
  try {
    peer=call.initiateSession(fullCalleeURI,di,sessionInitiateExtensions);
  }
 catch (  Throwable t) {
    if (t instanceof ThreadDeath)     throw (ThreadDeath)t;
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,t);
  }
  return peer;
}

Fixed version (ground truth):
/** 
 * Init and establish the specified call.
 * @param call the <tt>CallJabberImpl</tt> that will be usedto initiate the call
 * @param calleeAddress the address of the callee that we'd like to connectwith.
 * @param sessionInitiateExtensions a collection of additional and optional<tt>PacketExtension</tt>s to be added to the <tt>session-initiate</tt> {@link JingleIQ} which is to init the specified <tt>call</tt>
 * @return the <tt>CallPeer</tt> that represented by the specified uri. Allfollowing state change events will be delivered through that call peer. The <tt>Call</tt> that this peer is a member of could be retrieved from the <tt>CallPeer</tt> instance with the use of the corresponding method.
 * @throws OperationFailedException with the corresponding code if we failto create the call.
 */
CallPeerJabberImpl createOutgoingCall(CallJabberImpl call,String calleeAddress,Iterable<PacketExtension> sessionInitiateExtensions) throws OperationFailedException {
  if (logger.isInfoEnabled())   logger.info("String_Node_Str");
  if (protocolProvider.getConnection() == null || call == null) {
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR);
  }
  String fullCalleeURI=null;
  DiscoverInfo di=null;
  int bestPriority=-1;
  Iterator<Presence> it=getProtocolProvider().getConnection().getRoster().getPresences(calleeAddress);
  while (it.hasNext()) {
    Presence presence=it.next();
    String calleeURI=presence.getFrom();
    int priority=(presence.getPriority() == Integer.MIN_VALUE) ? 0 : presence.getPriority();
    try {
      DiscoverInfo discoverInfo=protocolProvider.getDiscoveryManager().discoverInfo(calleeURI);
      if (discoverInfo.containsFeature(ProtocolProviderServiceJabberImpl.URN_XMPP_JINGLE)) {
        if (priority > bestPriority) {
          bestPriority=priority;
          di=discoverInfo;
          fullCalleeURI=calleeURI;
        }
      }
    }
 catch (    XMPPException ex) {
      logger.warn("String_Node_Str" + fullCalleeURI,ex);
    }
  }
  if (di != null) {
    if (logger.isInfoEnabled())     logger.info(calleeAddress + "String_Node_Str");
  }
 else {
    if (logger.isInfoEnabled())     logger.info(calleeAddress + "String_Node_Str");
    throw new OperationFailedException("String_Node_Str" + calleeAddress + "String_Node_Str",OperationFailedException.INTERNAL_ERROR);
  }
  if (logger.isInfoEnabled()) {
    logger.info("String_Node_Str" + fullCalleeURI + "String_Node_Str"+ bestPriority);
  }
  CallPeerJabberImpl peer=null;
  try {
    peer=call.initiateSession(fullCalleeURI,di,sessionInitiateExtensions);
  }
 catch (  Throwable t) {
    if (t instanceof ThreadDeath)     throw (ThreadDeath)t;
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,t);
  }
  return peer;
}