diff options
author | Andrew Gaul <andrew@gaul.org> | 2013-07-13 18:44:37 -0700 |
---|---|---|
committer | Andrew Gaul <andrew@gaul.org> | 2013-07-14 22:13:49 -0700 |
commit | b1cdfe20416dc78349dc78b279f718076e07643c (patch) | |
tree | 5d28c589a1c3cb8f5685fa4439ad2b1d72a4ecb4 /src/de/danoeh/antennapod/activity | |
parent | 941fa9062e2ac1709e8c99208e2f63226fe2c7a8 (diff) | |
download | AntennaPod-b1cdfe20416dc78349dc78b279f718076e07643c.zip |
Address FindBugs warnings
This commit fixes 36 of the 109 warnings.
Diffstat (limited to 'src/de/danoeh/antennapod/activity')
6 files changed, 26 insertions, 10 deletions
diff --git a/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java b/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java index 54c4f0589..4e7aafb4c 100644 --- a/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java +++ b/src/de/danoeh/antennapod/activity/DirectoryChooserActivity.java @@ -348,7 +348,9 @@ public class DirectoryChooserActivity extends SherlockActivity { * CREATE_DIRECTORY_NAME. */ private int createFolder() { - if (selectedDir != null && selectedDir.canWrite()) { + if (selectedDir == null) { + return R.string.create_folder_error; + } else if (selectedDir.canWrite()) { File newDir = new File(selectedDir, CREATE_DIRECTORY_NAME); if (!newDir.exists()) { boolean result = newDir.mkdir(); @@ -360,10 +362,8 @@ public class DirectoryChooserActivity extends SherlockActivity { } else { return R.string.create_folder_error_already_exists; } - } else if (selectedDir.canWrite() == false) { - return R.string.create_folder_error_no_write_access; } else { - return R.string.create_folder_error; + return R.string.create_folder_error_no_write_access; } } diff --git a/src/de/danoeh/antennapod/activity/DownloadActivity.java b/src/de/danoeh/antennapod/activity/DownloadActivity.java index 10ebb1285..8dc04f929 100644 --- a/src/de/danoeh/antennapod/activity/DownloadActivity.java +++ b/src/de/danoeh/antennapod/activity/DownloadActivity.java @@ -113,7 +113,7 @@ public class DownloadActivity extends SherlockListActivity implements contentRefresher.cancel(true); } contentRefresher = new AsyncTask<Void, Void, Void>() { - private final int WAITING_INTERVALL = 1000; + private final static int WAITING_INTERVALL = 1000; @Override protected void onProgressUpdate(Void... values) { diff --git a/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java b/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java index bb50944cc..363faab3d 100644 --- a/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java +++ b/src/de/danoeh/antennapod/activity/MiroGuideCategoryActivity.java @@ -24,7 +24,7 @@ import de.danoeh.antennapod.preferences.UserPreferences; public class MiroGuideCategoryActivity extends SherlockFragmentActivity { private static final String TAG = "MiroGuideCategoryActivity"; - public static String EXTRA_CATEGORY = "category"; + public static final String EXTRA_CATEGORY = "category"; private ViewPager viewpager; private CategoryPagerAdapter pagerAdapter; diff --git a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java index 612c45e64..c1176ce1b 100644 --- a/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java +++ b/src/de/danoeh/antennapod/activity/OnlineFeedViewActivity.java @@ -154,7 +154,7 @@ public abstract class OnlineFeedViewActivity extends SherlockFragmentActivity { @Override public void run() { - String reasonDetailed = new String(); + String reasonDetailed = ""; boolean successful = false; FeedHandler handler = new FeedHandler(); try { diff --git a/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java index dc698a851..58e3a96dd 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java +++ b/src/de/danoeh/antennapod/activity/OpmlImportFromIntentActivity.java @@ -7,6 +7,7 @@ import java.net.URL; import android.app.AlertDialog; import android.os.Bundle; import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.util.LangUtils; /** Lets the user start the OPML-import process. */ public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity { @@ -20,7 +21,8 @@ public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity { try { URL mOpmlURL = new URL(getIntent().getData().toString()); - BufferedReader in = new BufferedReader(new InputStreamReader(mOpmlURL.openStream())); + BufferedReader in = new BufferedReader(new InputStreamReader(mOpmlURL.openStream(), + LangUtils.UTF_8)); startImport(in); } catch (Exception e) { new AlertDialog.Builder(this).setMessage("Cannot open XML - Reason: " + e.getMessage()).show(); diff --git a/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java b/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java index b38e0c443..5620f9330 100644 --- a/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java +++ b/src/de/danoeh/antennapod/activity/OpmlImportFromPathActivity.java @@ -1,8 +1,10 @@ package de.danoeh.antennapod.activity; import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; -import java.io.FileReader; +import java.io.InputStreamReader; +import java.io.IOException; import java.io.Reader; import android.app.AlertDialog; @@ -21,6 +23,7 @@ import com.actionbarsherlock.view.MenuItem; import de.danoeh.antennapod.AppConfig; import de.danoeh.antennapod.R; import de.danoeh.antennapod.preferences.UserPreferences; +import de.danoeh.antennapod.util.LangUtils; import de.danoeh.antennapod.util.StorageUtils; /** @@ -126,13 +129,24 @@ public class OpmlImportFromPathActivity extends OpmlImportBaseActivity { } private void startImport(File file) { + Reader mReader = null; try { - Reader mReader = new FileReader(file); + mReader = new InputStreamReader(new FileInputStream(file), + LangUtils.UTF_8); if (AppConfig.DEBUG) Log.d(TAG, "Parsing " + file.toString()); startImport(mReader); } catch (FileNotFoundException e) { Log.d(TAG, "File not found which really should be there"); // this should never happen as it is a file we have just chosen + } finally { + if (mReader != null) { + try { + mReader.close(); + } catch (IOException ioe) { + Log.w(TAG, "IOException while importing OPML: " + + ioe.getMessage()); + } + } } } |