aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorBananeweizen <Bananeweizen@gmx.de>2014-01-01 14:08:11 +0100
committerBananeweizen <Bananeweizen@gmx.de>2014-01-01 14:08:11 +0100
commit9bed9f046731e71f4ef79502ceec46f9502b4de2 (patch)
tree720a3d7653596bc48fb817cbc8bcbef7029af51c /main/src
parent08fde3648e575a7eead15bd830b4936451275e14 (diff)
downloadcgeo-9bed9f046731e71f4ef79502ceec46f9502b4de2.zip
cgeo-9bed9f046731e71f4ef79502ceec46f9502b4de2.tar.gz
cgeo-9bed9f046731e71f4ef79502ceec46f9502b4de2.tar.bz2
refactoring: remove bad default case statements
For methods returning directly from the switch case, at least Eclipse still needs a useless return value outside of the switch statement. This has been handled by IllegalStateExceptions after the switch.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/AboutActivity.java3
-rw-r--r--main/src/cgeo/geocaching/CacheDetailActivity.java3
-rw-r--r--main/src/cgeo/geocaching/CacheListActivity.java2
-rw-r--r--main/src/cgeo/geocaching/TrackableActivity.java3
-rw-r--r--main/src/cgeo/geocaching/geopoint/GeopointFormatter.java3
-rw-r--r--main/src/cgeo/geocaching/ui/LoggingUI.java2
-rw-r--r--main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java5
7 files changed, 5 insertions, 16 deletions
diff --git a/main/src/cgeo/geocaching/AboutActivity.java b/main/src/cgeo/geocaching/AboutActivity.java
index b9f198a..b47091b 100644
--- a/main/src/cgeo/geocaching/AboutActivity.java
+++ b/main/src/cgeo/geocaching/AboutActivity.java
@@ -179,9 +179,8 @@ public class AboutActivity extends AbstractViewPagerActivity<AboutActivity.Page>
return new ContributorsViewCreator();
case LICENSE:
return new LicenseViewCreator();
- default:
- throw new IllegalArgumentException();
}
+ throw new IllegalStateException(); // cannot happen, when switch case is enum complete
}
@Override
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java
index 079562e..4b0fc93 100644
--- a/main/src/cgeo/geocaching/CacheDetailActivity.java
+++ b/main/src/cgeo/geocaching/CacheDetailActivity.java
@@ -2206,9 +2206,8 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc
case IMAGES:
return new ImagesViewCreator();
- default:
- throw new IllegalArgumentException();
}
+ throw new IllegalStateException(); // cannot happen as long as switch case is enum complete
}
static void updateOfflineBox(final View view, final Geocache cache, final Resources res,
diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java
index be9b59c..3d2ad0c 100644
--- a/main/src/cgeo/geocaching/CacheListActivity.java
+++ b/main/src/cgeo/geocaching/CacheListActivity.java
@@ -1632,8 +1632,6 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
title = pocket_name;
loader = new PocketGeocacheListLoader(app, guid);
break;
- default:
- throw new IllegalStateException();
}
setTitle(title);
showProgress(true);
diff --git a/main/src/cgeo/geocaching/TrackableActivity.java b/main/src/cgeo/geocaching/TrackableActivity.java
index 6752344..973f8c2 100644
--- a/main/src/cgeo/geocaching/TrackableActivity.java
+++ b/main/src/cgeo/geocaching/TrackableActivity.java
@@ -316,9 +316,8 @@ public class TrackableActivity extends AbstractViewPagerActivity<TrackableActivi
return new DetailsViewCreator();
case LOGS:
return new TrackableLogsViewCreator(this, trackable);
- default:
- throw new IllegalArgumentException();
}
+ throw new IllegalStateException(); // cannot happen as long as switch case is enum complete
}
@Override
diff --git a/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java b/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java
index 67f5ebb..a6965f9 100644
--- a/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java
+++ b/main/src/cgeo/geocaching/geopoint/GeopointFormatter.java
@@ -109,9 +109,8 @@ public class GeopointFormatter {
return String.format(Locale.getDefault(), "%c %03d %06.3f", rgp.getLonDir(), rgp.getLonDeg(), rgp.getLonMinRaw());
}
- default:
- throw new IllegalArgumentException();
}
+ throw new IllegalStateException(); // cannot happen, if switch case is enum complete
}
}
diff --git a/main/src/cgeo/geocaching/ui/LoggingUI.java b/main/src/cgeo/geocaching/ui/LoggingUI.java
index 30c719e..1423da2 100644
--- a/main/src/cgeo/geocaching/ui/LoggingUI.java
+++ b/main/src/cgeo/geocaching/ui/LoggingUI.java
@@ -105,8 +105,6 @@ public class LoggingUI extends AbstractUIFactory {
case CLEAR_LOG:
cache.clearOfflineLog();
break;
- default:
- throw new IllegalStateException();
}
} else {
cache.logOffline(activity, logTypeEntry.logType);
diff --git a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java
index ea7554d..e00993f 100644
--- a/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java
+++ b/main/src/cgeo/geocaching/ui/dialog/CoordinatesInputDialog.java
@@ -216,9 +216,8 @@ public class CoordinatesInputDialog extends NoTitleDialog {
eLonSec.setText(addZeros(gp.getLonSec(), 2));
eLonSub.setText(addZeros(gp.getLonSecFrac(), 3));
break;
- default:
- throw new IllegalStateException();
}
+ throw new IllegalStateException(); // cannot happen if switch case is enum complete
}
private static String addZeros(final int value, final int len) {
@@ -361,8 +360,6 @@ public class CoordinatesInputDialog extends NoTitleDialog {
break;
case Plain:
// This case has been handled above
- default:
- throw new IllegalArgumentException();
}
} catch (final Geopoint.ParseException e) {
if (signalError) {