Program: 104365
Project: 104365
Buggy source:
/** 
 * Construct a Request which represent a new message
 * @param to the <tt>Contact</tt> to send <tt>message</tt> to
 * @param message the <tt>Message</tt> to send.
 * @return a Message Request destinated to the contact
 * @throws OperationFailedException if an error occured duringthe creation of the request
 */
private Request createMessage(Contact to,Message message) throws OperationFailedException {
  InetAddress destinationInetAddress=null;
  Address toAddress=null;
  try {
    toAddress=parseAddressStr(to.getAddress());
    destinationInetAddress=InetAddress.getByName(((SipURI)toAddress.getURI()).getHost());
  }
 catch (  UnknownHostException ex) {
    throw new IllegalArgumentException(((SipURI)toAddress.getURI()).getHost() + "String_Node_Str" + ex.getMessage());
  }
catch (  ParseException exc) {
    logger.error("String_Node_Str" + "String_Node_Str",exc);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,exc);
  }
  CallIdHeader callIdHeader=this.sipProvider.getDefaultJainSipProvider().getNewCallId();
  CSeqHeader cSeqHeader=null;
  try {
    cSeqHeader=this.sipProvider.getHeaderFactory().createCSeqHeader(seqN++,Request.MESSAGE);
  }
 catch (  InvalidArgumentException ex) {
    logger.error("String_Node_Str" + "String_Node_Str",ex);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
catch (  ParseException exc) {
    logger.error("String_Node_Str" + "String_Node_Str",exc);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,exc);
  }
  String localTag=ProtocolProviderServiceSipImpl.generateLocalTag();
  FromHeader fromHeader=null;
  ToHeader toHeader=null;
  try {
    fromHeader=this.sipProvider.getHeaderFactory().createFromHeader(this.sipProvider.getOurSipAddress(),localTag);
    toHeader=this.sipProvider.getHeaderFactory().createToHeader(toAddress,null);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str" + "String_Node_Str",ex);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  ArrayList viaHeaders=this.sipProvider.getLocalViaHeaders(destinationInetAddress,this.sipProvider.getDefaultListeningPoint());
  MaxForwardsHeader maxForwards=this.sipProvider.getMaxForwardsHeader();
  ContentTypeHeader contTypeHeader;
  ContentLengthHeader contLengthHeader;
  try {
    contTypeHeader=this.sipProvider.getHeaderFactory().createContentTypeHeader(getType(message),getSubType(message));
    if (!DEFAULT_MIME_ENCODING.equalsIgnoreCase(message.getEncoding()))     contTypeHeader.setParameter("String_Node_Str",message.getEncoding());
    contLengthHeader=this.sipProvider.getHeaderFactory().createContentLengthHeader(message.getSize());
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str" + "String_Node_Str",ex);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
catch (  InvalidArgumentException exc) {
    logger.error("String_Node_Str" + "String_Node_Str",exc);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,exc);
  }
  Request req;
  try {
    req=this.sipProvider.getMessageFactory().createRequest(toHeader.getAddress().getURI(),Request.MESSAGE,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwards,contTypeHeader,message.getContent().getBytes());
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str",ex);
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  req.addHeader(contLengthHeader);
  return req;
}

Fixed version (ground truth):
/** 
 * Construct a Request which represent a new message
 * @param to the <tt>Contact</tt> to send <tt>message</tt> to
 * @param message the <tt>Message</tt> to send.
 * @return a Message Request destinated to the contact
 * @throws OperationFailedException if an error occured duringthe creation of the request
 */
private Request createMessage(Contact to,Message message) throws OperationFailedException {
  InetAddress destinationInetAddress=null;
  Address toAddress=null;
  try {
    toAddress=parseAddressStr(to.getAddress());
    destinationInetAddress=InetAddress.getByName(((SipURI)toAddress.getURI()).getHost());
  }
 catch (  UnknownHostException ex) {
    throw new IllegalArgumentException(((SipURI)toAddress.getURI()).getHost() + "String_Node_Str" + ex.getMessage());
  }
catch (  ParseException exc) {
    logger.error("String_Node_Str" + "String_Node_Str",exc);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,exc);
  }
  CallIdHeader callIdHeader=this.sipProvider.getDefaultJainSipProvider().getNewCallId();
  CSeqHeader cSeqHeader=null;
  try {
    cSeqHeader=this.sipProvider.getHeaderFactory().createCSeqHeader(seqN++,Request.MESSAGE);
  }
 catch (  InvalidArgumentException ex) {
    logger.error("String_Node_Str" + "String_Node_Str",ex);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
catch (  ParseException exc) {
    logger.error("String_Node_Str" + "String_Node_Str",exc);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,exc);
  }
  String localTag=ProtocolProviderServiceSipImpl.generateLocalTag();
  FromHeader fromHeader=null;
  ToHeader toHeader=null;
  try {
    fromHeader=this.sipProvider.getHeaderFactory().createFromHeader(this.sipProvider.getOurSipAddress(),localTag);
    toHeader=this.sipProvider.getHeaderFactory().createToHeader(toAddress,null);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str" + "String_Node_Str",ex);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  ArrayList viaHeaders=this.sipProvider.getLocalViaHeaders(destinationInetAddress,this.sipProvider.getDefaultListeningPoint());
  MaxForwardsHeader maxForwards=this.sipProvider.getMaxForwardsHeader();
  ContentTypeHeader contTypeHeader;
  ContentLengthHeader contLengthHeader;
  try {
    contTypeHeader=this.sipProvider.getHeaderFactory().createContentTypeHeader(getType(message),getSubType(message));
    if (!DEFAULT_MIME_ENCODING.equalsIgnoreCase(message.getEncoding()))     contTypeHeader.setParameter("String_Node_Str",message.getEncoding());
    contLengthHeader=this.sipProvider.getHeaderFactory().createContentLengthHeader(message.getSize());
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str" + "String_Node_Str",ex);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
catch (  InvalidArgumentException exc) {
    logger.error("String_Node_Str" + "String_Node_Str",exc);
    throw new OperationFailedException("String_Node_Str" + "String_Node_Str",OperationFailedException.INTERNAL_ERROR,exc);
  }
  Request req;
  try {
    req=this.sipProvider.getMessageFactory().createRequest(toHeader.getAddress().getURI(),Request.MESSAGE,callIdHeader,cSeqHeader,fromHeader,toHeader,viaHeaders,maxForwards,contTypeHeader,message.getRawData());
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str",ex);
    throw new OperationFailedException("String_Node_Str",OperationFailedException.INTERNAL_ERROR,ex);
  }
  req.addHeader(contLengthHeader);
  return req;
}