Program: 104253
Project: 104253
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) {
      TransformManager.initializeProviders();
      TransformConnector transConnector=TransformManager.createZRTPConnector(bindAddress,"String_Node_Str",this);
      rtpManager.initialize(transConnector);
      this.transConnectors.put(rtpManager,transConnector);
      SCCallback callback=new SCCallback(this);
      boolean zrtpAutoStart=false;
      if (rtpManager.equals(audioRtpManager)) {
        if (zrtpDHSession == null) {
          zrtpDHSession=transConnector;
          zrtpAutoStart=true;
          callback.setDHSession(true);
        }
        callback.setType(SecurityGUIEventZrtp.AUDIO);
      }
 else       if (rtpManager.equals(videoRtpManager)) {
        callback.setType(SecurityGUIEventZrtp.VIDEO);
      }
      ZRTPTransformEngine engine=(ZRTPTransformEngine)transConnector.getEngine();
      engine.setUserCallback(callback);
      if (this.getCall().isDefaultEncrypted()) {
        if (engine.initialize("String_Node_Str")) {
          usingSRTP=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     if (selectedKeyProviderAlgorithm != null && selectedKeyProviderAlgorithm.getProviderType() == KeyProviderAlgorithm.ProviderType.DUMMY_PROVIDER && rtpManager.equals(audioRtpManager)) {
      SRTPPolicy srtpPolicy=new SRTPPolicy(SRTPPolicy.AESF8_ENCRYPTION,16,SRTPPolicy.HMACSHA1_AUTHENTICATION,20,10,14);
      byte[] masterKey={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
      byte[] masterSalt={0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d};
      TransformConnector transConnector=null;
      TransformManager.initializeProviders();
      transConnector=TransformManager.createSRTPConnector(bindAddress,masterKey,masterSalt,srtpPolicy,srtpPolicy,"String_Node_Str");
      rtpManager.initialize(transConnector);
      this.transConnectors.put(rtpManager,transConnector);
      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) {
      TransformManager.initializeProviders();
      TransformConnector transConnector=TransformManager.createZRTPConnector(bindAddress,"String_Node_Str",this);
      rtpManager.initialize(transConnector);
      this.transConnectors.put(rtpManager,transConnector);
      SCCallback callback=new SCCallback(this);
      boolean zrtpAutoStart=false;
      if (rtpManager.equals(audioRtpManager)) {
        if (zrtpDHSession == null) {
          zrtpDHSession=transConnector;
          zrtpAutoStart=true;
          callback.setDHSession(true);
        }
        callback.setType(SecurityGUIEventZrtp.AUDIO);
      }
 else       if (rtpManager.equals(videoRtpManager)) {
        callback.setType(SecurityGUIEventZrtp.VIDEO);
      }
      ZRTPTransformEngine engine=(ZRTPTransformEngine)transConnector.getEngine();
      engine.setUserCallback(callback);
      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);
}