Drop unnecessary elses after returns

This commit is contained in:
Daniel Martí 2015-04-16 18:51:29 +02:00
parent e1a6e2386f
commit 5e7146d19a
13 changed files with 31 additions and 48 deletions

View File

@ -400,11 +400,10 @@ public class FDroid extends ActionBarActivity {
getPreferences(MODE_PRIVATE).edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
updateRepos();
return true;
} else {
}
Log.d(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
return false;
}
}
// Force a repo update now. A progress dialog is shown and the UpdateService
// is told to do the update, which will result in the database changing. The

View File

@ -335,7 +335,7 @@ public final class Utils {
|| keyHexString.matches(".*[^a-fA-F0-9].*")) {
Log.e(TAG, "Signing key certificate was blank or contained a non-hex-digit!");
return null;
} else
}
return calcFingerprint(Hasher.unhex(keyHexString));
}
@ -385,7 +385,8 @@ public final class Utils {
final String[] parts = languageTag.split("-");
if (parts.length == 1) {
return new Locale(parts[0]);
} else if (parts.length == 2) {
}
if (parts.length == 2) {
String country = parts[1];
// Some languages have an "r" before the country as per the values folders, such
// as "zh-rCN". As far as the Locale class is concerned, the "r" is
@ -395,11 +396,10 @@ public final class Utils {
country = country.substring(1);
}
return new Locale(parts[0], country);
} else {
}
Log.e(TAG, "Locale could not be parsed from language tag: " + languageTag);
return new Locale(languageTag);
}
}
public static class CommaSeparatedList implements Iterable<String> {
private final String value;
@ -411,7 +411,6 @@ public final class Utils {
public static CommaSeparatedList make(List<String> list) {
if (list == null || list.size() == 0)
return null;
else {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.size(); i++) {
if (i > 0) {
@ -421,12 +420,10 @@ public final class Utils {
}
return new CommaSeparatedList(sb.toString());
}
}
public static CommaSeparatedList make(String list) {
if (list == null || list.length() == 0)
return null;
else
return new CommaSeparatedList(list);
}

View File

@ -12,9 +12,8 @@ public abstract class ClipboardCompat extends Compatibility {
public static ClipboardCompat create(Context context) {
if (hasApi(11)) {
return new HoneycombClipboard(context);
} else {
return new OldClipboard();
}
return new OldClipboard();
}
}

View File

@ -19,9 +19,8 @@ public abstract class SwitchCompat extends Compatibility {
public static SwitchCompat create(Context context) {
if (hasApi(14)) {
return new IceCreamSwitch(context);
} else {
return new OldSwitch(context);
}
return new OldSwitch(context);
}
}

View File

@ -120,9 +120,8 @@ public class NewRepoConfig {
public Uri getRepoUri() {
if (uriString == null) {
return null;
} else {
return Uri.parse(uriString);
}
return Uri.parse(uriString);
}
public String getHost() { return host; }

View File

@ -185,9 +185,8 @@ public class LocalRepoManager {
if (dir.exists()) {
if (dir.isDirectory()) {
return;
} else {
throw new IOException("Can't make directory " + dir + " - it is already a file.");
}
throw new IOException("Can't make directory " + dir + " - it is already a file.");
}
if (!dir.mkdir()) {

View File

@ -135,11 +135,10 @@ public class ApkDownloader implements AsyncDownloadWrapper.Listener {
if (hashMatches()) {
Log.d(TAG, "Using cached apk at " + localFile);
return true;
} else {
}
Log.d(TAG, "Not using cached apk at " + localFile);
deleteLocalFile();
}
}
return false;
}

View File

@ -11,18 +11,16 @@ public class DownloaderFactory {
throws IOException {
if (isOnionAddress(url)) {
return new TorHttpDownloader(url, context);
} else {
return new HttpDownloader(url, context);
}
return new HttpDownloader(url, context);
}
public static Downloader create(String url, File destFile)
throws IOException {
if (isOnionAddress(url)) {
return new TorHttpDownloader(url, destFile);
} else {
return new HttpDownloader(url, destFile);
}
return new HttpDownloader(url, destFile);
}
private static boolean isOnionAddress(String url) {

View File

@ -98,9 +98,8 @@ public class LocalHTTPD extends NanoHTTPD {
}
return handlePost(session);
} else {
return handleGet(session);
}
return handleGet(session);
}
private Response handlePost(IHTTPSession session) {
@ -110,11 +109,10 @@ public class LocalHTTPD extends NanoHTTPD {
if (!session.getParms().containsKey("repo")) {
Log.e(TAG, "Malformed /request-swap request to local repo HTTP server. Should have posted a 'repo' parameter." );
return new Response(Response.Status.BAD_REQUEST, MIME_PLAINTEXT, "Requires 'repo' parameter to be posted.");
} else {
}
requestSwap(session.getParms().get("repo"));
return new Response(Response.Status.OK, MIME_PLAINTEXT, "Swap request received.");
}
}
return new Response("");
}

View File

@ -162,7 +162,6 @@ public class MDnsHelper implements ServiceListener {
InetAddress[] addresses = serviceInfo.getInetAddresses();
if (addresses != null && addresses.length > 0)
return true;
else
return false;
}

View File

@ -41,9 +41,8 @@ abstract public class RepoUpdater {
public static RepoUpdater createUpdaterFor(Context ctx, Repo repo) {
if (repo.fingerprint == null && repo.pubkey == null) {
return new UnsignedRepoUpdater(ctx, repo);
} else {
return new SignedRepoUpdater(ctx, repo);
}
return new SignedRepoUpdater(ctx, repo);
}
protected final Context context;

View File

@ -129,11 +129,10 @@ abstract public class AppListFragment extends ThemeableListFragment implements
prefs.edit().putBoolean(TRIED_EMPTY_UPDATE, true).commit();
UpdateService.updateNow(getActivity());
return true;
} else {
}
Log.d(TAG, "Empty app list, but it looks like we've had an update previously. Will not force repo update.");
return false;
}
}
@Override
public void onDestroy() {

View File

@ -137,9 +137,8 @@ public class SwapActivity extends ActionBarActivity implements SwapProcessManage
if (Preferences.get().showNfcDuringSwap() && nfcMessageReady) {
showFragment(new NfcSwapFragment(), STATE_NFC);
return true;
} else {
return false;
}
return false;
}
private void showBluetooth() {