Program: 145677
Project: 145677
Buggy source:
private boolean guiLogin() throws Exception {
  LoginFrame frame=new LoginFrame(url,dbSchema,dbUser,dbPassword,user,password,new LoginCallback(){
    @Override public boolean tryToLogin(    EasSettings aSettings,    String aDbUser,    char[] aDbPassword,    String aUserName,    char[] aAppPassword) throws Exception {
      EasSettings lsettings=aSettings;
      if (aSettings instanceof DbConnectionSettings) {
        if (aDbUser == null || aDbUser.isEmpty() || aDbPassword == null || aDbPassword.length == 0) {
          throw new Exception(BAD_DB_CREDENTIALS_MSG);
        }
        DbConnectionSettings dbSettings=new DbConnectionSettings();
        dbSettings.setName(((DbConnectionSettings)aSettings).getName());
        dbSettings.setDrivers(((DbConnectionSettings)aSettings).getDrivers());
        dbSettings.setUrl(((DbConnectionSettings)aSettings).getUrl());
        dbSettings.getInfo().putAll(((DbConnectionSettings)aSettings).getInfo());
        dbSettings.getInfo().put(ClientConstants.DB_CONNECTION_USER_PROP_NAME,aDbUser);
        dbSettings.getInfo().put(ClientConstants.DB_CONNECTION_PASSWORD_PROP_NAME,new String(aDbPassword));
        if (appPath != null) {
          dbSettings.setApplicationPath(appPath);
        }
        lsettings=dbSettings;
      }
      Client lclient=ClientFactory.getInstance(lsettings);
      try {
        return appLogin(lclient,aUserName,aAppPassword);
      }
 catch (      Exception ex) {
        lclient.shutdown();
        throw ex;
      }
    }
  }
);
  Preferences settingsNode=Preferences.userRoot().node(ClientFactory.SETTINGS_NODE);
  frame.addExceptionListener(this);
  frame.selectDefaultSettings();
  frame.setDbPassword(settingsNode.get(ClientFactory.DEFAULT_CONNECTION_DB_PASSWORD,"String_Node_Str"));
  frame.setUserPassword(settingsNode.get(ClientFactory.DEFAULT_CONNECTION_USER_PASSWORD,"String_Node_Str"));
  frame.setVisible(true);
  int retValue=frame.getReturnStatus();
  frame.dispose();
  settingsNode.putInt(ClientFactory.DEFAULT_CONNECTION_INDEX_SETTING,frame.getSelectedConnectionIndex());
  if (retValue == LoginFrame.RET_OK) {
    if (frame.getDbPassword() != null) {
      settingsNode.put(ClientFactory.DEFAULT_CONNECTION_DB_PASSWORD,frame.getDbPassword());
    }
 else {
      settingsNode.remove(ClientFactory.DEFAULT_CONNECTION_DB_PASSWORD);
    }
    if (frame.getUserPassword() != null) {
      settingsNode.put(ClientFactory.DEFAULT_CONNECTION_USER_PASSWORD,frame.getUserPassword());
    }
 else {
      settingsNode.remove(ClientFactory.DEFAULT_CONNECTION_USER_PASSWORD);
    }
  }
  return retValue == LoginFrame.RET_OK;
}

Fixed version (ground truth):
private boolean guiLogin() throws Exception {
  LoginFrame frame=new LoginFrame(url,dbSchema,dbUser,dbPassword,user,password,new LoginCallback(){
    @Override public boolean tryToLogin(    EasSettings aSettings,    String aDbUser,    char[] aDbPassword,    String aUserName,    char[] aAppPassword) throws Exception {
      EasSettings lsettings=aSettings;
      if (aSettings instanceof DbConnectionSettings) {
        if (aDbUser == null || aDbUser.isEmpty() || aDbPassword == null || aDbPassword.length == 0) {
          throw new Exception(BAD_DB_CREDENTIALS_MSG);
        }
        DbConnectionSettings dbSettings=new DbConnectionSettings();
        dbSettings.setName(((DbConnectionSettings)aSettings).getName());
        dbSettings.setDrivers(((DbConnectionSettings)aSettings).getDrivers());
        dbSettings.setUrl(((DbConnectionSettings)aSettings).getUrl());
        dbSettings.getInfo().putAll(((DbConnectionSettings)aSettings).getInfo());
        dbSettings.getInfo().put(ClientConstants.DB_CONNECTION_USER_PROP_NAME,aDbUser);
        dbSettings.getInfo().put(ClientConstants.DB_CONNECTION_PASSWORD_PROP_NAME,new String(aDbPassword));
        if (appPath != null) {
          dbSettings.setApplicationPath(appPath);
        }
        lsettings=dbSettings;
      }
      Client lclient=ClientFactory.getInstance(lsettings);
      try {
        return appLogin(lclient,aUserName,aAppPassword);
      }
 catch (      Exception ex) {
        lclient.shutdown();
        throw ex;
      }
    }
  }
);
  Preferences settingsNode=Preferences.userRoot().node(ClientFactory.SETTINGS_NODE);
  frame.addExceptionListener(this);
  frame.selectDefaultSettings();
  frame.setDbPassword(settingsNode.get(ClientFactory.DEFAULT_CONNECTION_DB_PASSWORD,"String_Node_Str"));
  frame.setUserPassword(settingsNode.get(ClientFactory.DEFAULT_CONNECTION_USER_PASSWORD,"String_Node_Str"));
  frame.pack();
  frame.setVisible(true);
  int retValue=frame.getReturnStatus();
  frame.dispose();
  settingsNode.putInt(ClientFactory.DEFAULT_CONNECTION_INDEX_SETTING,frame.getSelectedConnectionIndex());
  if (retValue == LoginFrame.RET_OK) {
    if (frame.getDbPassword() != null) {
      settingsNode.put(ClientFactory.DEFAULT_CONNECTION_DB_PASSWORD,frame.getDbPassword());
    }
 else {
      settingsNode.remove(ClientFactory.DEFAULT_CONNECTION_DB_PASSWORD);
    }
    if (frame.getUserPassword() != null) {
      settingsNode.put(ClientFactory.DEFAULT_CONNECTION_USER_PASSWORD,frame.getUserPassword());
    }
 else {
      settingsNode.remove(ClientFactory.DEFAULT_CONNECTION_USER_PASSWORD);
    }
  }
  return retValue == LoginFrame.RET_OK;
}