aintshy / android

Android App
Other
7 stars 1 forks source link

Not optimal code #21

Closed troian88 closed 10 years ago

troian88 commented 10 years ago

public String doInBackground(final Void... none) { String error = ""; try { App.class.cast( LoginActivity.this.getApplication() ).authenticate(email, password); } catch (final NoAuthException ex) { error = ex.getLocalizedMessage(); } return error; } ~ Not optimal code and call method; Example: public String doInBackground(final Void... none) { try { authenticate(email, password); } catch (final NoAuthException ex) { return ex.getLocalizedMessage(); } return null; }

yegor256 commented 10 years ago

It is wrong to have multiple return's in one method: http://stackoverflow.com/questions/36707/should-a-function-have-only-one-return-statement