diff options
author | ByteHamster <ByteHamster@users.noreply.github.com> | 2024-03-06 17:46:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-06 17:46:05 +0100 |
commit | 68ec4e2527bd495bd35386d102325308a5f36d85 (patch) | |
tree | ca7697214e5d199cf8aac1448032b8e6cf6ba847 /core | |
parent | 5e8960f4bcf1bfa98f1fe8adc824cbf6a5a5fbc4 (diff) | |
parent | 522288260cc613f400488168b9ca27f29da42ebd (diff) | |
download | AntennaPod-68ec4e2527bd495bd35386d102325308a5f36d85.zip |
Merge pull request #6958 from TacoTheDank/bumpSpotBugs
Update and fix SpotBugs
Diffstat (limited to 'core')
3 files changed, 52 insertions, 19 deletions
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 79c6dd6bc..2058d5b2f 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 @@ -90,17 +90,18 @@ public class OpmlBackupAgent extends BackupAgentHelper { // Get the old checksum if (oldState != null) { - FileInputStream inState = new FileInputStream(oldState.getFileDescriptor()); - int len = inState.read(); - - if (len != -1) { - byte[] oldChecksum = new byte[len]; - IOUtils.read(inState, oldChecksum, 0, len); - Log.d(TAG, "Old checksum: " + new BigInteger(1, oldChecksum).toString(16)); - - if (Arrays.equals(oldChecksum, newChecksum)) { - Log.d(TAG, "Checksums are the same; won't backup"); - return; + try (final FileInputStream inState = new FileInputStream(oldState.getFileDescriptor())) { + int len = inState.read(); + + if (len != -1) { + byte[] oldChecksum = new byte[len]; + IOUtils.read(inState, oldChecksum, 0, len); + Log.d(TAG, "Old checksum: " + new BigInteger(1, oldChecksum).toString(16)); + + if (Arrays.equals(oldChecksum, newChecksum)) { + Log.d(TAG, "Checksums are the same; won't backup"); + return; + } } } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index 492dff759..b390f5f44 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -736,9 +736,33 @@ public final class DBReader { } public static class MonthlyStatisticsItem { - public int year = 0; - public int month = 0; - public long timePlayed = 0; + private int year = 0; + private int month = 0; + private long timePlayed = 0; + + public int getYear() { + return year; + } + + public void setYear(final int year) { + this.year = year; + } + + public int getMonth() { + return month; + } + + public void setMonth(final int month) { + this.month = month; + } + + public long getTimePlayed() { + return timePlayed; + } + + public void setTimePlayed(final long timePlayed) { + this.timePlayed = timePlayed; + } } @NonNull @@ -752,9 +776,9 @@ public final class DBReader { int indexTotalDuration = cursor.getColumnIndexOrThrow("total_duration"); while (cursor.moveToNext()) { MonthlyStatisticsItem item = new MonthlyStatisticsItem(); - item.month = Integer.parseInt(cursor.getString(indexMonth)); - item.year = Integer.parseInt(cursor.getString(indexYear)); - item.timePlayed = cursor.getLong(indexTotalDuration); + item.setMonth(Integer.parseInt(cursor.getString(indexMonth))); + item.setYear(Integer.parseInt(cursor.getString(indexYear))); + item.setTimePlayed(cursor.getLong(indexTotalDuration)); months.add(item); } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java b/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java index af02a7733..024c5d357 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/NavDrawerData.java @@ -57,8 +57,8 @@ public class NavDrawerData { public static class TagDrawerItem extends DrawerItem { public final List<DrawerItem> children = new ArrayList<>(); - public final String name; - public boolean isOpen; + private final String name; + private boolean isOpen; public TagDrawerItem(String name) { // Keep IDs >0 but make room for many feeds @@ -70,6 +70,14 @@ public class NavDrawerData { return name; } + public boolean isOpen() { + return isOpen; + } + + public void setOpen(final boolean open) { + isOpen = open; + } + public int getCounter() { int sum = 0; for (DrawerItem item : children) { |