Program: 29241
Project: 29241
Buggy source:
@Override public List getSocketInfo(IOR ior,List previous){
  try {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,baseMsg + "String_Node_Str");
    }
    List result=new ArrayList();
    IIOPProfileTemplate iiopProfileTemplate=(IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate();
    IIOPAddress primary=iiopProfileTemplate.getPrimaryAddress();
    String host=primary.getHost().toLowerCase();
    String type=null;
    int port=0;
    ConnectionContext ctx=new ConnectionContext();
    SocketInfo socketInfo=selector.getSSLPort(ior,ctx);
    selector.setClientConnectionContext(ctx);
    if (socketInfo == null) {
      type=SocketInfo.IIOP_CLEAR_TEXT;
      port=primary.getPort();
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,baseMsg + "String_Node_Str");
      }
    }
 else {
      type=socketInfo.getType();
      port=socketInfo.getPort();
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,baseMsg + "String_Node_Str");
      }
    }
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,baseMsg + "String_Node_Str" + ctx);
      _logger.log(Level.FINE,baseMsg + "String_Node_Str" + type+ "String_Node_Str"+ host+ "String_Node_Str"+ port);
    }
    if (socketInfo != null) {
      result.add(socketInfo);
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,baseMsg + "String_Node_Str" + "String_Node_Str"+ socketInfo.getType()+ "String_Node_Str"+ socketInfo.getHost()+ "String_Node_Str"+ socketInfo.getPort());
      }
      return result;
    }
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,baseMsg + "String_Node_Str");
    }
    if (!previous.isEmpty()) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,baseMsg + "String_Node_Str" + previous);
      }
      return previous;
    }
    SocketInfo primarySocketInfo=createSocketInfo("String_Node_Str",type,host,port);
    result.add(primarySocketInfo);
    Iterator iterator=iiopProfileTemplate.iteratorById(org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS.value);
    while (iterator.hasNext()) {
      AlternateIIOPAddressComponent alternate=(AlternateIIOPAddressComponent)iterator.next();
      host=alternate.getAddress().getHost().toLowerCase();
      port=alternate.getAddress().getPort();
      result.add(createSocketInfo("String_Node_Str",SocketInfo.IIOP_CLEAR_TEXT,host,port));
    }
synchronized (this) {
      List existing=(List)primaryToAddresses.get(primarySocketInfo);
      if (existing == null) {
        primaryToAddresses.put(primarySocketInfo,result);
        result.remove(0);
        java.util.Collections.shuffle(result);
        result.add(0,primarySocketInfo);
        primaryToRandomizedAddresses.put(primarySocketInfo,result);
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,baseMsg + "String_Node_Str" + result);
        }
        return result;
      }
 else {
        if (result.equals(existing)) {
          result=(List)primaryToRandomizedAddresses.get(primarySocketInfo);
          if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE,baseMsg + "String_Node_Str" + result);
          }
          return result;
        }
 else {
          _logger.log(Level.FINE,baseMsg + "String_Node_Str" + "String_Node_Str"+ primarySocketInfo+ "String_Node_Str"+ result+ "String_Node_Str"+ existing);
          return result;
        }
      }
    }
  }
 catch (  Exception ex) {
    _logger.log(Level.WARNING,"String_Node_Str",ex);
    RuntimeException rte=new RuntimeException(ex);
    rte.initCause(ex);
    throw rte;
  }
 finally {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,baseMsg + "String_Node_Str");
    }
  }
}

Fixed version (ground truth):
@Override public List getSocketInfo(IOR ior,List previous){
  try {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,baseMsg + "String_Node_Str");
    }
    List result=new ArrayList();
    IIOPProfileTemplate iiopProfileTemplate=(IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate();
    IIOPAddress primary=iiopProfileTemplate.getPrimaryAddress();
    Locale loc=Locale.getDefault();
    String host=primary.getHost().toLowerCase(loc);
    String type=null;
    int port=0;
    ConnectionContext ctx=new ConnectionContext();
    SocketInfo socketInfo=selector.getSSLPort(ior,ctx);
    selector.setClientConnectionContext(ctx);
    if (socketInfo == null) {
      type=SocketInfo.IIOP_CLEAR_TEXT;
      port=primary.getPort();
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,baseMsg + "String_Node_Str");
      }
    }
 else {
      type=socketInfo.getType();
      port=socketInfo.getPort();
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,baseMsg + "String_Node_Str");
      }
    }
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,baseMsg + "String_Node_Str" + ctx);
      _logger.log(Level.FINE,baseMsg + "String_Node_Str" + type+ "String_Node_Str"+ host+ "String_Node_Str"+ port);
    }
    if (socketInfo != null) {
      result.add(socketInfo);
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,baseMsg + "String_Node_Str" + "String_Node_Str"+ socketInfo.getType()+ "String_Node_Str"+ socketInfo.getHost()+ "String_Node_Str"+ socketInfo.getPort());
      }
      return result;
    }
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,baseMsg + "String_Node_Str");
    }
    if (!previous.isEmpty()) {
      if (_logger.isLoggable(Level.FINE)) {
        _logger.log(Level.FINE,baseMsg + "String_Node_Str" + previous);
      }
      return previous;
    }
    SocketInfo primarySocketInfo=createSocketInfo("String_Node_Str",type,host,port);
    result.add(primarySocketInfo);
    Iterator iterator=iiopProfileTemplate.iteratorById(org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS.value);
    while (iterator.hasNext()) {
      AlternateIIOPAddressComponent alternate=(AlternateIIOPAddressComponent)iterator.next();
      host=alternate.getAddress().getHost().toLowerCase(loc);
      port=alternate.getAddress().getPort();
      result.add(createSocketInfo("String_Node_Str",SocketInfo.IIOP_CLEAR_TEXT,host,port));
    }
synchronized (this) {
      List existing=(List)primaryToAddresses.get(primarySocketInfo);
      if (existing == null) {
        primaryToAddresses.put(primarySocketInfo,result);
        result.remove(0);
        java.util.Collections.shuffle(result);
        result.add(0,primarySocketInfo);
        primaryToRandomizedAddresses.put(primarySocketInfo,result);
        if (_logger.isLoggable(Level.FINE)) {
          _logger.log(Level.FINE,baseMsg + "String_Node_Str" + result);
        }
        return result;
      }
 else {
        if (result.equals(existing)) {
          result=(List)primaryToRandomizedAddresses.get(primarySocketInfo);
          if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE,baseMsg + "String_Node_Str" + result);
          }
          return result;
        }
 else {
          _logger.log(Level.FINE,baseMsg + "String_Node_Str" + "String_Node_Str"+ primarySocketInfo+ "String_Node_Str"+ result+ "String_Node_Str"+ existing);
          return result;
        }
      }
    }
  }
 catch (  Exception ex) {
    _logger.log(Level.WARNING,"String_Node_Str",ex);
    RuntimeException rte=new RuntimeException(ex);
    rte.initCause(ex);
    throw rte;
  }
 finally {
    if (_logger.isLoggable(Level.FINE)) {
      _logger.log(Level.FINE,baseMsg + "String_Node_Str");
    }
  }
}