From 9c01712276658728278f9ce965522855d6b74309 Mon Sep 17 00:00:00 2001 From: ByteHamster Date: Sat, 15 Jan 2022 12:57:23 +0100 Subject: [PATCH] Move more checkstyle checks from 'new code' style to main style --- .../java/de/danoeh/antennapod/fragment/SearchFragment.java | 1 + .../danoeh/antennapod/menuhandler/FeedItemMenuHandler.java | 2 +- config/checkstyle/checkstyle.xml | 7 +++++++ config/checkstyle/suppressions.xml | 5 +++++ .../de/danoeh/antennapod/core/backup/OpmlBackupAgent.java | 7 +------ .../de/danoeh/antennapod/core/export/CommonSymbols.java | 1 + .../antennapod/core/service/download/HttpDownloader.java | 1 + .../danoeh/antennapod/core/service/playback/LocalPSMP.java | 4 +++- core/src/test/java/android/util/Log.java | 1 + 9 files changed, 21 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java b/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java index e43b6f314..6526be005 100644 --- a/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java +++ b/app/src/main/java/de/danoeh/antennapod/fragment/SearchFragment.java @@ -73,6 +73,7 @@ public class SearchFragment extends Fragment { private SearchView searchView; private Handler automaticSearchDebouncer; private long lastQueryChange = 0; + /** * Create a new SearchFragment that searches all feeds. */ diff --git a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java index 23fdb86de..d9558d20f 100644 --- a/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java +++ b/app/src/main/java/de/danoeh/antennapod/menuhandler/FeedItemMenuHandler.java @@ -120,7 +120,7 @@ public class FeedItemMenuHandler { * @return true if selectedItem is not null. */ public static boolean onPrepareMenu(Menu menu, FeedItem selectedItem, int... excludeIds) { - if (menu == null || selectedItem == null ) { + if (menu == null || selectedItem == null) { return false; } boolean rc = onPrepareMenu(menu, selectedItem); diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index e23962381..8e82dd5e2 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -45,6 +45,9 @@ + + + @@ -123,6 +126,7 @@ value="COMMA, SEMI, POST_INC, POST_DEC, DOT, ELLIPSIS, METHOD_REF"/> + + + + diff --git a/config/checkstyle/suppressions.xml b/config/checkstyle/suppressions.xml index 8ca46df67..612d582bd 100644 --- a/config/checkstyle/suppressions.xml +++ b/config/checkstyle/suppressions.xml @@ -4,4 +4,9 @@ "http://www.puppycrawl.com/dtds/suppressions_1_1.dtd"> + + + + + diff --git a/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java b/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java index a7337f288..37849c296 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java +++ b/core/src/main/java/de/danoeh/antennapod/core/backup/OpmlBackupAgent.java @@ -115,12 +115,7 @@ public class OpmlBackupAgent extends BackupAgentHelper { } catch (IOException e) { Log.e(TAG, "Error during backup", e); } finally { - if (writer != null) { - try { - writer.close(); - } catch (IOException e) { - } - } + IOUtils.closeQuietly(writer); } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/export/CommonSymbols.java b/core/src/main/java/de/danoeh/antennapod/core/export/CommonSymbols.java index 3ed251047..2ce340328 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/export/CommonSymbols.java +++ b/core/src/main/java/de/danoeh/antennapod/core/export/CommonSymbols.java @@ -11,6 +11,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package de.danoeh.antennapod.core.export; public class CommonSymbols { diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java index cbfb2cede..698278af9 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/download/HttpDownloader.java @@ -160,6 +160,7 @@ public class HttpDownloader extends Downloader { try { contentLength = Integer.parseInt(contentLen); } catch (NumberFormatException e) { + e.printStackTrace(); } } Log.d(TAG, "content length: " + contentLength); diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java index 34fc7d699..0daa6b483 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java @@ -725,7 +725,9 @@ public class LocalPSMP extends PlaybackServiceMediaPlayer { if (mediaPlayer.isPlaying()) { mediaPlayer.stop(); } - } catch (Exception ignore) { } + } catch (Exception e) { + e.printStackTrace(); + } mediaPlayer.release(); mediaPlayer = null; } diff --git a/core/src/test/java/android/util/Log.java b/core/src/test/java/android/util/Log.java index 881d10209..a65bc80fa 100644 --- a/core/src/test/java/android/util/Log.java +++ b/core/src/test/java/android/util/Log.java @@ -215,6 +215,7 @@ public final class Log { * Added for this custom Log implementation, not in android sources. */ private static final int WTF = 8; + static int wtf(int logId, String tag, String msg, Throwable tr, boolean localStack, boolean system) { return printlns(LOG_ID_MAIN, WTF, tag, msg, tr);