CR: Add overloaded createNewRepo method which provides default arguments.

Instead of passing in `null` each time you don't have a username/password,
this change provides those as meaningful default values in an overloaded
version of the method. This takes care of Java's lack of default argument
support.
This commit is contained in:
Peter Serwylo 2015-11-16 18:00:58 +11:00
parent 3426b3bb2d
commit 0b3b32dab3

View File

@ -553,7 +553,7 @@ public class ManageReposActivity extends ActionBarActivity {
} else {
// create repo without username/password
createNewRepo(newAddress, fingerprint, null, null);
createNewRepo(newAddress, fingerprint);
}
}
}
@ -570,7 +570,7 @@ public class ManageReposActivity extends ActionBarActivity {
// or their internet is playing up, then you'd have to wait for several
// connection timeouts before being able to proceed.
createNewRepo(originalAddress, fingerprint, null, null);
createNewRepo(originalAddress, fingerprint);
checker.cancel(false);
}
});
@ -606,6 +606,13 @@ public class ManageReposActivity extends ActionBarActivity {
path, uri.getQuery(), uri.getFragment()).toString();
}
/**
* Create a repository without a username or password.
*/
private void createNewRepo(String address, String fingerprint) {
createNewRepo(address, fingerprint, null, null);
}
private void createNewRepo(String address, String fingerprint, final String username, final String password) {
try {
address = normalizeUrl(address);