From 3652910d49777fa5b2303acce347255d56842044 Mon Sep 17 00:00:00 2001 From: Michael Keppler Date: Mon, 23 Dec 2013 17:43:57 +0100 Subject: fix some findbugs findings --- main/src/cgeo/geocaching/Geocache.java | 4 ++-- main/src/cgeo/geocaching/connector/trackable/GeokretyParser.java | 6 +++--- main/src/cgeo/geocaching/settings/SettingsActivity.java | 2 +- main/src/cgeo/geocaching/ui/AddressListAdapter.java | 5 ++--- 4 files changed, 8 insertions(+), 9 deletions(-) (limited to 'main') diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 241f180..6262792 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -1722,10 +1722,10 @@ public class Geocache implements ICache, IWaypoint { final MatcherWrapper matcher = new MatcherWrapper(pattern, getDescription()); while (matcher.find()) { try { - final int hours = Integer.valueOf(matcher.group(1)); + final int hours = Integer.parseInt(matcher.group(1)); int minutes = 0; if (matcher.groupCount() >= 2) { - minutes = Integer.valueOf(matcher.group(2)); + minutes = Integer.parseInt(matcher.group(2)); } if (hours >= 0 && hours < 24 && minutes >= 0 && minutes < 60) { return String.valueOf(hours * 60 + minutes); diff --git a/main/src/cgeo/geocaching/connector/trackable/GeokretyParser.java b/main/src/cgeo/geocaching/connector/trackable/GeokretyParser.java index 67180b3..9cb5dc5 100644 --- a/main/src/cgeo/geocaching/connector/trackable/GeokretyParser.java +++ b/main/src/cgeo/geocaching/connector/trackable/GeokretyParser.java @@ -37,15 +37,15 @@ public class GeokretyParser { try { final int indexId = attributes.getIndex("id"); if (indexId > -1) { - trackable.setGeocode(geocode(Integer.valueOf(attributes.getValue("id")))); + trackable.setGeocode(geocode(Integer.parseInt(attributes.getValue("id")))); } final int indexDist = attributes.getIndex("dist"); if (indexDist > -1) { - trackable.setDistance(Float.valueOf(attributes.getValue("dist"))); + trackable.setDistance(Float.parseFloat(attributes.getValue("dist"))); } final int indexType = attributes.getIndex("type"); if (indexType > -1) { - trackable.setType(getType(Integer.valueOf(attributes.getValue("type")))); + trackable.setType(getType(Integer.parseInt(attributes.getValue("type")))); } final int indexWaypoint = attributes.getIndex("waypoint"); if (indexWaypoint > -1) { diff --git a/main/src/cgeo/geocaching/settings/SettingsActivity.java b/main/src/cgeo/geocaching/settings/SettingsActivity.java index 2cb9547..cd9296e 100644 --- a/main/src/cgeo/geocaching/settings/SettingsActivity.java +++ b/main/src/cgeo/geocaching/settings/SettingsActivity.java @@ -473,7 +473,7 @@ public class SettingsActivity extends PreferenceActivity { // reset the cached map source MapSource mapSource; try { - final int mapSourceId = Integer.valueOf(stringValue); + final int mapSourceId = Integer.parseInt(stringValue); mapSource = MapProviderFactory.getMapSource(mapSourceId); } catch (final NumberFormatException e) { Log.e("SettingsActivity.onPreferenceChange: bad source id '" + stringValue + "'"); diff --git a/main/src/cgeo/geocaching/ui/AddressListAdapter.java b/main/src/cgeo/geocaching/ui/AddressListAdapter.java index 0d5fba7..8134235 100644 --- a/main/src/cgeo/geocaching/ui/AddressListAdapter.java +++ b/main/src/cgeo/geocaching/ui/AddressListAdapter.java @@ -11,7 +11,6 @@ import cgeo.geocaching.geopoint.Units; import org.apache.commons.lang3.StringUtils; import android.app.Activity; -import android.content.Context; import android.location.Address; import android.view.LayoutInflater; import android.view.View; @@ -35,9 +34,9 @@ public class AddressListAdapter extends ArrayAdapter
{ } } - public AddressListAdapter(final Context context) { + public AddressListAdapter(final Activity context) { super(context, 0); - inflater = ((Activity) context).getLayoutInflater(); + inflater = context.getLayoutInflater(); location = CgeoApplication.getInstance().currentGeo().getCoords(); } -- cgit v1.1