private void prefillCurrentAuth()
{
+ _usernameField.setText("");
+ _passwordField.setText("");
+ _authAccepted.setText(" ");
+
String authString = Config.getConfigString(Config.KEY_EARTHDATA_AUTH);
- if (authString == null)
- {
- _usernameField.setText("");
- _passwordField.setText("");
- }
- String decoded = new String(Base64.getDecoder().decode(authString));
- if (decoded.contains(":"))
+ try
{
- _usernameField.setText(decoded.split(":", 2)[0]);
- _passwordField.setText(decoded.split(":", 2)[1]);
+ String decoded = new String(Base64.getDecoder().decode(authString));
+ if (decoded.contains(":"))
+ {
+ _usernameField.setText(decoded.split(":", 2)[0]);
+ _passwordField.setText(decoded.split(":", 2)[1]);
+ }
}
- else
+ catch (Exception e)
{
- _usernameField.setText("");
- _passwordField.setText("");
+ // empty settings, or invalid base64 data --leave blank
+ return;
}
-
- _authAccepted.setText(" ");
}
private void testUsernameAndPassword()