From bfd11c444f945e96f80cef1e4046a439141761fa Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Mon, 31 Oct 2011 21:42:12 -0700 Subject: [PATCH] Prefer entrySet over keySet and get Addresses FindBugs complaints. --- .../fsck/k9/controller/MessagingController.java | 6 ++++-- src/com/fsck/k9/mail/store/WebDavStore.java | 16 +++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index 8b188c298..6cd048556 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -3276,9 +3276,11 @@ public class MessagingController implements Runnable { localSrcFolder.copyMessages(messages, localDestFolder); } else { localSrcFolder.moveMessages(messages, localDestFolder); - for (String origUid : origUidMap.keySet()) { + for (Map.Entry entry : origUidMap.entrySet()) { + String origUid = entry.getKey(); + Message message = entry.getValue(); for (MessagingListener l : getListeners()) { - l.messageUidChanged(account, srcFolder, origUid, origUidMap.get(origUid).getUid()); + l.messageUidChanged(account, srcFolder, origUid, message.getUid()); } unsuppressMessage(account, srcFolder, origUid); } diff --git a/src/com/fsck/k9/mail/store/WebDavStore.java b/src/com/fsck/k9/mail/store/WebDavStore.java index 0f17657f1..f767997fb 100644 --- a/src/com/fsck/k9/mail/store/WebDavStore.java +++ b/src/com/fsck/k9/mail/store/WebDavStore.java @@ -51,6 +51,7 @@ import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Stack; import java.util.zip.GZIPInputStream; @@ -944,8 +945,8 @@ public class WebDavStore extends Store { } if (headers != null) { - for (String headerName : headers.keySet()) { - httpmethod.setHeader(headerName, headers.get(headerName)); + for (Map.Entry entry : headers.entrySet()) { + httpmethod.setHeader(entry.getKey(), entry.getValue()); } } @@ -2207,10 +2208,11 @@ public class WebDavStore extends Store { HashMap data = mData.get(uid); if (data != null) { - for (String header : data.keySet()) { + for (Map.Entry entry : data.entrySet()) { + String header = entry.getKey(); if (header.equals("read")) { - String read = data.get(header); - Boolean readStatus = !read.equals("0"); + String read = entry.getValue(); + boolean readStatus = !read.equals("0"); envelope.setReadStatus(readStatus); } else if (header.equals("date")) { @@ -2219,7 +2221,7 @@ public class WebDavStore extends Store { * yyyy-MM-dd'T'HH:mm:ss.SSS */ - String date = data.get(header); + String date = entry.getValue(); date = date.substring(0, date.length() - 1); DateFormat dfInput = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS", Locale.US); @@ -2234,7 +2236,7 @@ public class WebDavStore extends Store { } envelope.addHeader(header, tempDate); } else { - envelope.addHeader(header, data.get(header)); + envelope.addHeader(header, entry.getValue()); } } }