Program: 104287
Project: 104287
Buggy source:
/** 
 * Initializes the SipRegistrarConnection that this class will be using.
 * @param accountID the ID of the account that this registrar is associatedwith.
 * @throws java.lang.IllegalArgumentException if one or more accountproperties have invalid values.
 */
private void initRegistrarConnection(SipAccountID accountID) throws IllegalArgumentException {
  String registrarAddressStr=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.SERVER_ADDRESS);
  if (registrarAddressStr == null) {
    String userID=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.USER_ID);
    if (userID.indexOf("String_Node_Str") > -1)     registrarAddressStr=userID.substring(userID.indexOf("String_Node_Str") + 1);
  }
  if (registrarAddressStr == null || registrarAddressStr.trim().length() == 0) {
    initRegistrarlessConnection(accountID);
    return;
  }
  InetAddress registrarAddress=null;
  int registrarPort=ListeningPoint.PORT_5060;
  try {
    String registrarTransport=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.PREFERRED_TRANSPORT);
    if (registrarTransport == null)     registrarTransport=getDefaultTransport();
    InetSocketAddress registrarSocketAddress=resolveSipAddress(registrarAddressStr,registrarTransport);
    registrarAddress=registrarSocketAddress.getAddress();
    registrarPort=registrarSocketAddress.getPort();
    accountID.putProperty(ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,Boolean.toString(true));
  }
 catch (  UnknownHostException ex) {
    logger.debug(registrarAddressStr + "String_Node_Str",ex);
    String serverValidatedString=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED);
    boolean isServerValidated=false;
    if (serverValidatedString != null)     isServerValidated=new Boolean(serverValidatedString).booleanValue();
    if (serverValidatedString == null || !isServerValidated) {
      throw new IllegalArgumentException(registrarAddressStr + "String_Node_Str" + ex.getMessage());
    }
  }
  if (registrarAddress == null) {
    fireRegistrationStateChanged(RegistrationState.UNREGISTERED,RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_SERVER_NOT_FOUND,"String_Node_Str");
    return;
  }
  String registrarPortStr=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.SERVER_PORT);
  if (registrarPortStr != null && registrarPortStr.length() > 0) {
    try {
      registrarPort=Integer.parseInt(registrarPortStr);
    }
 catch (    NumberFormatException ex) {
      logger.error(registrarPortStr + "String_Node_Str",ex);
    }
    if (registrarPort > NetworkUtils.MAX_PORT_NUMBER) {
      throw new IllegalArgumentException(registrarPort + "String_Node_Str" + NetworkUtils.MAX_PORT_NUMBER+ "String_Node_Str");
    }
  }
  String registrarTransport=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.PREFERRED_TRANSPORT);
  if (registrarTransport != null && registrarTransport.length() > 0) {
    if (!registrarTransport.equals(ListeningPoint.UDP) && !registrarTransport.equals(ListeningPoint.TCP) && !registrarTransport.equals(ListeningPoint.TLS)) {
      throw new IllegalArgumentException(registrarTransport + "String_Node_Str" + "String_Node_Str");
    }
  }
 else {
    registrarTransport=ListeningPoint.UDP;
  }
  int expires=SipRegistrarConnection.DEFAULT_REGISTRATION_EXPIRATION;
  String expiresStr=SipActivator.getConfigurationService().getString(REGISTRATION_EXPIRATION);
  if (expiresStr != null && expiresStr.length() > 0) {
    try {
      expires=Integer.parseInt(expiresStr);
    }
 catch (    NumberFormatException ex) {
      logger.error(expiresStr + "String_Node_Str",ex);
    }
  }
  try {
    this.sipRegistrarConnection=new SipRegistrarConnection(registrarAddress,registrarPort,registrarTransport,expires,this);
    String useRouteString=(String)accountID.getAccountProperties().get(REGISTERS_USE_ROUTE);
    boolean useRoute=false;
    if (useRouteString != null)     useRoute=new Boolean(useRouteString).booleanValue();
    this.sipRegistrarConnection.setRouteHeaderEnabled(useRoute);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str" + registrarAddress.getHostAddress(),ex);
    throw new IllegalArgumentException("String_Node_Str" + registrarAddress.getHostAddress() + "String_Node_Str"+ ex.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * Initializes the SipRegistrarConnection that this class will be using.
 * @param accountID the ID of the account that this registrar is associatedwith.
 * @throws java.lang.IllegalArgumentException if one or more accountproperties have invalid values.
 */
private void initRegistrarConnection(SipAccountID accountID) throws IllegalArgumentException {
  String registrarAddressStr=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.SERVER_ADDRESS);
  if (registrarAddressStr == null) {
    String userID=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.USER_ID);
    int index=userID.indexOf("String_Node_Str");
    if (index > -1)     registrarAddressStr=userID.substring(index + 1);
  }
  if (registrarAddressStr == null || registrarAddressStr.trim().length() == 0) {
    initRegistrarlessConnection(accountID);
    return;
  }
  InetAddress registrarAddress=null;
  int registrarPort=ListeningPoint.PORT_5060;
  try {
    String registrarTransport=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.PREFERRED_TRANSPORT);
    if (registrarTransport == null)     registrarTransport=getDefaultTransport();
    InetSocketAddress registrarSocketAddress=resolveSipAddress(registrarAddressStr,registrarTransport);
    registrarAddress=registrarSocketAddress.getAddress();
    registrarPort=registrarSocketAddress.getPort();
    accountID.putProperty(ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED,Boolean.toString(true));
  }
 catch (  UnknownHostException ex) {
    logger.debug(registrarAddressStr + "String_Node_Str",ex);
    String serverValidatedString=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.SERVER_ADDRESS_VALIDATED);
    boolean isServerValidated=false;
    if (serverValidatedString != null)     isServerValidated=new Boolean(serverValidatedString).booleanValue();
    if (serverValidatedString == null || !isServerValidated) {
      throw new IllegalArgumentException(registrarAddressStr + "String_Node_Str" + ex.getMessage());
    }
  }
  if (registrarAddress == null) {
    fireRegistrationStateChanged(RegistrationState.UNREGISTERED,RegistrationState.CONNECTION_FAILED,RegistrationStateChangeEvent.REASON_SERVER_NOT_FOUND,"String_Node_Str");
    return;
  }
  String registrarPortStr=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.SERVER_PORT);
  if (registrarPortStr != null && registrarPortStr.length() > 0) {
    try {
      registrarPort=Integer.parseInt(registrarPortStr);
    }
 catch (    NumberFormatException ex) {
      logger.error(registrarPortStr + "String_Node_Str",ex);
    }
    if (registrarPort > NetworkUtils.MAX_PORT_NUMBER) {
      throw new IllegalArgumentException(registrarPort + "String_Node_Str" + NetworkUtils.MAX_PORT_NUMBER+ "String_Node_Str");
    }
  }
  String registrarTransport=(String)accountID.getAccountProperties().get(ProtocolProviderFactory.PREFERRED_TRANSPORT);
  if (registrarTransport != null && registrarTransport.length() > 0) {
    if (!registrarTransport.equals(ListeningPoint.UDP) && !registrarTransport.equals(ListeningPoint.TCP) && !registrarTransport.equals(ListeningPoint.TLS)) {
      throw new IllegalArgumentException(registrarTransport + "String_Node_Str" + "String_Node_Str");
    }
  }
 else {
    registrarTransport=ListeningPoint.UDP;
  }
  int expires=SipRegistrarConnection.DEFAULT_REGISTRATION_EXPIRATION;
  String expiresStr=SipActivator.getConfigurationService().getString(REGISTRATION_EXPIRATION);
  if (expiresStr != null && expiresStr.length() > 0) {
    try {
      expires=Integer.parseInt(expiresStr);
    }
 catch (    NumberFormatException ex) {
      logger.error(expiresStr + "String_Node_Str",ex);
    }
  }
  try {
    this.sipRegistrarConnection=new SipRegistrarConnection(registrarAddress,registrarPort,registrarTransport,expires,this);
    String useRouteString=(String)accountID.getAccountProperties().get(REGISTERS_USE_ROUTE);
    boolean useRoute=false;
    if (useRouteString != null)     useRoute=new Boolean(useRouteString).booleanValue();
    this.sipRegistrarConnection.setRouteHeaderEnabled(useRoute);
  }
 catch (  ParseException ex) {
    logger.error("String_Node_Str" + registrarAddress.getHostAddress(),ex);
    throw new IllegalArgumentException("String_Node_Str" + registrarAddress.getHostAddress() + "String_Node_Str"+ ex.getMessage());
  }
}