Program: 103064
Project: 103064
Buggy source:
/** 
 * Gets a list of (RTP) transport protocols (i.e. <tt>&lt;proto&gt;</tt>) to be announced in a SDP media description (i.e. <tt>m=</tt> line).
 * @return a <tt>List</tt> of (RTP) transport protocols to be announced in aSDP media description
 * @throws OperationFailedException if the value of the <tt>AccountID</tt>property  {@link ProtocolProviderFactory#SAVP_OPTION} is invalid
 */
private List<String> getRtpTransports() throws OperationFailedException {
  AccountID accountID=getPeer().getProtocolProvider().getAccountID();
  int savpOption=accountID.getAccountPropertyBoolean(ProtocolProviderFactory.DEFAULT_ENCRYPTION,true) ? accountID.getAccountPropertyInt(ProtocolProviderFactory.SAVP_OPTION,ProtocolProviderFactory.SAVP_OFF) : ProtocolProviderFactory.SAVP_OFF;
  List<String> result=new ArrayList<String>(3);
  if (savpOption == ProtocolProviderFactory.SAVP_OFF) {
    result.add(SdpConstants.RTP_AVP);
  }
 else {
    List<String> encryptionProtocols=accountID.getSortedEnabledEncryptionProtocolList();
    int encryptionProtocolCount=encryptionProtocols.size();
    for (int i=encryptionProtocolCount - 1; i >= 0; i--) {
      String encryptionProtocol=encryptionProtocols.get(i);
      String protoName=encryptionProtocol.substring(ProtocolProviderFactory.ENCRYPTION_PROTOCOL.length() + 1);
      String proto;
      if (DtlsControl.PROTO_NAME.equals(protoName)) {
        proto=DtlsControl.UDP_TLS_RTP_SAVP;
      }
 else {
        proto=SrtpControl.RTP_SAVP;
      }
      int protoIndex=result.indexOf(proto);
      if (protoIndex > 0)       result.remove(protoIndex);
      result.add(0,proto);
    }
    if (savpOption == ProtocolProviderFactory.SAVP_OPTIONAL)     result.add(SdpConstants.RTP_AVP);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Gets a list of (RTP) transport protocols (i.e. <tt>&lt;proto&gt;</tt>) to be announced in a SDP media description (i.e. <tt>m=</tt> line).
 * @return a <tt>List</tt> of (RTP) transport protocols to be announced in aSDP media description
 * @throws OperationFailedException if the value of the <tt>AccountID</tt>property  {@link ProtocolProviderFactory#SAVP_OPTION} is invalid
 */
private List<String> getRtpTransports() throws OperationFailedException {
  AccountID accountID=getPeer().getProtocolProvider().getAccountID();
  int savpOption=accountID.getAccountPropertyBoolean(ProtocolProviderFactory.DEFAULT_ENCRYPTION,true) ? accountID.getAccountPropertyInt(ProtocolProviderFactory.SAVP_OPTION,ProtocolProviderFactory.SAVP_OFF) : ProtocolProviderFactory.SAVP_OFF;
  List<String> result=new ArrayList<String>(3);
  if (savpOption == ProtocolProviderFactory.SAVP_OFF) {
    result.add(SdpConstants.RTP_AVP);
  }
 else {
    List<String> encryptionProtocols=accountID.getSortedEnabledEncryptionProtocolList();
    for (int epi=encryptionProtocols.size() - 1; epi >= 0; epi--) {
      String encryptionProtocol=encryptionProtocols.get(epi);
      String protoName=encryptionProtocol.substring(ProtocolProviderFactory.ENCRYPTION_PROTOCOL.length() + 1);
      String[] protos;
      if (DtlsControl.PROTO_NAME.equals(protoName)) {
        protos=new String[]{DtlsControl.UDP_TLS_RTP_SAVP,SrtpControl.RTP_SAVPF};
      }
 else {
        protos=new String[]{SrtpControl.RTP_SAVP};
      }
      for (int pi=protos.length - 1; pi >= 0; pi--) {
        String proto=protos[pi];
        int ri=result.indexOf(proto);
        if (ri > 0)         result.remove(ri);
        result.add(0,proto);
      }
    }
    if (savpOption == ProtocolProviderFactory.SAVP_OPTIONAL)     result.add(SdpConstants.RTP_AVP);
  }
  return result;
}