Program: 104024
Project: 104024
Buggy source:
/** 
 * Initializes the RTP manager so that it would start listening on the <tt>address</tt> session address. The method also initializes the RTP manager buffer control.
 * @param rtpManager the <tt>RTPManager</tt> to initialize.
 * @param bindAddress the <tt>SessionAddress</tt> to use when initializingthe RTPManager.
 * @throws MediaException if we fail to initialize the RTP manager.
 */
private void initializeRtpManager(RTPManager rtpManager,SessionAddress bindAddress) throws MediaException {
  selectedKeyProviderAlgorithm=selectKeyProviderAlgorithm(0);
  try {
    if (selectedKeyProviderAlgorithm != null && selectedKeyProviderAlgorithm.getProviderType() == KeyProviderAlgorithm.ProviderType.ZRTP_PROVIDER) {
      TransformConnector transConnector=TransformManager.createZRTPConnector(bindAddress,this);
      rtpManager.initialize(transConnector);
      this.transConnectors.put(rtpManager,transConnector);
      SecurityEventManager securityEventManager=new SecurityEventManager(this);
      boolean zrtpAutoStart=false;
      if (rtpManager.equals(audioRtpManager)) {
        if (zrtpDHSession == null) {
          zrtpDHSession=transConnector;
          zrtpAutoStart=true;
          securityEventManager.setDHSession(true);
        }
        securityEventManager.setSessionType(AUDIO_SESSION);
      }
 else       if (rtpManager.equals(videoRtpManager)) {
        securityEventManager.setSessionType(VIDEO_SESSION);
      }
      ZRTPTransformEngine engine=(ZRTPTransformEngine)transConnector.getEngine();
      engine.setUserCallback(securityEventManager);
      if (this.getCall().isDefaultEncrypted()) {
        if (engine.initialize("String_Node_Str",zrtpAutoStart)) {
          usingZRTP=true;
          engine.sendInfo(ZrtpCodes.MessageSeverity.Info,EnumSet.of(ZRTPCustomInfoCodes.ZRTPEnabledByDefault));
        }
 else {
          engine.sendInfo(ZrtpCodes.MessageSeverity.Info,EnumSet.of(ZRTPCustomInfoCodes.ZRTPEngineInitFailure));
        }
      }
 else {
        engine.sendInfo(ZrtpCodes.MessageSeverity.Info,EnumSet.of(ZRTPCustomInfoCodes.ZRTPNotEnabledByUser));
      }
      logger.trace("String_Node_Str" + (rtpManager.equals(audioRtpManager) ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    }
 else {
      rtpManager.initialize(bindAddress);
      logger.trace("String_Node_Str" + (rtpManager.equals(audioRtpManager) ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    }
  }
 catch (  Exception exc) {
    exc.printStackTrace();
    logger.error("String_Node_Str",exc);
    throw new MediaException("String_Node_Str",MediaException.IO_ERROR,exc);
  }
  BufferControl bc=(BufferControl)rtpManager.getControl(BufferControl.class.getName());
  if (bc != null) {
    long buff=100;
    String buffStr=MediaActivator.getConfigurationService().getString(PROPERTY_NAME_RECEIVE_BUFFER_LENGTH);
    try {
      if (buffStr != null && buffStr.length() > 0)       buff=Long.parseLong(buffStr);
    }
 catch (    NumberFormatException exc) {
      logger.warn(buffStr + "String_Node_Str",exc);
    }
    buff=bc.setBufferLength(buff);
    logger.trace("String_Node_Str" + buff);
    bc.setEnabledThreshold(true);
    bc.setMinimumThreshold(100);
  }
  rtpManager.addReceiveStreamListener(this);
  rtpManager.addSendStreamListener(this);
  rtpManager.addSessionListener(this);
}

Fixed version (ground truth):
/** 
 * Initializes the RTP manager so that it would start listening on the <tt>address</tt> session address. The method also initializes the RTP manager buffer control.
 * @param rtpManager the <tt>RTPManager</tt> to initialize.
 * @param bindAddress the <tt>SessionAddress</tt> to use when initializingthe RTPManager.
 * @throws MediaException if we fail to initialize the RTP manager.
 */
private void initializeRtpManager(RTPManager rtpManager,SessionAddress bindAddress) throws MediaException {
  selectedKeyProviderAlgorithm=selectKeyProviderAlgorithm(0);
  try {
    if (selectedKeyProviderAlgorithm != null && selectedKeyProviderAlgorithm.getProviderType() == KeyProviderAlgorithm.ProviderType.ZRTP_PROVIDER) {
      TransformConnector transConnector=TransformManager.createZRTPConnector(bindAddress);
      rtpManager.initialize(transConnector);
      this.transConnectors.put(rtpManager,transConnector);
      SecurityEventManager securityEventManager=new SecurityEventManager(this);
      boolean zrtpAutoStart=false;
      if (rtpManager.equals(audioRtpManager)) {
        if (zrtpDHSession == null) {
          zrtpDHSession=transConnector;
          zrtpAutoStart=true;
          securityEventManager.setDHSession(true);
        }
        securityEventManager.setSessionType(AUDIO_SESSION);
      }
 else       if (rtpManager.equals(videoRtpManager)) {
        securityEventManager.setSessionType(VIDEO_SESSION);
      }
      ZRTPTransformEngine engine=(ZRTPTransformEngine)transConnector.getEngine();
      engine.setUserCallback(securityEventManager);
      if (this.getCall().isDefaultEncrypted()) {
        if (engine.initialize("String_Node_Str",zrtpAutoStart)) {
          usingZRTP=true;
          engine.sendInfo(ZrtpCodes.MessageSeverity.Info,EnumSet.of(ZRTPCustomInfoCodes.ZRTPEnabledByDefault));
        }
 else {
          engine.sendInfo(ZrtpCodes.MessageSeverity.Info,EnumSet.of(ZRTPCustomInfoCodes.ZRTPEngineInitFailure));
        }
      }
 else {
        engine.sendInfo(ZrtpCodes.MessageSeverity.Info,EnumSet.of(ZRTPCustomInfoCodes.ZRTPNotEnabledByUser));
      }
      logger.trace("String_Node_Str" + (rtpManager.equals(audioRtpManager) ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    }
 else {
      rtpManager.initialize(bindAddress);
      logger.trace("String_Node_Str" + (rtpManager.equals(audioRtpManager) ? "String_Node_Str" : "String_Node_Str") + "String_Node_Str");
    }
  }
 catch (  Exception exc) {
    exc.printStackTrace();
    logger.error("String_Node_Str",exc);
    throw new MediaException("String_Node_Str",MediaException.IO_ERROR,exc);
  }
  BufferControl bc=(BufferControl)rtpManager.getControl(BufferControl.class.getName());
  if (bc != null) {
    long buff=100;
    String buffStr=MediaActivator.getConfigurationService().getString(PROPERTY_NAME_RECEIVE_BUFFER_LENGTH);
    try {
      if (buffStr != null && buffStr.length() > 0)       buff=Long.parseLong(buffStr);
    }
 catch (    NumberFormatException exc) {
      logger.warn(buffStr + "String_Node_Str",exc);
    }
    buff=bc.setBufferLength(buff);
    logger.trace("String_Node_Str" + buff);
    bc.setEnabledThreshold(true);
    bc.setMinimumThreshold(100);
  }
  rtpManager.addReceiveStreamListener(this);
  rtpManager.addSendStreamListener(this);
  rtpManager.addSessionListener(this);
}