Program: 103063
Project: 103063
Buggy source:
/** 
 * Updates the <tt>SrtpControls</tt> of this instance in accord with a specific <tt>MediaDescription</tt> presented by a remote peer.
 * @param mediaType the <tt>MediaType</tt> of the specified<tt>MediaDescription</tt> to be analyzed
 * @param localMd the <tt>MediaDescription</tt> of the local peer that isthe answer to the offer presented by a remote peer represented by <tt>remoteMd</tt> or <tt>null</tt> if the specified <tt>remoteMd</tt> is an answer to an offer of the local peer
 * @param remoteMd the <tt>MediaDescription</tt> presented by a remote peerto be analyzed
 */
private void updateSrtpControlsForDtls(MediaType mediaType,MediaDescription localMd,MediaDescription remoteMd){
  SrtpControls srtpControls=getSrtpControls();
  DtlsControl dtlsControl=(DtlsControl)srtpControls.get(mediaType,SrtpControlType.DTLS_SRTP);
  if (dtlsControl == null)   return;
  Media remoteMedia=remoteMd.getMedia();
  boolean dtls=false;
  if (remoteMedia != null) {
    String proto;
    try {
      proto=remoteMedia.getProtocol();
    }
 catch (    SdpParseException e) {
      proto=null;
    }
    dtls=DtlsControl.UDP_TLS_RTP_SAVP.equals(proto) || DtlsControl.UDP_TLS_RTP_SAVPF.equals(proto);
  }
  if (dtls) {
    if (localMd == null) {
      String setup;
      try {
        setup=remoteMd.getAttribute(DTLS_SRTP_SETUP_ATTR);
      }
 catch (      SdpParseException spe) {
        setup=null;
      }
      if (DTLS_SRTP_SETUP_PASSIVE.equals(setup)) {
        dtlsControl.setDtlsProtocol(DtlsControl.DTLS_CLIENT_PROTOCOL);
      }
    }
    @SuppressWarnings("String_Node_Str") Vector<Attribute> attrs=remoteMd.getAttributes(false);
    Map<String,String> remoteFingerprints=new LinkedHashMap<String,String>();
    if (attrs != null) {
      for (      Attribute attr : attrs) {
        String fingerprint;
        try {
          if (DTLS_SRTP_FINGERPRINT_ATTR.equals(attr.getName())) {
            fingerprint=attr.getValue();
            if (fingerprint == null)             continue;
 else             fingerprint=fingerprint.trim();
          }
 else {
            continue;
          }
        }
 catch (        SdpParseException spe) {
          continue;
        }
        int spIndex=fingerprint.indexOf(' ');
        if ((spIndex > 0) && (spIndex < fingerprint.length() - 1)) {
          String hashFunction=fingerprint.substring(0,spIndex);
          fingerprint=fingerprint.substring(spIndex + 1);
          remoteFingerprints.put(hashFunction,fingerprint);
        }
      }
    }
    dtlsControl.setRemoteFingerprints(remoteFingerprints);
    removeAndCleanupOtherSrtpControls(mediaType,SrtpControlType.DTLS_SRTP);
  }
 else {
    srtpControls.remove(mediaType,SrtpControlType.DTLS_SRTP);
    dtlsControl.cleanup();
  }
}

Fixed version (ground truth):
/** 
 * Updates the <tt>SrtpControls</tt> of this instance in accord with a specific <tt>MediaDescription</tt> presented by a remote peer.
 * @param mediaType the <tt>MediaType</tt> of the specified<tt>MediaDescription</tt> to be analyzed
 * @param localMd the <tt>MediaDescription</tt> of the local peer that isthe answer to the offer presented by a remote peer represented by <tt>remoteMd</tt> or <tt>null</tt> if the specified <tt>remoteMd</tt> is an answer to an offer of the local peer
 * @param remoteMd the <tt>MediaDescription</tt> presented by a remote peerto be analyzed
 */
private void updateSrtpControlsForDtls(MediaType mediaType,MediaDescription localMd,MediaDescription remoteMd){
  SrtpControls srtpControls=getSrtpControls();
  DtlsControl dtlsControl=(DtlsControl)srtpControls.get(mediaType,SrtpControlType.DTLS_SRTP);
  if (dtlsControl == null)   return;
  boolean dtls=isDtlsMediaDescription(remoteMd);
  if (dtls) {
    if (localMd == null) {
      String setup;
      try {
        setup=remoteMd.getAttribute(DTLS_SRTP_SETUP_ATTR);
      }
 catch (      SdpParseException spe) {
        setup=null;
      }
      if (DTLS_SRTP_SETUP_PASSIVE.equals(setup)) {
        dtlsControl.setDtlsProtocol(DtlsControl.DTLS_CLIENT_PROTOCOL);
      }
    }
    @SuppressWarnings("String_Node_Str") Vector<Attribute> attrs=remoteMd.getAttributes(false);
    Map<String,String> remoteFingerprints=new LinkedHashMap<String,String>();
    if (attrs != null) {
      for (      Attribute attr : attrs) {
        String fingerprint;
        try {
          if (DTLS_SRTP_FINGERPRINT_ATTR.equals(attr.getName())) {
            fingerprint=attr.getValue();
            if (fingerprint == null)             continue;
 else             fingerprint=fingerprint.trim();
          }
 else {
            continue;
          }
        }
 catch (        SdpParseException spe) {
          continue;
        }
        int spIndex=fingerprint.indexOf(' ');
        if ((spIndex > 0) && (spIndex < fingerprint.length() - 1)) {
          String hashFunction=fingerprint.substring(0,spIndex);
          fingerprint=fingerprint.substring(spIndex + 1);
          remoteFingerprints.put(hashFunction,fingerprint);
        }
      }
    }
    dtlsControl.setRemoteFingerprints(remoteFingerprints);
    removeAndCleanupOtherSrtpControls(mediaType,SrtpControlType.DTLS_SRTP);
  }
 else {
    srtpControls.remove(mediaType,SrtpControlType.DTLS_SRTP);
    dtlsControl.cleanup();
  }
}