Program: 103514
Project: 103514
Buggy source:
/** 
 * Extracts all properties concerning the usage of an outbound proxy for this account.
 * @param accountID the account whose outbound proxy we are currentlyinitializing.
 * @param ix index of the address to use.
 */
void initOutboundProxy(SipAccountID accountID,int ix){
  String proxyAddressStr=accountID.getAccountPropertyString(ProtocolProviderFactory.PROXY_ADDRESS);
  if (proxyAddressStr == null || proxyAddressStr.trim().length() == 0) {
    proxyAddressStr=accountID.getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS);
    if (proxyAddressStr == null || proxyAddressStr.trim().length() == 0) {
      return;
    }
  }
  InetAddress proxyAddress=null;
  int proxyPort=ListeningPoint.PORT_5060;
  try {
    String proxyTransport=accountID.getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
    if (proxyTransport == null)     proxyTransport=getDefaultTransport();
    InetSocketAddress proxySocketAddress=resolveSipAddress(proxyAddressStr,proxyTransport)[ix];
    proxyAddress=proxySocketAddress.getAddress();
    proxyPort=proxySocketAddress.getPort();
    proxyAddressStr=proxyAddress.getHostName();
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str" + proxyAddressStr);
    accountID.putAccountProperty(ProtocolProviderFactory.PROXY_ADDRESS_VALIDATED,Boolean.toString(true));
  }
 catch (  UnknownHostException ex) {
    logger.error(proxyAddressStr + "String_Node_Str" + "String_Node_Str",ex);
    boolean isProxyValidated=accountID.getAccountPropertyBoolean(ProtocolProviderFactory.PROXY_ADDRESS_VALIDATED,false);
    if (!isProxyValidated) {
      throw new IllegalArgumentException(proxyAddressStr + "String_Node_Str" + "String_Node_Str",ex);
    }
  }
  if (proxyAddressStr == null || proxyAddressStr.length() == 0 || proxyAddress == null) {
    return;
  }
  proxyPort=accountID.getAccountPropertyInt(ProtocolProviderFactory.PROXY_PORT,proxyPort);
  if (proxyPort > NetworkUtils.MAX_PORT_NUMBER) {
    throw new IllegalArgumentException(proxyPort + "String_Node_Str" + NetworkUtils.MAX_PORT_NUMBER+ "String_Node_Str");
  }
  String proxyTransport=accountID.getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
  if (proxyTransport != null && proxyTransport.length() > 0) {
    if (!proxyTransport.equals(ListeningPoint.UDP) && !proxyTransport.equals(ListeningPoint.TCP) && !proxyTransport.equals(ListeningPoint.TLS)) {
      throw new IllegalArgumentException(proxyTransport + "String_Node_Str" + "String_Node_Str");
    }
  }
 else {
    proxyTransport=ListeningPoint.UDP;
  }
  StringBuilder proxyStringBuffer=new StringBuilder(proxyAddress.getHostAddress());
  if (proxyAddress instanceof Inet6Address) {
    proxyStringBuffer.insert(0,'[');
    proxyStringBuffer.append(']');
  }
  proxyStringBuffer.append(':');
  proxyStringBuffer.append(Integer.toString(proxyPort));
  proxyStringBuffer.append('/');
  proxyStringBuffer.append(proxyTransport);
  this.outboundProxyString=proxyStringBuffer.toString();
  this.outboundProxySocketAddress=new InetSocketAddress(proxyAddress,proxyPort);
  this.outboundProxyTransport=proxyTransport;
}

Fixed version (ground truth):
/** 
 * Extracts all properties concerning the usage of an outbound proxy for this account.
 * @param accountID the account whose outbound proxy we are currentlyinitializing.
 * @param ix index of the address to use.
 */
void initOutboundProxy(SipAccountID accountID,int ix){
  String proxyAddressStr=accountID.getAccountPropertyString(ProtocolProviderFactory.PROXY_ADDRESS);
  boolean proxyAddressAndPortEntered=false;
  if (proxyAddressStr == null || proxyAddressStr.trim().length() == 0) {
    proxyAddressStr=accountID.getAccountPropertyString(ProtocolProviderFactory.SERVER_ADDRESS);
    if (proxyAddressStr == null || proxyAddressStr.trim().length() == 0) {
      return;
    }
  }
 else {
    if (accountID.getAccountProperty(ProtocolProviderFactory.PROXY_PORT) != null) {
      proxyAddressAndPortEntered=true;
    }
  }
  InetAddress proxyAddress=null;
  int proxyPort=ListeningPoint.PORT_5060;
  String proxyTransport=accountID.getAccountPropertyString(ProtocolProviderFactory.PREFERRED_TRANSPORT);
  if (proxyTransport != null && proxyTransport.length() > 0) {
    if (!proxyTransport.equals(ListeningPoint.UDP) && !proxyTransport.equals(ListeningPoint.TCP) && !proxyTransport.equals(ListeningPoint.TLS)) {
      throw new IllegalArgumentException(proxyTransport + "String_Node_Str" + "String_Node_Str");
    }
  }
 else {
    proxyTransport=getDefaultTransport();
  }
  try {
    proxyPort=accountID.getAccountPropertyInt(ProtocolProviderFactory.PROXY_PORT,proxyPort);
    if (proxyPort > NetworkUtils.MAX_PORT_NUMBER) {
      throw new IllegalArgumentException(proxyPort + "String_Node_Str" + NetworkUtils.MAX_PORT_NUMBER+ "String_Node_Str");
    }
    InetSocketAddress proxySocketAddress=null;
    if (proxyAddressAndPortEntered) {
      ArrayList<InetSocketAddress> addresses=new ArrayList<InetSocketAddress>();
      resolveAddresses(proxyAddressStr,addresses,Boolean.getBoolean("String_Node_Str"),proxyPort);
      if (addresses.size() > ix)       proxySocketAddress=addresses.get(ix);
    }
 else {
      proxySocketAddress=resolveSipAddress(proxyAddressStr,proxyTransport)[ix];
    }
    proxyAddress=proxySocketAddress.getAddress();
    proxyPort=proxySocketAddress.getPort();
    proxyAddressStr=proxyAddress.getHostName();
    if (logger.isTraceEnabled())     logger.trace("String_Node_Str" + proxyAddressStr);
    accountID.putAccountProperty(ProtocolProviderFactory.PROXY_ADDRESS_VALIDATED,Boolean.toString(true));
  }
 catch (  UnknownHostException ex) {
    logger.error(proxyAddressStr + "String_Node_Str" + "String_Node_Str",ex);
    boolean isProxyValidated=accountID.getAccountPropertyBoolean(ProtocolProviderFactory.PROXY_ADDRESS_VALIDATED,false);
    if (!isProxyValidated) {
      throw new IllegalArgumentException(proxyAddressStr + "String_Node_Str" + "String_Node_Str",ex);
    }
  }
  if (proxyAddressStr == null || proxyAddressStr.length() == 0 || proxyAddress == null) {
    return;
  }
  StringBuilder proxyStringBuffer=new StringBuilder(proxyAddress.getHostAddress());
  if (proxyAddress instanceof Inet6Address) {
    proxyStringBuffer.insert(0,'[');
    proxyStringBuffer.append(']');
  }
  proxyStringBuffer.append(':');
  proxyStringBuffer.append(Integer.toString(proxyPort));
  proxyStringBuffer.append('/');
  proxyStringBuffer.append(proxyTransport);
  this.outboundProxyString=proxyStringBuffer.toString();
  this.outboundProxySocketAddress=new InetSocketAddress(proxyAddress,proxyPort);
  this.outboundProxyTransport=proxyTransport;
}