Program: 103413
Project: 103413
Buggy source:
/** 
 * Creates and returns a new <tt>SessionDescription</tt> that is supposed to update our previous <tt>descToUpdate</tt> and advertise the brand new <tt>newMediaDescriptions</tt>. The method also respects other 3264 policies like reusing the origin field and augmenting its version number for example.
 * @param descToUpdate the <tt>SessionDescription</tt> that we'd like toupdate.
 * @param newConnectionAddress the <tt>InetAddress</tt> that we'd like touse in the new <tt>c=</tt> field.
 * @param newMediaDescriptions the descriptions of the new streams that we'dlike to have in the updated session.
 * @return a new <tt>SessionDescription</tt> that updates<tt>descToUpdate</tt>;
 */
public static SessionDescription createSessionUpdateDescription(SessionDescription descToUpdate,InetAddress newConnectionAddress,Vector<MediaDescription> newMediaDescriptions) throws OperationFailedException {
  SessionDescription update=createSessionDescription(newConnectionAddress,null,newMediaDescriptions);
  try {
    Origin o=(Origin)descToUpdate.getOrigin().clone();
    long version=o.getSessionVersion();
    o.setSessionVersion(version + 1);
    update.setOrigin(o);
  }
 catch (  Exception e) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str",e);
  }
  Vector<MediaDescription> prevMedias=extractMediaDescriptions(descToUpdate);
  Vector<MediaDescription> completeMediaDescList=new Vector<MediaDescription>();
  newMediaDescriptions=new Vector<MediaDescription>(newMediaDescriptions);
  for (  MediaDescription medToUpdate : prevMedias) {
    MediaType type=getMediaType(medToUpdate);
    MediaDescription desc=removeMediaDesc(newMediaDescriptions,type);
    if (desc == null) {
      desc=createDisablingAnswer(medToUpdate);
    }
    completeMediaDescList.add(desc);
  }
  for (  MediaDescription medToAdd : newMediaDescriptions) {
    completeMediaDescList.add(medToAdd);
  }
  try {
    update.setMediaDescriptions(completeMediaDescList);
  }
 catch (  SdpException e) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str",e);
  }
  return update;
}

Fixed version (ground truth):
/** 
 * Creates and returns a new <tt>SessionDescription</tt> that is supposed to update our previous <tt>descToUpdate</tt> and advertise the brand new <tt>newMediaDescriptions</tt>. The method also respects other 3264 policies like reusing the origin field and augmenting its version number for example.
 * @param descToUpdate the <tt>SessionDescription</tt> that we'd like toupdate.
 * @param newConnectionAddress the <tt>InetAddress</tt> that we'd like touse in the new <tt>c=</tt> field.
 * @param newMediaDescriptions the descriptions of the new streams that we'dlike to have in the updated session.
 * @return a new <tt>SessionDescription</tt> that updates<tt>descToUpdate</tt>;
 */
public static SessionDescription createSessionUpdateDescription(SessionDescription descToUpdate,InetAddress newConnectionAddress,Vector<MediaDescription> newMediaDescriptions) throws OperationFailedException {
  SessionDescription update=createSessionDescription(newConnectionAddress,null,newMediaDescriptions);
  try {
    Origin o=(Origin)descToUpdate.getOrigin().clone();
    long version=o.getSessionVersion();
    o.setSessionVersion(version + 1);
    update.setOrigin(o);
  }
 catch (  Exception e) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str",e);
  }
  Vector<MediaDescription> prevMedias=extractMediaDescriptions(descToUpdate);
  Vector<MediaDescription> completeMediaDescList=new Vector<MediaDescription>();
  newMediaDescriptions=new Vector<MediaDescription>(newMediaDescriptions);
  for (  MediaDescription medToUpdate : prevMedias) {
    MediaDescription desc=null;
    try {
      MediaType type=getMediaType(medToUpdate);
      desc=removeMediaDesc(newMediaDescriptions,type);
    }
 catch (    IllegalArgumentException e) {
    }
    if (desc == null) {
      desc=createDisablingAnswer(medToUpdate);
    }
    completeMediaDescList.add(desc);
  }
  for (  MediaDescription medToAdd : newMediaDescriptions) {
    completeMediaDescList.add(medToAdd);
  }
  try {
    update.setMediaDescriptions(completeMediaDescList);
  }
 catch (  SdpException e) {
    if (logger.isInfoEnabled())     logger.info("String_Node_Str",e);
  }
  return update;
}