Buggy code:
public class AccountSetupOutgoing extends K9Activity implements OnClickListener , OnCheckedChangeListener { private static final String EXTRA_ACCOUNT = "account" ; private static final String EXTRA_MAKE_DEFAULT = "makeDefault" ; private static final String SMTP_PORT = "587" ; private static final String SMTP_SSL_PORT = "465" ; private EditText mUsernameView ; private EditText mPasswordView ; private ClientCertificateSpinner mClientCertificateSpinner ; private TextView mClientCertificateLabelView ; private TextView mPasswordLabelView ; private EditText mServerView ; private EditText mPortView ; private String mCurrentPortViewSetting ; private CheckBox mRequireLoginView ; private ViewGroup mRequireLoginSettingsView ; private Spinner mSecurityTypeView ; private int mCurrentSecurityTypeViewPosition ; private Spinner mAuthTypeView ; private int mCurrentAuthTypeViewPosition ; private ArrayAdapter < AuthType > mAuthTypeAdapter ; private Button mNextButton ; private Account mAccount ; private boolean mMakeDefault ; public static void actionOutgoingSettings ( Context context , Account account , boolean makeDefault ) { } public static void actionEditOutgoingSettings ( Context context , Account account ) { } public static Intent intentActionEditOutgoingSettings ( Context context , Account account ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ) ; setContentView ( account_setup_outgoing ) ; String accountUuid = getIntent ( ) . getStringExtra ( AccountSetupOutgoing . EXTRA_ACCOUNT ) ; mAccount = Preferences . getPreferences ( this ) . getAccount ( accountUuid ) ; try { if ( new URI ( mAccount . getStoreUri ( ) ) . getScheme ( ) . startsWith ( "webdav" ) ) { mAccount . setTransportUri ( mAccount . getStoreUri ( ) ) ; AccountSetupCheckSettings . actionCheckSettings ( this , mAccount , OUTGOING ) ; } } catch ( URISyntaxException e ) { e . printStackTrace ( ) ; } mUsernameView = ( ( EditText ) ( findViewById ( account_username ) ) ) ; mPasswordView = ( ( EditText ) ( findViewById ( account_password ) ) ) ; mClientCertificateSpinner = ( ( ClientCertificateSpinner ) ( findViewById ( account_client_certificate_spinner ) ) ) ; mClientCertificateLabelView = ( ( TextView ) ( findViewById ( account_client_certificate_label ) ) ) ; mPasswordLabelView = ( ( TextView ) ( findViewById ( account_password_label ) ) ) ; mServerView = ( ( EditText ) ( findViewById ( account_server ) ) ) ; mPortView = ( ( EditText ) ( findViewById ( account_port ) ) ) ; mRequireLoginView = ( ( CheckBox ) ( findViewById ( account_require_login ) ) ) ; mRequireLoginSettingsView = ( ( ViewGroup ) ( findViewById ( account_require_login_settings ) ) ) ; mSecurityTypeView = ( ( Spinner ) ( findViewById ( account_security_type ) ) ) ; mAuthTypeView = ( ( Spinner ) ( findViewById ( account_auth_type ) ) ) ; mNextButton = ( ( Button ) ( findViewById ( next ) ) ) ; mNextButton . setOnClickListener ( this ) ; mSecurityTypeView . setAdapter ( ConnectionSecurity . getArrayAdapter ( this ) ) ; mAuthTypeAdapter = AuthType . getArrayAdapter ( this , SslHelper . isClientCertificateSupportAvailable ( ) ) ; mAuthTypeView . setAdapter ( mAuthTypeAdapter ) ; mPortView . setKeyListener ( DigitsKeyListener . getInstance ( "0123456789" ) ) ; accountUuid = getIntent ( ) . getStringExtra ( AccountSetupOutgoing . EXTRA_ACCOUNT ) ; mAccount = Preferences . getPreferences ( this ) . getAccount ( accountUuid ) ; mMakeDefault = getIntent ( ) . getBooleanExtra ( AccountSetupOutgoing . EXTRA_MAKE_DEFAULT , false ) ; if ( ( savedInstanceState != null ) && ( savedInstanceState . containsKey ( AccountSetupOutgoing . EXTRA_ACCOUNT ) ) ) { accountUuid = savedInstanceState . getString ( AccountSetupOutgoing . EXTRA_ACCOUNT ) ; mAccount = Preferences . getPreferences ( this ) . getAccount ( accountUuid ) ; } try { ServerSettings settings = Transport . decodeTransportUri ( mAccount . getTransportUri ( ) ) ; updateAuthPlainTextFromSecurityType ( settings . connectionSecurity ) ; mCurrentAuthTypeViewPosition = mAuthTypeAdapter . getPosition ( settings . authenticationType ) ; mAuthTypeView . setSelection ( mCurrentAuthTypeViewPosition , false ) ; updateViewFromAuthType ( ) ; mCurrentSecurityTypeViewPosition = settings . connectionSecurity . ordinal ( ) ; mSecurityTypeView . setSelection ( mCurrentSecurityTypeViewPosition , false ) ; <START_BUG> if ( ( settings . username ) != null ) { <END_BUG> mUsernameView . setText ( settings . username ) ; mRequireLoginView . setChecked ( true ) ; mRequireLoginSettingsView . setVisibility ( VISIBLE ) ; } if ( ( settings . password ) != null ) { mPasswordView . setText ( settings . password ) ; } if ( ( settings . clientCertificateAlias ) != null ) { mClientCertificateSpinner . setAlias ( settings . clientCertificateAlias ) ; } if ( ( settings . host ) != null ) { mServerView . setText ( settings . host ) ; } if ( ( settings . port ) != ( - 1 ) ) { mPortView . setText ( Integer . toString ( settings . port ) ) ; } else { updatePortFromSecurityType ( ) ; } mCurrentPortViewSetting = mPortView . getText ( ) . toString ( ) ; initializeViewListeners ( ) ; validateFields ( ) ; } catch ( Exception e ) { failure ( e ) ; } } private void initializeViewListeners ( ) { } @ Override public void onSaveInstanceState ( Bundle outState ) { } private void updateViewFromAuthType ( ) { } private void validateFields ( ) { } private void updatePortFromSecurityType ( ) { } private String getDefaultSmtpPort ( ConnectionSecurity securityType ) { } private void updateAuthPlainTextFromSecurityType ( ConnectionSecurity securityType ) { } @ Override public void onActivityResult ( int requestCode , int resultCode , Intent data ) { } protected void onNext ( ) { } public void onClick ( View v ) { } public void onCheckedChanged ( CompoundButton buttonView , boolean isChecked ) { } private void failure ( Exception use ) { } TextWatcher validationTextWatcher = new TextWatcher ( ) { public void afterTextChanged ( Editable s ) { } public void beforeTextChanged ( CharSequence s , int start , int count , int after ) { } public void onTextChanged ( CharSequence s , int start , int before , int count ) { } } ; OnClientCertificateChangedListener clientCertificateChangedListener = new OnClientCertificateChangedListener ( ) { @ Override public void onClientCertificateChanged ( String alias ) { }

Fix:
if ( ( ( settings . username ) != null ) && ( ! ( settings . username . isEmpty ( ) ) ) ) {