String list = null;
String list = "";
    private boolean attempt()    {        UserCredentials uc = config.getCredentials();        try {            if (uc == null)                 throw new DSOutOfServiceException(                                "No user's credentials have been entered yet.");            //NOTE: This will never happen if the Splash Screen always blocks            //waiting for the user's credentials and the login dialog never            //passes null credentials along.                        DataServicesFactory factory = DataServicesFactory.getInstance(                                                                    container);            if (factory.isConnected()) return true;            factory.connect(uc);            //Log success.            LogMessage msg = new LogMessage();            msg.println("Logged onto OMERO at: "+uc.getHostName());            msg.println(uc);            Logger logger = container.getRegistry().getLogger();            logger.info(this, msg);                        Preferences userPrefs =                     Preferences.userNodeForPackage(LoginConfig.class);            String servers = null;            servers = userPrefs.get(LoginConfig.OMERO_SERVER, servers);            String listOfServers = null;            if (servers == null) {                listOfServers = uc.getHostName();            } else {                String[] l =                         servers.split(LoginConfig.SERVER_NAME_SEPARATOR, 0);                if (l == null || l.length == 0) {                    listOfServers = uc.getHostName();                } else {                    int n = l.length-1;                    String name = uc.getHostName();                    String host;                    String list = null;                    for (int index = 0; index < l.length; index++) {                        host = l[index].trim();                        if (!name.equals(host)) {                            if (index == 0) list = host;                            else list += host;                            if (index != n) list += ",";                        }                    }                    listOfServers = uc.getHostName()+","+list;                }            }            if (listOfServers != null) {                userPrefs.put(LoginConfig.OMERO_SERVER, listOfServers);            }            return true;        } catch (DSOutOfServiceException dsose) {  //Log failure.            LogMessage msg = new LogMessage();            msg.println("Failed to log onto OMERO.");            msg.println("Reason: "+dsose);            msg.println("OMERO Address: "+uc.getHostName());            if (uc != null) msg.println(uc);            Logger logger = container.getRegistry().getLogger();            logger.error(this, msg);        }        return false;    }