Program: 104133
Project: 104133
Buggy source:
/** 
 * Creates a vector containing SDP descriptions of media types and formats that we support. If the offerVector is non null
 * @param offerMediaDescs the media descriptions sent by the offerer (couldbe null).
 * @param publicAudioAddress the <tt>InetSocketAddress</tt> that we shouldbe using for sending audio.
 * @param publicVideoAddress the <tt>InetSocketAddress</tt> that we shouldbe using for sending video.
 * @return a <tt>Vector</tt> containing media descriptions that we supportand (if this is an answer to an offer) that the offering <tt>CallParticipant</tt> supports as well.
 * @throws SdpException we fail creating the media descriptions
 * @throws MediaException with code UNSUPPORTED_FORMAT_SET_ERROR if we don'tsupport any of the offered media formats.
 */
private Vector<MediaDescription> createMediaDescriptions(Vector<MediaDescription> offerMediaDescs,InetSocketAddress publicAudioAddress,InetSocketAddress publicVideoAddress) throws SdpException, MediaException {
  MediaControl mediaControl=mediaServCallback.getMediaControl(getCall());
  String[] supportedAudioEncodings=mediaControl.getSupportedAudioEncodings();
  String[] supportedVideoEncodings=mediaControl.getSupportedVideoEncodings();
  if (offerMediaDescs != null && offerMediaDescs.size() > 0) {
    Vector<String> offeredVideoEncodings=new Vector<String>();
    Vector<String> offeredAudioEncodings=new Vector<String>();
    for (    MediaDescription desc : offerMediaDescs) {
      Media media=desc.getMedia();
      String mediaType=media.getMediaType();
      if (mediaType.equalsIgnoreCase("String_Node_Str")) {
        offeredVideoEncodings=media.getMediaFormats(true);
      }
 else       if (mediaType.equalsIgnoreCase("String_Node_Str")) {
        offeredAudioEncodings=media.getMediaFormats(true);
      }
    }
    Hashtable<String,List<String>> encodings=new Hashtable<String,List<String>>(2);
    encodings.put("String_Node_Str",offeredAudioEncodings);
    encodings.put("String_Node_Str",offeredVideoEncodings);
    encodings=intersectMediaEncodings(encodings);
    List<String> intersectedAudioEncsList=encodings.get("String_Node_Str");
    List<String> intersectedVideoEncsList=encodings.get("String_Node_Str");
    supportedAudioEncodings=intersectedAudioEncsList.toArray(new String[0]);
    supportedVideoEncodings=intersectedVideoEncsList.toArray(new String[0]);
  }
  Vector<MediaDescription> mediaDescs=new Vector<MediaDescription>();
  if (supportedAudioEncodings.length > 0) {
    MediaDescription am=mediaServCallback.getSdpFactory().createMediaDescription("String_Node_Str",publicAudioAddress.getPort(),1,"String_Node_Str",supportedAudioEncodings);
    String g723Str=String.valueOf(SdpConstants.G723);
    for (    String supportedAudioEncoding : supportedAudioEncodings) {
      if (supportedAudioEncoding.equals(g723Str)) {
        am.setAttribute("String_Node_Str","String_Node_Str");
        am.setAttribute("String_Node_Str","String_Node_Str");
      }
    }
    byte onHold=this.onHold;
    if (!mediaServCallback.getDeviceConfiguration().isAudioCaptureSupported()) {
      onHold|=ON_HOLD_REMOTELY;
    }
    setAttributeOnHold(am,onHold);
    TransformConnector transConnector=this.transConnectors.get(audioRtpManager);
    if (transConnector != null) {
      TransformEngine engine=transConnector.getEngine();
      if (engine instanceof ZRTPTransformEngine) {
        ZRTPTransformEngine ze=(ZRTPTransformEngine)engine;
        String helloHash=ze.getHelloHash();
        if (helloHash != null && helloHash.length() > 0)         am.setAttribute("String_Node_Str",ze.getHelloHash());
      }
    }
    mediaDescs.add(am);
  }
  if (supportedVideoEncodings.length > 0) {
    MediaDescription vm=mediaServCallback.getSdpFactory().createMediaDescription("String_Node_Str",publicVideoAddress.getPort(),1,"String_Node_Str",supportedVideoEncodings);
    String h264Str=String.valueOf(Constants.H264_RTP_SDP);
    for (    String supportedVideoEncoding : supportedVideoEncodings) {
      if (supportedVideoEncoding.equals(h264Str)) {
        vm.setAttribute("String_Node_Str",Constants.H264_RTP_SDP + "String_Node_Str");
        vm.setAttribute("String_Node_Str",Constants.H264_RTP_SDP + "String_Node_Str");
      }
    }
    byte onHold=this.onHold;
    if (!mediaServCallback.getDeviceConfiguration().isVideoCaptureSupported() || !mediaControl.isLocalVideoAllowed()) {
      onHold|=ON_HOLD_REMOTELY;
    }
    setAttributeOnHold(vm,onHold);
    TransformConnector transConnector=this.transConnectors.get(videoRtpManager);
    if (transConnector != null) {
      TransformEngine engine=transConnector.getEngine();
      if (engine instanceof ZRTPTransformEngine) {
        ZRTPTransformEngine ze=(ZRTPTransformEngine)engine;
        String helloHash=ze.getHelloHash();
        if (helloHash != null && helloHash.length() > 0)         vm.setAttribute("String_Node_Str",ze.getHelloHash());
      }
    }
    mediaDescs.add(vm);
  }
  return mediaDescs;
}

Fixed version (ground truth):
/** 
 * Creates a vector containing SDP descriptions of media types and formats that we support. If the offerVector is non null
 * @param offerMediaDescs the media descriptions sent by the offerer (couldbe null).
 * @param publicAudioAddress the <tt>InetSocketAddress</tt> that we shouldbe using for sending audio.
 * @param publicVideoAddress the <tt>InetSocketAddress</tt> that we shouldbe using for sending video.
 * @return a <tt>Vector</tt> containing media descriptions that we supportand (if this is an answer to an offer) that the offering <tt>CallParticipant</tt> supports as well.
 * @throws SdpException we fail creating the media descriptions
 * @throws MediaException with code UNSUPPORTED_FORMAT_SET_ERROR if we don'tsupport any of the offered media formats.
 */
private Vector<MediaDescription> createMediaDescriptions(Vector<MediaDescription> offerMediaDescs,InetSocketAddress publicAudioAddress,InetSocketAddress publicVideoAddress) throws SdpException, MediaException {
  MediaControl mediaControl=mediaServCallback.getMediaControl(getCall());
  String[] supportedAudioEncodings=mediaControl.getSupportedAudioEncodings();
  String[] supportedVideoEncodings=mediaControl.getSupportedVideoEncodings();
  if (offerMediaDescs != null && offerMediaDescs.size() > 0) {
    Vector<String> offeredVideoEncodings=new Vector<String>();
    Vector<String> offeredAudioEncodings=new Vector<String>();
    for (    MediaDescription desc : offerMediaDescs) {
      Media media=desc.getMedia();
      String mediaType=media.getMediaType();
      if (mediaType.equalsIgnoreCase("String_Node_Str")) {
        offeredVideoEncodings=media.getMediaFormats(true);
      }
 else       if (mediaType.equalsIgnoreCase("String_Node_Str")) {
        offeredAudioEncodings=media.getMediaFormats(true);
      }
    }
    Hashtable<String,List<String>> encodings=new Hashtable<String,List<String>>(2);
    encodings.put("String_Node_Str",offeredAudioEncodings);
    encodings.put("String_Node_Str",offeredVideoEncodings);
    encodings=intersectMediaEncodings(encodings);
    List<String> intersectedAudioEncsList=encodings.get("String_Node_Str");
    List<String> intersectedVideoEncsList=encodings.get("String_Node_Str");
    supportedAudioEncodings=intersectedAudioEncsList.toArray(new String[0]);
    supportedVideoEncodings=intersectedVideoEncsList.toArray(new String[0]);
  }
  Vector<MediaDescription> mediaDescs=new Vector<MediaDescription>();
  if (supportedAudioEncodings.length > 0) {
    MediaDescription am=mediaServCallback.getSdpFactory().createMediaDescription("String_Node_Str",publicAudioAddress.getPort(),1,"String_Node_Str",supportedAudioEncodings);
    String g723Str=String.valueOf(SdpConstants.G723);
    for (    String supportedAudioEncoding : supportedAudioEncodings) {
      if (supportedAudioEncoding.equals(g723Str)) {
        am.setAttribute("String_Node_Str","String_Node_Str");
        am.setAttribute("String_Node_Str","String_Node_Str");
      }
    }
    byte onHold=this.onHold;
    if (mediaServCallback.getDeviceConfiguration().isAudioCaptureSupported()) {
      setAttributeOnHold(am,onHold);
      TransformConnector transConnector=this.transConnectors.get(audioRtpManager);
      if (transConnector != null) {
        TransformEngine engine=transConnector.getEngine();
        if (engine instanceof ZRTPTransformEngine) {
          ZRTPTransformEngine ze=(ZRTPTransformEngine)engine;
          String helloHash=ze.getHelloHash();
          if (helloHash != null && helloHash.length() > 0)           am.setAttribute("String_Node_Str",ze.getHelloHash());
        }
      }
      mediaDescs.add(am);
    }
  }
  if (supportedVideoEncodings.length > 0) {
    MediaDescription vm=mediaServCallback.getSdpFactory().createMediaDescription("String_Node_Str",publicVideoAddress.getPort(),1,"String_Node_Str",supportedVideoEncodings);
    String h264Str=String.valueOf(Constants.H264_RTP_SDP);
    for (    String supportedVideoEncoding : supportedVideoEncodings) {
      if (supportedVideoEncoding.equals(h264Str)) {
        vm.setAttribute("String_Node_Str",Constants.H264_RTP_SDP + "String_Node_Str");
        vm.setAttribute("String_Node_Str",Constants.H264_RTP_SDP + "String_Node_Str");
      }
    }
    byte onHold=this.onHold;
    if (!mediaServCallback.getDeviceConfiguration().isVideoCaptureSupported() || !mediaControl.isLocalVideoAllowed()) {
      onHold|=ON_HOLD_REMOTELY;
    }
    setAttributeOnHold(vm,onHold);
    TransformConnector transConnector=this.transConnectors.get(videoRtpManager);
    if (transConnector != null) {
      TransformEngine engine=transConnector.getEngine();
      if (engine instanceof ZRTPTransformEngine) {
        ZRTPTransformEngine ze=(ZRTPTransformEngine)engine;
        String helloHash=ze.getHelloHash();
        if (helloHash != null && helloHash.length() > 0)         vm.setAttribute("String_Node_Str",ze.getHelloHash());
      }
    }
    mediaDescs.add(vm);
  }
  return mediaDescs;
}