Program: 33122
Project: 33122
Buggy source:
private Request buildBaseRequest(String method,String username,String domain,String toSipUri,ListeningPoint listeningPoint,HashMap<String,Object> clientContext) throws JainSipException {
  try {
    String fromSipUri;
    if (domain != null && !domain.equals("String_Node_Str")) {
      fromSipUri="String_Node_Str" + username + "String_Node_Str"+ sipUri2IpAddress(domain);
    }
 else {
      fromSipUri="String_Node_Str" + username + "String_Node_Str"+ listeningPoint.getIPAddress();
    }
    Address fromAddress=jainSipAddressFactory.createAddress(fromSipUri);
    fromAddress.setDisplayName(username);
    Address toAddress;
    URI requestUri;
    if (method.equals(Request.REGISTER)) {
      toAddress=fromAddress;
      requestUri=jainSipAddressFactory.createAddress(domain).getURI();
    }
 else {
      String cleanUri=toSipUri.replace("String_Node_Str","String_Node_Str").replace("String_Node_Str","String_Node_Str");
      toAddress=jainSipAddressFactory.createAddress(cleanUri);
      requestUri=jainSipAddressFactory.createURI(cleanUri);
    }
    Request request=jainSipMessageFactory.createRequest(requestUri,method,jainSipProvider.getNewCallId(),jainSipHeaderFactory.createCSeqHeader(1l,method),jainSipHeaderFactory.createFromHeader(fromAddress,Long.toString(System.currentTimeMillis())),jainSipHeaderFactory.createToHeader(toAddress,null),createViaHeaders(listeningPoint),jainSipHeaderFactory.createMaxForwardsHeader(MAX_FORWARDS));
    if (domain != null && !domain.equals("String_Node_Str")) {
      RouteHeader routeHeader=createRouteHeader(domain);
      request.addFirst(routeHeader);
    }
    String registeringDomain=null;
    if (method.equals(Request.REGISTER)) {
      registeringDomain=domain;
    }
    Address contactAddress=createContactAddress(listeningPoint,registeringDomain,clientContext);
    ContactHeader contactHeader=jainSipHeaderFactory.createContactHeader(contactAddress);
    request.addHeader(contactHeader);
    request.addHeader(createUserAgentHeader());
    return request;
  }
 catch (  ParseException e) {
    if (method.equals(Request.REGISTER)) {
      throw new JainSipException(RCClient.ErrorCodes.ERROR_DEVICE_REGISTER_URI_INVALID,RCClient.errorText(RCClient.ErrorCodes.ERROR_DEVICE_REGISTER_URI_INVALID),e);
    }
 else     if (method.equals(Request.INVITE)) {
      throw new JainSipException(RCClient.ErrorCodes.ERROR_CONNECTION_URI_INVALID,RCClient.errorText(RCClient.ErrorCodes.ERROR_CONNECTION_URI_INVALID),e);
    }
 else {
      throw new JainSipException(RCClient.ErrorCodes.ERROR_MESSAGE_URI_INVALID,RCClient.errorText(RCClient.ErrorCodes.ERROR_MESSAGE_URI_INVALID),e);
    }
  }
catch (  JainSipException e) {
    throw e;
  }
catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
private Request buildBaseRequest(String method,String username,String domain,String toSipUri,ListeningPoint listeningPoint,HashMap<String,Object> clientContext) throws JainSipException {
  try {
    String fromSipUri;
    if (domain != null && !domain.equals("String_Node_Str")) {
      fromSipUri="String_Node_Str" + username + "String_Node_Str"+ sipUri2IpAddress(domain);
    }
 else {
      fromSipUri="String_Node_Str" + username + "String_Node_Str"+ listeningPoint.getIPAddress();
    }
    Address fromAddress=jainSipAddressFactory.createAddress(fromSipUri);
    fromAddress.setDisplayName(username);
    Address toAddress;
    URI requestUri;
    if (method.equals(Request.REGISTER)) {
      toAddress=fromAddress;
      requestUri=jainSipAddressFactory.createAddress(domain).getURI();
    }
 else {
      String cleanUri=toSipUri.replace("String_Node_Str","String_Node_Str");
      toAddress=jainSipAddressFactory.createAddress(cleanUri);
      requestUri=jainSipAddressFactory.createURI(cleanUri);
    }
    Request request=jainSipMessageFactory.createRequest(requestUri,method,jainSipProvider.getNewCallId(),jainSipHeaderFactory.createCSeqHeader(1l,method),jainSipHeaderFactory.createFromHeader(fromAddress,Long.toString(System.currentTimeMillis())),jainSipHeaderFactory.createToHeader(toAddress,null),createViaHeaders(listeningPoint),jainSipHeaderFactory.createMaxForwardsHeader(MAX_FORWARDS));
    if (domain != null && !domain.equals("String_Node_Str")) {
      RouteHeader routeHeader=createRouteHeader(domain);
      request.addFirst(routeHeader);
    }
    String registeringDomain=null;
    if (method.equals(Request.REGISTER)) {
      registeringDomain=domain;
    }
    Address contactAddress=createContactAddress(listeningPoint,registeringDomain,clientContext);
    ContactHeader contactHeader=jainSipHeaderFactory.createContactHeader(contactAddress);
    request.addHeader(contactHeader);
    request.addHeader(createUserAgentHeader());
    return request;
  }
 catch (  ParseException e) {
    if (method.equals(Request.REGISTER)) {
      throw new JainSipException(RCClient.ErrorCodes.ERROR_DEVICE_REGISTER_URI_INVALID,RCClient.errorText(RCClient.ErrorCodes.ERROR_DEVICE_REGISTER_URI_INVALID),e);
    }
 else     if (method.equals(Request.INVITE)) {
      throw new JainSipException(RCClient.ErrorCodes.ERROR_CONNECTION_URI_INVALID,RCClient.errorText(RCClient.ErrorCodes.ERROR_CONNECTION_URI_INVALID),e);
    }
 else {
      throw new JainSipException(RCClient.ErrorCodes.ERROR_MESSAGE_URI_INVALID,RCClient.errorText(RCClient.ErrorCodes.ERROR_MESSAGE_URI_INVALID),e);
    }
  }
catch (  JainSipException e) {
    throw e;
  }
catch (  Exception e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}