diff --git a/config/findbugs/include_filter.xml b/config/findbugs/include_filter.xml
index 08eade725..b4a14898c 100644
--- a/config/findbugs/include_filter.xml
+++ b/config/findbugs/include_filter.xml
@@ -2,5 +2,8 @@
+
+
+
diff --git a/k9mail-library/src/main/java/com/fsck/k9/mail/Multipart.java b/k9mail-library/src/main/java/com/fsck/k9/mail/Multipart.java
index 8bcba92b3..5f82e062d 100644
--- a/k9mail-library/src/main/java/com/fsck/k9/mail/Multipart.java
+++ b/k9mail-library/src/main/java/com/fsck/k9/mail/Multipart.java
@@ -15,8 +15,6 @@ public abstract class Multipart implements CompositeBody {
private final List mParts = new ArrayList();
- private String mContentType;
-
public void addBodyPart(BodyPart part) {
mParts.add(part);
part.setParent(this);
@@ -30,9 +28,7 @@ public abstract class Multipart implements CompositeBody {
return Collections.unmodifiableList(mParts);
}
- public String getContentType() {
- return mContentType;
- }
+ public abstract String getContentType();
public int getCount() {
return mParts.size();
diff --git a/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java b/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java
index 1709207ba..550fad50e 100644
--- a/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java
+++ b/k9mail-library/src/main/java/com/fsck/k9/mail/store/webdav/WebDavStore.java
@@ -1906,7 +1906,10 @@ public class WebDavStore extends RemoteStore {
@Override
public boolean equals(Object o) {
- return false;
+ if (o instanceof WebDavFolder) {
+ return ((WebDavFolder) o).mName.equals(mName);
+ }
+ return super.equals(o);
}
@Override
diff --git a/k9mail/src/main/java/com/fsck/k9/K9.java b/k9mail/src/main/java/com/fsck/k9/K9.java
index 3b43f39b9..7789e6608 100644
--- a/k9mail/src/main/java/com/fsck/k9/K9.java
+++ b/k9mail/src/main/java/com/fsck/k9/K9.java
@@ -149,7 +149,7 @@ public class K9 extends Application {
*
* Feature is enabled when DEBUG == true
*/
- public static String ERROR_FOLDER_NAME = "K9mail-errors";
+ public static final String ERROR_FOLDER_NAME = "K9mail-errors";
/**
* A reference to the {@link SharedPreferences} used for caching the last known database
@@ -280,7 +280,7 @@ public class K9 extends Application {
* on each new folder and can be incremented with "Load more messages..." by the
* VISIBLE_LIMIT_INCREMENT
*/
- public static int DEFAULT_VISIBLE_LIMIT = 25;
+ public static final int DEFAULT_VISIBLE_LIMIT = 25;
/**
* The maximum size of an attachment we're willing to download (either View or Save)
@@ -295,7 +295,7 @@ public class K9 extends Application {
* until the app is killed and restarted
*/
- public static int MAX_SEND_ATTEMPTS = 5;
+ public static final int MAX_SEND_ATTEMPTS = 5;
/**
* Max time (in millis) the wake lock will be held for when background sync is happening
diff --git a/k9mail/src/main/java/com/fsck/k9/activity/ChooseFolder.java b/k9mail/src/main/java/com/fsck/k9/activity/ChooseFolder.java
index 91430796d..08f25ac6f 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/ChooseFolder.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/ChooseFolder.java
@@ -9,7 +9,6 @@ import java.util.List;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
-import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
@@ -29,7 +28,7 @@ import com.fsck.k9.R;
import com.fsck.k9.controller.MessagingController;
import com.fsck.k9.controller.MessagingListener;
import com.fsck.k9.mail.Folder;
-import com.fsck.k9.mail.MessagingException;
+
public class ChooseFolder extends K9ListActivity {
public static final String EXTRA_ACCOUNT = "com.fsck.k9.ChooseFolder_account";
@@ -266,7 +265,6 @@ public class ChooseFolder extends K9ListActivity {
return;
}
Account.FolderMode aMode = mMode;
- Preferences prefs = Preferences.getPreferences(getApplication().getApplicationContext());
List newFolders = new ArrayList();
List topFolders = new ArrayList();
diff --git a/k9mail/src/main/java/com/fsck/k9/activity/FolderInfoHolder.java b/k9mail/src/main/java/com/fsck/k9/activity/FolderInfoHolder.java
index 67b3a87ad..6ee078111 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/FolderInfoHolder.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/FolderInfoHolder.java
@@ -20,7 +20,7 @@ public class FolderInfoHolder implements Comparable {
@Override
public boolean equals(Object o) {
- return this.name.equals(((FolderInfoHolder)o).name);
+ return o instanceof FolderInfoHolder && name.equals(((FolderInfoHolder) o).name);
}
@Override
diff --git a/k9mail/src/main/java/com/fsck/k9/activity/FolderList.java b/k9mail/src/main/java/com/fsck/k9/activity/FolderList.java
index ee135b532..15f4cc762 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/FolderList.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/FolderList.java
@@ -746,7 +746,6 @@ public class FolderList extends K9ListActivity {
List topFolders = new LinkedList();
Account.FolderMode aMode = account.getFolderDisplayMode();
- Preferences prefs = Preferences.getPreferences(getApplication().getApplicationContext());
for (Folder folder : folders) {
Folder.FolderClass fMode = folder.getDisplayClass();
diff --git a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java
index bc452f28c..0129b82e1 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/MessageCompose.java
@@ -2888,7 +2888,7 @@ public class MessageCompose extends K9Activity implements OnClickListener,
int cursorPosition = 0;
if (k9identity.containsKey(IdentityField.CURSOR_POSITION)) {
try {
- cursorPosition = Integer.valueOf(k9identity.get(IdentityField.CURSOR_POSITION)).intValue();
+ cursorPosition = Integer.parseInt(k9identity.get(IdentityField.CURSOR_POSITION));
} catch (Exception e) {
Log.e(K9.LOG_TAG, "Could not parse cursor position for MessageCompose; continuing.", e);
}
diff --git a/k9mail/src/main/java/com/fsck/k9/activity/misc/ContactPictureLoader.java b/k9mail/src/main/java/com/fsck/k9/activity/misc/ContactPictureLoader.java
index ffd06becc..f99aa8642 100644
--- a/k9mail/src/main/java/com/fsck/k9/activity/misc/ContactPictureLoader.java
+++ b/k9mail/src/main/java/com/fsck/k9/activity/misc/ContactPictureLoader.java
@@ -156,8 +156,8 @@ public class ContactPictureLoader {
}
int val = address.hashCode();
- int rgb = CONTACT_DUMMY_COLORS_ARGB[Math.abs(val) % CONTACT_DUMMY_COLORS_ARGB.length];
- return rgb;
+ int colorIndex = (val & Integer.MAX_VALUE) % CONTACT_DUMMY_COLORS_ARGB.length;
+ return CONTACT_DUMMY_COLORS_ARGB[colorIndex];
}
private String calcUnknownContactLetter(Address address) {
diff --git a/k9mail/src/main/java/com/fsck/k9/cache/EmailProviderCacheCursor.java b/k9mail/src/main/java/com/fsck/k9/cache/EmailProviderCacheCursor.java
index fdf75993a..55e4882fd 100644
--- a/k9mail/src/main/java/com/fsck/k9/cache/EmailProviderCacheCursor.java
+++ b/k9mail/src/main/java/com/fsck/k9/cache/EmailProviderCacheCursor.java
@@ -65,12 +65,12 @@ public class EmailProviderCacheCursor extends CursorWrapper {
String value = mCache.getValueForMessage(messageId, columnName);
if (value != null) {
- return Integer.valueOf(value);
+ return Integer.parseInt(value);
}
value = mCache.getValueForThread(threadRootId, columnName);
if (value != null) {
- return Integer.valueOf(value);
+ return Integer.parseInt(value);
}
return super.getInt(columnIndex);
diff --git a/k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java b/k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java
index fe80a607e..8d0dd8f20 100644
--- a/k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java
+++ b/k9mail/src/main/java/com/fsck/k9/controller/MessagingController.java
@@ -5267,7 +5267,6 @@ public class MessagingController implements Runnable {
if (previousPusher != null) {
previousPusher.stop();
}
- Preferences prefs = Preferences.getPreferences(context);
Account.FolderMode aDisplayMode = account.getFolderDisplayMode();
Account.FolderMode aPushMode = account.getFolderPushMode();
diff --git a/k9mail/src/main/java/com/fsck/k9/crypto/CryptoHelper.java b/k9mail/src/main/java/com/fsck/k9/crypto/CryptoHelper.java
index 612c4ba3d..f12b7c806 100644
--- a/k9mail/src/main/java/com/fsck/k9/crypto/CryptoHelper.java
+++ b/k9mail/src/main/java/com/fsck/k9/crypto/CryptoHelper.java
@@ -13,11 +13,11 @@ import com.fsck.k9.mail.internet.MimeUtility;
public class CryptoHelper {
- public static Pattern PGP_MESSAGE =
+ public static final Pattern PGP_MESSAGE =
Pattern.compile(".*?(-----BEGIN PGP MESSAGE-----.*?-----END PGP MESSAGE-----).*",
Pattern.DOTALL);
- public static Pattern PGP_SIGNED_MESSAGE =
+ public static final Pattern PGP_SIGNED_MESSAGE =
Pattern.compile(
".*?(-----BEGIN PGP SIGNED MESSAGE-----.*?-----BEGIN PGP SIGNATURE-----.*?-----END PGP SIGNATURE-----).*",
Pattern.DOTALL);
diff --git a/k9mail/src/main/java/com/fsck/k9/preferences/TimePickerPreference.java b/k9mail/src/main/java/com/fsck/k9/preferences/TimePickerPreference.java
index 2675292e8..24e418f7a 100644
--- a/k9mail/src/main/java/com/fsck/k9/preferences/TimePickerPreference.java
+++ b/k9mail/src/main/java/com/fsck/k9/preferences/TimePickerPreference.java
@@ -145,7 +145,7 @@ public class TimePickerPreference extends DialogPreference implements
return -1;
}
- return Integer.valueOf(time.split(":")[0]);
+ return Integer.parseInt(time.split(":")[0]);
}
/**
@@ -159,7 +159,7 @@ public class TimePickerPreference extends DialogPreference implements
return -1;
}
- return Integer.valueOf(time.split(":")[1]);
+ return Integer.parseInt(time.split(":")[1]);
}
/**
diff --git a/k9mail/src/main/java/com/fsck/k9/remotecontrol/K9RemoteControl.java b/k9mail/src/main/java/com/fsck/k9/remotecontrol/K9RemoteControl.java
index 279331988..754ba8e25 100644
--- a/k9mail/src/main/java/com/fsck/k9/remotecontrol/K9RemoteControl.java
+++ b/k9mail/src/main/java/com/fsck/k9/remotecontrol/K9RemoteControl.java
@@ -115,7 +115,7 @@ public class K9RemoteControl {
public final static String K9_THEME_LIGHT = "LIGHT";
public final static String K9_THEME_DARK = "DARK";
- protected static String LOG_TAG = "K9RemoteControl";
+ protected static final String LOG_TAG = "K9RemoteControl";
public static void set(Context context, Intent broadcastIntent) {
broadcastIntent.setAction(K9RemoteControl.K9_SET);
diff --git a/k9mail/src/main/java/com/fsck/k9/search/SearchSpecification.java b/k9mail/src/main/java/com/fsck/k9/search/SearchSpecification.java
index 7c70b832a..17c93b1be 100644
--- a/k9mail/src/main/java/com/fsck/k9/search/SearchSpecification.java
+++ b/k9mail/src/main/java/com/fsck/k9/search/SearchSpecification.java
@@ -138,6 +138,16 @@ public interface SearchSpecification extends Parcelable {
return false;
}
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = 31 * result + attribute.hashCode();
+ result = 31 * result + field.hashCode();
+ result = 31 * result + value.hashCode();
+
+ return result;
+ }
+
@Override
public int describeContents() {
return 0;
@@ -164,4 +174,4 @@ public interface SearchSpecification extends Parcelable {
}
};
}
-}
\ No newline at end of file
+}
diff --git a/k9mail/src/main/java/com/fsck/k9/service/BootReceiver.java b/k9mail/src/main/java/com/fsck/k9/service/BootReceiver.java
index 6ef20f1fe..dec7cb1ef 100644
--- a/k9mail/src/main/java/com/fsck/k9/service/BootReceiver.java
+++ b/k9mail/src/main/java/com/fsck/k9/service/BootReceiver.java
@@ -15,12 +15,12 @@ import com.fsck.k9.K9;
public class BootReceiver extends CoreReceiver {
- public static String FIRE_INTENT = "com.fsck.k9.service.BroadcastReceiver.fireIntent";
- public static String SCHEDULE_INTENT = "com.fsck.k9.service.BroadcastReceiver.scheduleIntent";
- public static String CANCEL_INTENT = "com.fsck.k9.service.BroadcastReceiver.cancelIntent";
+ public static final String FIRE_INTENT = "com.fsck.k9.service.BroadcastReceiver.fireIntent";
+ public static final String SCHEDULE_INTENT = "com.fsck.k9.service.BroadcastReceiver.scheduleIntent";
+ public static final String CANCEL_INTENT = "com.fsck.k9.service.BroadcastReceiver.cancelIntent";
- public static String ALARMED_INTENT = "com.fsck.k9.service.BroadcastReceiver.pendingIntent";
- public static String AT_TIME = "com.fsck.k9.service.BroadcastReceiver.atTime";
+ public static final String ALARMED_INTENT = "com.fsck.k9.service.BroadcastReceiver.pendingIntent";
+ public static final String AT_TIME = "com.fsck.k9.service.BroadcastReceiver.atTime";
@Override
public Integer receive(Context context, Intent intent, Integer tmpWakeLockId) {
diff --git a/k9mail/src/main/java/com/fsck/k9/service/CoreReceiver.java b/k9mail/src/main/java/com/fsck/k9/service/CoreReceiver.java
index ca949f82e..50b899f2f 100644
--- a/k9mail/src/main/java/com/fsck/k9/service/CoreReceiver.java
+++ b/k9mail/src/main/java/com/fsck/k9/service/CoreReceiver.java
@@ -16,9 +16,9 @@ import com.fsck.k9.mail.power.TracingPowerManager.TracingWakeLock;
public class CoreReceiver extends BroadcastReceiver {
- public static String WAKE_LOCK_RELEASE = "com.fsck.k9.service.CoreReceiver.wakeLockRelease";
+ public static final String WAKE_LOCK_RELEASE = "com.fsck.k9.service.CoreReceiver.wakeLockRelease";
- public static String WAKE_LOCK_ID = "com.fsck.k9.service.CoreReceiver.wakeLockId";
+ public static final String WAKE_LOCK_ID = "com.fsck.k9.service.CoreReceiver.wakeLockId";
private static ConcurrentHashMap wakeLocks = new ConcurrentHashMap();
private static AtomicInteger wakeLockSeq = new AtomicInteger(0);
diff --git a/k9mail/src/main/java/com/fsck/k9/service/CoreService.java b/k9mail/src/main/java/com/fsck/k9/service/CoreService.java
index 2696b55df..0ed8a496c 100644
--- a/k9mail/src/main/java/com/fsck/k9/service/CoreService.java
+++ b/k9mail/src/main/java/com/fsck/k9/service/CoreService.java
@@ -57,7 +57,7 @@ import com.fsck.k9.mail.power.TracingPowerManager.TracingWakeLock;
*/
public abstract class CoreService extends Service {
- public static String WAKE_LOCK_ID = "com.fsck.k9.service.CoreService.wakeLockId";
+ public static final String WAKE_LOCK_ID = "com.fsck.k9.service.CoreService.wakeLockId";
private static ConcurrentHashMap sWakeLocks =
new ConcurrentHashMap();