diff --git a/src/com/fsck/k9/Account.java b/src/com/fsck/k9/Account.java index d79e6a238..1db3ed3f3 100644 --- a/src/com/fsck/k9/Account.java +++ b/src/com/fsck/k9/Account.java @@ -175,7 +175,7 @@ public class Account implements BaseAccount mIdleRefreshMinutes = preferences.getPreferences().getInt(mUuid + ".idleRefreshMinutes", 24); mSaveAllHeaders = preferences.getPreferences().getBoolean(mUuid - + ".saveAllHeaders", false); + + ".saveAllHeaders", false); mPushPollOnConnect = preferences.getPreferences().getBoolean(mUuid + ".pushPollOnConnect", true); mDisplayCount = preferences.getPreferences().getInt(mUuid + ".displayCount", -1); diff --git a/src/com/fsck/k9/activity/FolderList.java b/src/com/fsck/k9/activity/FolderList.java index e9285fed3..d314fc24e 100644 --- a/src/com/fsck/k9/activity/FolderList.java +++ b/src/com/fsck/k9/activity/FolderList.java @@ -360,9 +360,9 @@ public class FolderList extends K9ListActivity // This will be called either automatically for you on 2.0 // or later, or by the code above on earlier versions of the // platform. - if (K9.manageBack() ) + if (K9.manageBack()) { - onAccounts(); + onAccounts(); } } @@ -376,7 +376,7 @@ public class FolderList extends K9ListActivity keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 - && K9.manageBack() ) + && K9.manageBack()) { // Take care of calling this method on earlier versions of // the platform where it doesn't exist. diff --git a/src/com/fsck/k9/activity/MessageCompose.java b/src/com/fsck/k9/activity/MessageCompose.java index 63dcc3189..ba32bbaed 100644 --- a/src/com/fsck/k9/activity/MessageCompose.java +++ b/src/com/fsck/k9/activity/MessageCompose.java @@ -396,8 +396,8 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc } //TODO: Use constant Intent.ACTION_SEND_MULTIPLE once we drop Android 1.5 support else if (Intent.ACTION_SEND.equals(action) - || Intent.ACTION_SENDTO.equals(action) - || "android.intent.action.SEND_MULTIPLE".equals(action)) + || Intent.ACTION_SENDTO.equals(action) + || "android.intent.action.SEND_MULTIPLE".equals(action)) { /* * Someone is trying to compose an email with an attachment, probably Pictures. diff --git a/src/com/fsck/k9/activity/MessageList.java b/src/com/fsck/k9/activity/MessageList.java index 7ae51c4b2..02316b163 100644 --- a/src/com/fsck/k9/activity/MessageList.java +++ b/src/com/fsck/k9/activity/MessageList.java @@ -580,10 +580,12 @@ public class MessageList // This will be called either automatically for you on 2.0 // or later, or by the code above on earlier versions of the // platform. - if (K9.manageBack()) + if (K9.manageBack()) { onShowFolderList(); - } else { + } + else + { finish(); } } @@ -596,8 +598,8 @@ public class MessageList // XXX TODO - when we go to android 2.0, uncomment this // android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR && keyCode == KeyEvent.KEYCODE_BACK - && event.getRepeatCount() == 0 - ) + && event.getRepeatCount() == 0 + ) { // Take care of calling this method on earlier versions of // the platform where it doesn't exist. diff --git a/src/com/fsck/k9/activity/MessageView.java b/src/com/fsck/k9/activity/MessageView.java index d0ead6d9b..55ffa0e38 100644 --- a/src/com/fsck/k9/activity/MessageView.java +++ b/src/com/fsck/k9/activity/MessageView.java @@ -100,7 +100,7 @@ public class MessageView extends K9Activity implements OnClickListener private FontSizes mFontSizes = K9.getFontSizes(); - /** + /** * Pair class is only available since API Level 5, so we need * this helper class unfortunately */ @@ -108,7 +108,7 @@ public class MessageView extends K9Activity implements OnClickListener { public String label; public String value; - + public HeaderEntry(String label, String value) { this.label = label; @@ -438,8 +438,8 @@ public class MessageView extends K9Activity implements OnClickListener */ public void hideAdditionalHeaders() { - runOnUiThread(new Runnable() - { + runOnUiThread(new Runnable() + { public void run() { mAdditionalHeadersView.setVisibility(View.GONE); @@ -459,19 +459,19 @@ public class MessageView extends K9Activity implements OnClickListener { runOnUiThread(new Runnable() { - public void run() + public void run() { Integer messageToShow = null; try { // Retrieve additional headers boolean allHeadersDownloaded = mMessage.isSet(Flag.X_GOT_ALL_HEADERS); - List additionalHeaders = getAdditionalHeaders(mMessage); + List additionalHeaders = getAdditionalHeaders(mMessage); if (!additionalHeaders.isEmpty()) { // Show the additional headers that we have got. - setupAdditionalHeadersView(additionalHeaders); + setupAdditionalHeadersView(additionalHeaders); mAdditionalHeadersView.setVisibility(View.VISIBLE); } @@ -483,7 +483,7 @@ public class MessageView extends K9Activity implements OnClickListener * NOTE: This is only a temporary solution... in fact, * the system should download headers on-demand when they * have not been saved in their entirety initially. - */ + */ messageToShow = R.string.message_additional_headers_not_downloaded; } else if (additionalHeaders.isEmpty()) @@ -492,7 +492,7 @@ public class MessageView extends K9Activity implements OnClickListener messageToShow = R.string.message_no_additional_headers_available; } } - catch(MessagingException e) + catch (MessagingException e) { messageToShow = R.string.message_additional_headers_retrieval_failed; } @@ -503,19 +503,19 @@ public class MessageView extends K9Activity implements OnClickListener Toast toast = Toast.makeText(MessageView.this, messageToShow, Toast.LENGTH_LONG); toast.setGravity(Gravity.CENTER_VERTICAL | Gravity.CENTER_HORIZONTAL, 0, 0); toast.show(); - } - } + } + } }); } /** * Set up the additional headers text view with the supplied header data. - * + * * @param additionalHeaders - * List of header entries. Each entry consists of a header - * name and a header value. Header names may appear multiple + * List of header entries. Each entry consists of a header + * name and a header value. Header names may appear multiple * times. - * + * * This method is always called from within the UI thread by * {@link #showAdditionalHeaders()}. */ @@ -639,7 +639,7 @@ public class MessageView extends K9Activity implements OnClickListener mTimeView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewTime()); mDateView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewDate()); mAdditionalHeadersView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, mFontSizes.getMessageViewAdditionalHeaders()); - mAdditionalHeadersView.setVisibility(View.GONE); + mAdditionalHeadersView.setVisibility(View.GONE); mAttachments.setVisibility(View.GONE); mAttachmentIcon.setVisibility(View.GONE); @@ -1031,8 +1031,8 @@ public class MessageView extends K9Activity implements OnClickListener } private List getAdditionalHeaders(final Message message) - throws MessagingException - { + throws MessagingException + { List additionalHeaders = new LinkedList(); // Do not include the following headers, since they are always visible anyway @@ -1277,8 +1277,8 @@ public class MessageView extends K9Activity implements OnClickListener onShowPictures(); break; case R.id.header_container: - onShowAdditionalHeaders(); - break; + onShowAdditionalHeaders(); + break; } } @@ -1363,7 +1363,7 @@ public class MessageView extends K9Activity implements OnClickListener if (additionalHeadersItem != null) { additionalHeadersItem.setTitle((mAdditionalHeadersView.getVisibility() == View.VISIBLE) ? - R.string.hide_full_header_action : R.string.show_full_header_action); + R.string.hide_full_header_action : R.string.show_full_header_action); } } } diff --git a/src/com/fsck/k9/activity/setup/AccountSettings.java b/src/com/fsck/k9/activity/setup/AccountSettings.java index 1e6d6d42e..f3a37c6c2 100644 --- a/src/com/fsck/k9/activity/setup/AccountSettings.java +++ b/src/com/fsck/k9/activity/setup/AccountSettings.java @@ -429,7 +429,7 @@ public class AccountSettings extends K9PreferenceActivity boolean needsPushRestart = mAccount.setFolderPushMode(Account.FolderMode.valueOf(mPushMode.getValue())); boolean displayModeChanged = mAccount.setFolderDisplayMode(Account.FolderMode.valueOf(mDisplayMode.getValue())); - + if (mAccount.getFolderPushMode() != FolderMode.NONE) { needsPushRestart |= displayModeChanged; diff --git a/src/com/fsck/k9/controller/MessagingController.java b/src/com/fsck/k9/controller/MessagingController.java index 5f904db33..616f9c9f9 100644 --- a/src/com/fsck/k9/controller/MessagingController.java +++ b/src/com/fsck/k9/controller/MessagingController.java @@ -901,7 +901,7 @@ public class MessagingController implements Runnable String[] queryFields = {"html_content","subject","sender_list"}; LocalStore localStore = account.getLocalStore(); localStore.searchForMessages(retrievalListener, queryFields - , query, foldersToSearch, + , query, foldersToSearch, messagesToSearch == null ? null : messagesToSearch.toArray(new Message[0]), requiredFlags, forbiddenFlags); @@ -1542,7 +1542,7 @@ public class MessagingController implements Runnable l.synchronizeMailboxAddOrUpdateMessage(account, folder, localMessage); } - + } } @@ -4096,7 +4096,7 @@ public class MessagingController implements Runnable if (useManualWakeLock) { TracingPowerManager pm = TracingPowerManager.getPowerManager(context); - + twakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "K9 MessagingController.checkMail"); twakeLock.setReferenceCounted(false); twakeLock.acquire(K9.MANUAL_WAKE_LOCK_TIMEOUT); diff --git a/src/com/fsck/k9/helper/DomainNameChecker.java b/src/com/fsck/k9/helper/DomainNameChecker.java index 36346e68a..435e644b9 100644 --- a/src/com/fsck/k9/helper/DomainNameChecker.java +++ b/src/com/fsck/k9/helper/DomainNameChecker.java @@ -53,7 +53,7 @@ public class DomainNameChecker /** * Checks the site certificate against the domain name of the site being * visited - * + * * @param certificate * The certificate to check * @param thisDomain @@ -95,7 +95,7 @@ public class DomainNameChecker if (rval) { rval = domain.equals(InetAddress.getByName(domain) - .getHostAddress()); + .getHostAddress()); } } catch (UnknownHostException e) @@ -109,7 +109,7 @@ public class DomainNameChecker if (K9.DEBUG) { Log.v(K9.LOG_TAG, "DomainNameChecker.isIpAddress(): " - + errorMessage); + + errorMessage); } rval = false; @@ -122,7 +122,7 @@ public class DomainNameChecker /** * Checks the site certificate against the IP domain name of the site being * visited - * + * * @param certificate * The certificate to check * @param thisDomain @@ -144,15 +144,15 @@ public class DomainNameChecker Iterator i = subjectAltNames.iterator(); while (i.hasNext()) { - List altNameEntry = (List) (i.next()); + List altNameEntry = (List)(i.next()); if ((altNameEntry != null) && (2 <= altNameEntry.size())) { - Integer altNameType = (Integer) (altNameEntry.get(0)); + Integer altNameType = (Integer)(altNameEntry.get(0)); if (altNameType != null) { if (altNameType.intValue() == ALT_IPA_NAME) { - String altName = (String) (altNameEntry.get(1)); + String altName = (String)(altNameEntry.get(1)); if (altName != null) { if (K9.DEBUG) @@ -180,7 +180,7 @@ public class DomainNameChecker /** * Checks the site certificate against the DNS domain name of the site being * visited - * + * * @param certificate * The certificate to check * @param thisDomain @@ -198,16 +198,16 @@ public class DomainNameChecker Iterator i = subjectAltNames.iterator(); while (i.hasNext()) { - List altNameEntry = (List) (i.next()); + List altNameEntry = (List)(i.next()); if ((altNameEntry != null) && (2 <= altNameEntry.size())) { - Integer altNameType = (Integer) (altNameEntry.get(0)); + Integer altNameType = (Integer)(altNameEntry.get(0)); if (altNameType != null) { if (altNameType.intValue() == ALT_DNS_NAME) { hasDns = true; - String altName = (String) (altNameEntry.get(1)); + String altName = (String)(altNameEntry.get(1)); if (altName != null) { if (matchDns(thisDomain, altName)) @@ -237,7 +237,7 @@ public class DomainNameChecker } Log.v(K9.LOG_TAG, "DomainNameChecker.matchDns(): " - + errorMessage); + + errorMessage); } } @@ -250,7 +250,7 @@ public class DomainNameChecker { if (oid.elementAt(i).equals(X509Name.CN)) { - return matchDns(thisDomain, (String) (val.elementAt(i))); + return matchDns(thisDomain, (String)(val.elementAt(i))); } } } @@ -270,8 +270,8 @@ public class DomainNameChecker if (K9.DEBUG) { Log.v(K9.LOG_TAG, "DomainNameChecker.matchDns():" - + " this domain: " + thisDomain + " that domain: " - + thatDomain); + + " this domain: " + thisDomain + " that domain: " + + thatDomain); } if ((thisDomain == null) || (thisDomain.length() == 0) @@ -311,7 +311,7 @@ public class DomainNameChecker // (d) OR we have a *-component match: // f*.com matches foo.com but not bar.com rval = domainTokenMatch(thisDomainTokens[0], - thatDomainTokens[0]); + thatDomainTokens[0]); } } @@ -346,7 +346,7 @@ public class DomainNameChecker String suffix = thatDomainToken.substring(starIndex + 1); return thisDomainToken.startsWith(prefix) - && thisDomainToken.endsWith(suffix); + && thisDomainToken.endsWith(suffix); } } } diff --git a/src/com/fsck/k9/helper/Regex.java b/src/com/fsck/k9/helper/Regex.java index 799134b82..df3d41f0d 100644 --- a/src/com/fsck/k9/helper/Regex.java +++ b/src/com/fsck/k9/helper/Regex.java @@ -28,32 +28,32 @@ public class Regex * This pattern is auto-generated by //device/tools/make-iana-tld-pattern.py */ public static final Pattern TOP_LEVEL_DOMAIN_PATTERN - = Pattern.compile( - "((aero|arpa|asia|a[cdefgilmnoqrstuwxz])" - + "|(biz|b[abdefghijmnorstvwyz])" - + "|(cat|com|coop|c[acdfghiklmnoruvxyz])" - + "|d[ejkmoz]" - + "|(edu|e[cegrstu])" - + "|f[ijkmor]" - + "|(gov|g[abdefghilmnpqrstuwy])" - + "|h[kmnrtu]" - + "|(info|int|i[delmnoqrst])" - + "|(jobs|j[emop])" - + "|k[eghimnrwyz]" - + "|l[abcikrstuvy]" - + "|(mil|mobi|museum|m[acdghklmnopqrstuvwxyz])" - + "|(name|net|n[acefgilopruz])" - + "|(org|om)" - + "|(pro|p[aefghklmnrstwy])" - + "|qa" - + "|r[eouw]" - + "|s[abcdeghijklmnortuvyz]" - + "|(tel|travel|t[cdfghjklmnoprtvwz])" - + "|u[agkmsyz]" - + "|v[aceginu]" - + "|w[fs]" - + "|y[etu]" - + "|z[amw])"); + = Pattern.compile( + "((aero|arpa|asia|a[cdefgilmnoqrstuwxz])" + + "|(biz|b[abdefghijmnorstvwyz])" + + "|(cat|com|coop|c[acdfghiklmnoruvxyz])" + + "|d[ejkmoz]" + + "|(edu|e[cegrstu])" + + "|f[ijkmor]" + + "|(gov|g[abdefghilmnpqrstuwy])" + + "|h[kmnrtu]" + + "|(info|int|i[delmnoqrst])" + + "|(jobs|j[emop])" + + "|k[eghimnrwyz]" + + "|l[abcikrstuvy]" + + "|(mil|mobi|museum|m[acdghklmnopqrstuvwxyz])" + + "|(name|net|n[acefgilopruz])" + + "|(org|om)" + + "|(pro|p[aefghklmnrstwy])" + + "|qa" + + "|r[eouw]" + + "|s[abcdeghijklmnortuvyz]" + + "|(tel|travel|t[cdfghjklmnoprtvwz])" + + "|u[agkmsyz]" + + "|v[aceginu]" + + "|w[fs]" + + "|y[etu]" + + "|z[amw])"); /** * Regular expression pattern to match RFC 1738 URLs @@ -62,72 +62,72 @@ public class Regex * This pattern is auto-generated by //device/tools/make-iana-tld-pattern.py */ public static final Pattern WEB_URL_PATTERN - = Pattern.compile( - "((?:(http|https|Http|Https):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)" - + "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_" - + "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?" - + "((?:(?:[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}\\.)+" // named host - + "(?:" // plus top level domain - + "(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])" - + "|(?:biz|b[abdefghijmnorstvwyz])" - + "|(?:cat|com|coop|c[acdfghiklmnoruvxyz])" - + "|d[ejkmoz]" - + "|(?:edu|e[cegrstu])" - + "|f[ijkmor]" - + "|(?:gov|g[abdefghilmnpqrstuwy])" - + "|h[kmnrtu]" - + "|(?:info|int|i[delmnoqrst])" - + "|(?:jobs|j[emop])" - + "|k[eghimnrwyz]" - + "|l[abcikrstuvy]" - + "|(?:mil|mobi|museum|m[acdghklmnopqrstuvwxyz])" - + "|(?:name|net|n[acefgilopruz])" - + "|(?:org|om)" - + "|(?:pro|p[aefghklmnrstwy])" - + "|qa" - + "|r[eouw]" - + "|s[abcdeghijklmnortuvyz]" - + "|(?:tel|travel|t[cdfghjklmnoprtvwz])" - + "|u[agkmsyz]" - + "|v[aceginu]" - + "|w[fs]" - + "|y[etu]" - + "|z[amw]))" - + "|(?:(?:25[0-5]|2[0-4]" // or ip address - + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]" - + "|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1]" - + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}" - + "|[1-9][0-9]|[0-9])))" - + "(?:\\:\\d{1,5})?)" // plus option port number - + "(\\/(?:(?:[a-zA-Z0-9\\;\\/\\?\\:\\@\\&\\=\\#\\~" // plus option query params - + "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?" - + "(?:\\b|$)"); // and finally, a word boundary or end of - // input. This is to stop foo.sure from - // matching as foo.su + = Pattern.compile( + "((?:(http|https|Http|Https):\\/\\/(?:(?:[a-zA-Z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)" + + "\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,64}(?:\\:(?:[a-zA-Z0-9\\$\\-\\_" + + "\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-fA-F0-9]{2})){1,25})?\\@)?)?" + + "((?:(?:[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}\\.)+" // named host + + "(?:" // plus top level domain + + "(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])" + + "|(?:biz|b[abdefghijmnorstvwyz])" + + "|(?:cat|com|coop|c[acdfghiklmnoruvxyz])" + + "|d[ejkmoz]" + + "|(?:edu|e[cegrstu])" + + "|f[ijkmor]" + + "|(?:gov|g[abdefghilmnpqrstuwy])" + + "|h[kmnrtu]" + + "|(?:info|int|i[delmnoqrst])" + + "|(?:jobs|j[emop])" + + "|k[eghimnrwyz]" + + "|l[abcikrstuvy]" + + "|(?:mil|mobi|museum|m[acdghklmnopqrstuvwxyz])" + + "|(?:name|net|n[acefgilopruz])" + + "|(?:org|om)" + + "|(?:pro|p[aefghklmnrstwy])" + + "|qa" + + "|r[eouw]" + + "|s[abcdeghijklmnortuvyz]" + + "|(?:tel|travel|t[cdfghjklmnoprtvwz])" + + "|u[agkmsyz]" + + "|v[aceginu]" + + "|w[fs]" + + "|y[etu]" + + "|z[amw]))" + + "|(?:(?:25[0-5]|2[0-4]" // or ip address + + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(?:25[0-5]|2[0-4][0-9]" + + "|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1]" + + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}" + + "|[1-9][0-9]|[0-9])))" + + "(?:\\:\\d{1,5})?)" // plus option port number + + "(\\/(?:(?:[a-zA-Z0-9\\;\\/\\?\\:\\@\\&\\=\\#\\~" // plus option query params + + "\\-\\.\\+\\!\\*\\'\\(\\)\\,\\_])|(?:\\%[a-fA-F0-9]{2}))*)?" + + "(?:\\b|$)"); // and finally, a word boundary or end of + // input. This is to stop foo.sure from + // matching as foo.su public static final Pattern IP_ADDRESS_PATTERN - = Pattern.compile( - "((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]" - + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]" - + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}" - + "|[1-9][0-9]|[0-9]))"); + = Pattern.compile( + "((25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.(25[0-5]|2[0-4]" + + "[0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]" + + "[0-9]{2}|[1-9][0-9]|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}" + + "|[1-9][0-9]|[0-9]))"); public static final Pattern DOMAIN_NAME_PATTERN - = Pattern.compile( - "(((([a-zA-Z0-9][a-zA-Z0-9\\-]*)*[a-zA-Z0-9]\\.)+" - + TOP_LEVEL_DOMAIN_PATTERN + ")|" - + IP_ADDRESS_PATTERN + ")"); + = Pattern.compile( + "(((([a-zA-Z0-9][a-zA-Z0-9\\-]*)*[a-zA-Z0-9]\\.)+" + + TOP_LEVEL_DOMAIN_PATTERN + ")|" + + IP_ADDRESS_PATTERN + ")"); public static final Pattern EMAIL_ADDRESS_PATTERN - = Pattern.compile( - "[a-zA-Z0-9\\+\\.\\_\\%\\-]{1,256}" + - "\\@" + - "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + - "(" + - "\\." + - "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + - ")+" - ); + = Pattern.compile( + "[a-zA-Z0-9\\+\\.\\_\\%\\-]{1,256}" + + "\\@" + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" + + "(" + + "\\." + + "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" + + ")+" + ); /** * This pattern is intended for searching for things that look like they @@ -144,10 +144,10 @@ public class Regex * */ public static final Pattern PHONE_PATTERN - = Pattern.compile( // sdd = space, dot, or dash - "(\\+[0-9]+[\\- \\.]*)?" // +* - + "(\\([0-9]+\\)[\\- \\.]*)?" // ()* - + "([0-9][0-9\\- \\.][0-9\\- \\.]+[0-9])"); // + + = Pattern.compile( // sdd = space, dot, or dash + "(\\+[0-9]+[\\- \\.]*)?" // +* + + "(\\([0-9]+\\)[\\- \\.]*)?" // ()* + + "([0-9][0-9\\- \\.][0-9\\- \\.]+[0-9])"); // + /** * Convenience method to take all of the non-null matching groups in a diff --git a/src/com/fsck/k9/helper/power/TracingPowerManager.java b/src/com/fsck/k9/helper/power/TracingPowerManager.java index b706a28f9..ce5d0b724 100644 --- a/src/com/fsck/k9/helper/power/TracingPowerManager.java +++ b/src/com/fsck/k9/helper/power/TracingPowerManager.java @@ -17,7 +17,7 @@ public class TracingPowerManager PowerManager pm = null; private static TracingPowerManager tracingPowerManager; private Timer timer = null; - + public static synchronized TracingPowerManager getPowerManager(Context context) { if (tracingPowerManager == null) @@ -30,17 +30,17 @@ public class TracingPowerManager } return tracingPowerManager; } - - + + private TracingPowerManager(Context context) { - pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); - if (TRACE) - { - timer = new Timer(); - } + pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + if (TRACE) + { + timer = new Timer(); + } } - + public TracingWakeLock newWakeLock(int flags, String tag) { return new TracingWakeLock(flags, tag); @@ -65,14 +65,14 @@ public class TracingPowerManager } public void acquire(long timeout) { - synchronized(wakeLock) + synchronized (wakeLock) { wakeLock.acquire(timeout); } if (K9.DEBUG) { - Log.v(K9.LOG_TAG, "Acquired TracingWakeLock for tag " + tag + " and id " + id - + " for " + timeout + " ms"); + Log.v(K9.LOG_TAG, "Acquired TracingWakeLock for tag " + tag + " and id " + id + + " for " + timeout + " ms"); } raiseNotification(); if (startTime == null) @@ -83,15 +83,15 @@ public class TracingPowerManager } public void acquire() { - synchronized(wakeLock) + synchronized (wakeLock) { wakeLock.acquire(); } raiseNotification(); if (K9.DEBUG) { - Log.w(K9.LOG_TAG, "Acquired TracingWakeLock for tag " + tag + " and id " + id - + " with no timeout. K-9 Mail should not do this"); + Log.w(K9.LOG_TAG, "Acquired TracingWakeLock for tag " + tag + " and id " + id + + " with no timeout. K-9 Mail should not do this"); } if (startTime == null) { @@ -101,7 +101,7 @@ public class TracingPowerManager } public void setReferenceCounted(boolean counted) { - synchronized(wakeLock) + synchronized (wakeLock) { wakeLock.setReferenceCounted(counted); } @@ -113,8 +113,8 @@ public class TracingPowerManager Long endTime = System.currentTimeMillis(); if (K9.DEBUG) { - Log.v(K9.LOG_TAG, "Releasing TracingWakeLock for tag " + tag + " and id " + id + " after " - + (endTime - startTime) + " ms, timeout = " + timeout + " ms"); + Log.v(K9.LOG_TAG, "Releasing TracingWakeLock for tag " + tag + " and id " + id + " after " + + (endTime - startTime) + " ms, timeout = " + timeout + " ms"); } } else @@ -125,7 +125,7 @@ public class TracingPowerManager } } cancelNotification(); - synchronized(wakeLock) + synchronized (wakeLock) { wakeLock.release(); } @@ -135,7 +135,7 @@ public class TracingPowerManager { if (timer != null) { - synchronized(timer) + synchronized (timer) { if (timerTask != null) { @@ -148,7 +148,7 @@ public class TracingPowerManager { if (timer != null) { - synchronized(timer) + synchronized (timer) { if (timerTask != null) { @@ -163,21 +163,21 @@ public class TracingPowerManager if (startTime != null) { Long endTime = System.currentTimeMillis(); - Log.i(K9.LOG_TAG, "TracingWakeLock for tag " + tag + " and id " + id + " has been active for " - + (endTime - startTime) + " ms, timeout = " + timeout + " ms"); - + Log.i(K9.LOG_TAG, "TracingWakeLock for tag " + tag + " and id " + id + " has been active for " + + (endTime - startTime) + " ms, timeout = " + timeout + " ms"); + } else { Log.i(K9.LOG_TAG, "TracingWakeLock for tag " + tag + " and id " + id + " still active, timeout = " + timeout + " ms"); } } - + }; timer.schedule(timerTask, 1000, 1000); } } } - + } } diff --git a/src/com/fsck/k9/mail/Folder.java b/src/com/fsck/k9/mail/Folder.java index c707cd8f4..fc7a57ce5 100644 --- a/src/com/fsck/k9/mail/Folder.java +++ b/src/com/fsck/k9/mail/Folder.java @@ -134,7 +134,7 @@ public abstract class Folder MessageRetrievalListener listener) throws MessagingException; public void fetchPart(Message message, Part part, - MessageRetrievalListener listener) throws MessagingException + MessageRetrievalListener listener) throws MessagingException { throw new RuntimeException("fetchPart() not implemented."); } diff --git a/src/com/fsck/k9/mail/internet/MimeMessage.java b/src/com/fsck/k9/mail/internet/MimeMessage.java index 70c79c9a1..f2e0858ea 100644 --- a/src/com/fsck/k9/mail/internet/MimeMessage.java +++ b/src/com/fsck/k9/mail/internet/MimeMessage.java @@ -384,20 +384,20 @@ public class MimeMessage extends Message * But at least one implementations seems to have problems with 998 * characters, so we adjust for that fact. */ - final int limit = 1000 - 2 /* CRLF */ - 12 /* "References: " */ - 1 /* Off-by-one bugs */; + final int limit = 1000 - 2 /* CRLF */ - 12 /* "References: " */ - 1 /* Off-by-one bugs */; final int originalLength = references.length(); if (originalLength >= limit) { - // Find start of first reference - final int start = references.indexOf('<'); + // Find start of first reference + final int start = references.indexOf('<'); - // First reference + SPACE + // First reference + SPACE final String firstReference = references.substring(start, - references.indexOf('<', start + 1)); + references.indexOf('<', start + 1)); // Find longest tail final String tail = references.substring(references.indexOf('<', - firstReference.length() + originalLength - limit)); + firstReference.length() + originalLength - limit)); references = firstReference + tail; } diff --git a/src/com/fsck/k9/mail/store/ImapResponseParser.java b/src/com/fsck/k9/mail/store/ImapResponseParser.java index 45e8949c3..5d9564948 100644 --- a/src/com/fsck/k9/mail/store/ImapResponseParser.java +++ b/src/com/fsck/k9/mail/store/ImapResponseParser.java @@ -32,7 +32,7 @@ public class ImapResponseParser { return readResponse(null); } - + /** * Reads the next response available on the stream and returns an * ImapResponse object that represents it. @@ -47,7 +47,7 @@ public class ImapResponseParser ImapResponse response = new ImapResponse(); mResponse = response; mResponse.mCallback = callback; - + int ch = mIn.peek(); if (ch == '*') { @@ -69,12 +69,12 @@ public class ImapResponseParser { Log.v(K9.LOG_TAG, "<<< " + response.toString()); } - + if (mException != null) { throw new RuntimeException("readResponse(): Exception in callback method", mException); } - + return response; } finally @@ -315,7 +315,7 @@ public class ImapResponseParser if (mResponse.mCallback != null) { FixedLengthInputStream fixed = new FixedLengthInputStream(mIn, size); - + Object result = null; try { @@ -340,7 +340,7 @@ public class ImapResponseParser // If so, skip the rest fixed.skip(fixed.available()); } - + if (result != null) { return result; @@ -358,7 +358,7 @@ public class ImapResponseParser } read += count; } - + return new String(data, "US-ASCII"); } @@ -651,7 +651,7 @@ public class ImapResponseParser return o1 == o2; } } - + public interface IImapResponseCallback { /** @@ -672,6 +672,6 @@ public class ImapResponseParser * complete IMAP response has been parsed. */ public Object foundLiteral(ImapResponse response, FixedLengthInputStream literal) - throws IOException, Exception; + throws IOException, Exception; } } diff --git a/src/com/fsck/k9/mail/store/ImapStore.java b/src/com/fsck/k9/mail/store/ImapStore.java index 6feb25c2e..687ef53d6 100644 --- a/src/com/fsck/k9/mail/store/ImapStore.java +++ b/src/com/fsck/k9/mail/store/ImapStore.java @@ -481,7 +481,7 @@ public class ImapStore extends Store } try { - + connection.open(); } catch (IOException ioe) @@ -1170,7 +1170,7 @@ public class ImapStore extends Store ), false); ImapResponse response; int messageNumber = 0; - + ImapResponseParser.IImapResponseCallback callback = null; if (fp.contains(FetchProfile.Item.BODY) || fp.contains(FetchProfile.Item.BODY_SANE) || fp.contains(FetchProfile.Item.ENVELOPE)) { @@ -1230,7 +1230,7 @@ public class ImapStore extends Store } else if (literal instanceof Integer) { - // All the work was done in FetchBodyCallback.foundLiteral() + // All the work was done in FetchBodyCallback.foundLiteral() } else { @@ -1260,10 +1260,10 @@ public class ImapStore extends Store } } - + @Override public void fetchPart(Message message, Part part, MessageRetrievalListener listener) - throws MessagingException + throws MessagingException { checkOpen(); @@ -1272,7 +1272,7 @@ public class ImapStore extends Store { return; } - + String fetch; String partId = parts[0]; if ("TEXT".equalsIgnoreCase(partId)) @@ -1287,12 +1287,12 @@ public class ImapStore extends Store try { mConnection.sendCommand( - String.format("UID FETCH %s (UID %s)", message.getUid(), fetch), - false); + String.format("UID FETCH %s (UID %s)", message.getUid(), fetch), + false); ImapResponse response; int messageNumber = 0; - + ImapResponseParser.IImapResponseCallback callback = new FetchPartCallback(part); do @@ -1321,7 +1321,7 @@ public class ImapStore extends Store ImapMessage imapMessage = (ImapMessage) message; Object literal = handleFetchResponse(imapMessage, fetchList); - + if (literal != null) { if (literal instanceof Body) @@ -1333,9 +1333,9 @@ public class ImapStore extends Store { String bodyString = (String)literal; InputStream bodyStream = new ByteArrayInputStream(bodyString.getBytes()); - + String contentTransferEncoding = part.getHeader( - MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0]; + MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0]; part.setBody(MimeUtility.decodeBody(bodyStream, contentTransferEncoding)); } else @@ -2335,7 +2335,7 @@ public class ImapStore extends Store } } - + } catch (SSLException e) { @@ -2519,7 +2519,7 @@ public class ImapStore extends Store { return readResponse(null); } - + private ImapResponse readResponse(ImapResponseParser.IImapResponseCallback callback) throws IOException, MessagingException { try @@ -2772,7 +2772,7 @@ public class ImapStore extends Store TracingPowerManager pm = TracingPowerManager.getPowerManager(receiver.getContext()); wakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ImapFolderPusher " + store.getAccount().getDescription() + ":" + getName()); wakeLock.setReferenceCounted(false); - + } public void refresh() throws IOException, MessagingException { @@ -2912,9 +2912,9 @@ public class ImapStore extends Store storedUntaggedResponses.clear(); processUntaggedResponses(untaggedResponses); } - + if (K9.DEBUG) - Log.i(K9.LOG_TAG, "About to IDLE for " + getLogId()); + Log.i(K9.LOG_TAG, "About to IDLE for " + getLogId()); receiver.setPushActive(getName(), true); idling.set(true); @@ -2923,7 +2923,7 @@ public class ImapStore extends Store untaggedResponses = executeSimpleCommand(COMMAND_IDLE, false, ImapFolderPusher.this); idling.set(false); - + delayTime.set(NORMAL_DELAY_TIME); idleFailureCount.set(0); } @@ -3510,12 +3510,12 @@ public class ImapStore extends Store FetchBodyCallback(HashMap mesageMap) { - mMessageMap = mesageMap; + mMessageMap = mesageMap; } @Override public Object foundLiteral(ImapResponse response, - FixedLengthInputStream literal) throws IOException, Exception + FixedLengthInputStream literal) throws IOException, Exception { if (response.mTag == null && ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH")) @@ -3544,7 +3544,7 @@ public class ImapStore extends Store @Override public Object foundLiteral(ImapResponse response, - FixedLengthInputStream literal) throws IOException, Exception + FixedLengthInputStream literal) throws IOException, Exception { if (response.mTag == null && ImapResponseParser.equalsIgnoreCase(response.get(1), "FETCH")) @@ -3552,7 +3552,7 @@ public class ImapStore extends Store //TODO: check for correct UID String contentTransferEncoding = mPart.getHeader( - MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0]; + MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING)[0]; return MimeUtility.decodeBody(literal, contentTransferEncoding); } diff --git a/src/com/fsck/k9/mail/store/LocalStore.java b/src/com/fsck/k9/mail/store/LocalStore.java index 7c4cd8e93..a5ef70527 100644 --- a/src/com/fsck/k9/mail/store/LocalStore.java +++ b/src/com/fsck/k9/mail/store/LocalStore.java @@ -655,8 +655,9 @@ public class LocalStore extends Store implements Serializable boolean anyAdded = false; String likeString = "%"+queryString+"%"; whereClause.append(" AND ("); - for (String queryField : queryFields) { - + for (String queryField : queryFields) + { + if (anyAdded == true) { whereClause.append(" OR "); @@ -1455,7 +1456,7 @@ public class LocalStore extends Store implements Serializable /** * Populate the header fields of the given list of messages by reading * the saved header data from the database. - * + * * @param messages * The messages whose headers should be loaded. */ @@ -1922,7 +1923,7 @@ public class LocalStore extends Store implements Serializable } if (!gotAdditionalHeaders) - { + { // Remember that all headers for this message have been saved, so it is // not necessary to download them again in case the user wants to see all headers. List appendedFlags = new ArrayList(); @@ -1930,7 +1931,7 @@ public class LocalStore extends Store implements Serializable appendedFlags.add(Flag.X_GOT_ALL_HEADERS); mDb.execSQL("UPDATE messages " + "SET flags = ? " + " WHERE id = ?", new Object[] - { Utility.combine(appendedFlags.toArray(), ',').toUpperCase(), id } ); + { Utility.combine(appendedFlags.toArray(), ',').toUpperCase(), id }); } } @@ -2778,7 +2779,8 @@ public class LocalStore extends Store implements Serializable } @Override - public Set getHeaderNames() { + public Set getHeaderNames() + { if (!mHeadersLoaded) loadHeaders(); return super.getHeaderNames(); diff --git a/src/com/fsck/k9/service/BootReceiver.java b/src/com/fsck/k9/service/BootReceiver.java index 13f3e35dc..9f4d42a6b 100644 --- a/src/com/fsck/k9/service/BootReceiver.java +++ b/src/com/fsck/k9/service/BootReceiver.java @@ -23,7 +23,7 @@ public class BootReceiver extends CoreReceiver public static String ALARMED_INTENT = "com.fsck.k9.service.BroadcastReceiver.pendingIntent"; public static String AT_TIME = "com.fsck.k9.service.BroadcastReceiver.atTime"; - + @Override public Integer receive(Context context, Intent intent, Integer tmpWakeLockId) { diff --git a/src/com/fsck/k9/service/MailService.java b/src/com/fsck/k9/service/MailService.java index e4828c26f..23e053be4 100644 --- a/src/com/fsck/k9/service/MailService.java +++ b/src/com/fsck/k9/service/MailService.java @@ -132,9 +132,9 @@ public class MailService extends CoreService Log.i(K9.LOG_TAG, "AutoSync help is available, autoSync = " + autoSync); } - + K9.BACKGROUND_OPS bOps = K9.getBackgroundOps(); - + switch (bOps) { case NEVER: @@ -149,8 +149,8 @@ public class MailService extends CoreService case WHEN_CHECKED_AUTO_SYNC: doBackground = backgroundData & autoSync; break; - } - + } + } if (K9.DEBUG) @@ -460,7 +460,7 @@ public class MailService extends CoreService if (K9.DEBUG) { Log.d(K9.LOG_TAG, "PUSHREFRESH: refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval - + ", nowTime = " + nowTime + ", sinceLast = " + sinceLast); + + ", nowTime = " + nowTime + ", sinceLast = " + sinceLast); } pusher.refresh(); pusher.setLastRefresh(nowTime); @@ -470,7 +470,7 @@ public class MailService extends CoreService if (K9.DEBUG) { Log.d(K9.LOG_TAG, "PUSHREFRESH: NOT refreshing lastRefresh = " + lastRefresh + ", interval = " + refreshInterval - + ", nowTime = " + nowTime + ", sinceLast = " + sinceLast); + + ", nowTime = " + nowTime + ", sinceLast = " + sinceLast); } } } diff --git a/src/com/fsck/k9/service/SleepService.java b/src/com/fsck/k9/service/SleepService.java index 0595bdf57..3722a33d9 100644 --- a/src/com/fsck/k9/service/SleepService.java +++ b/src/com/fsck/k9/service/SleepService.java @@ -82,10 +82,10 @@ public class SleepService extends CoreService { reacquireWakeLock(releaseDatum); } - + long endTime = System.currentTimeMillis(); long actualSleep = endTime - startTime; - + if (actualSleep < sleepTime) { Log.w(K9.LOG_TAG, "SleepService sleep time too short: requested was " + sleepTime + ", actual was " + actualSleep); @@ -93,7 +93,7 @@ public class SleepService extends CoreService else { if (K9.DEBUG) - Log.d(K9.LOG_TAG, "SleepService requested sleep time was " + sleepTime + ", actual was " + actualSleep); + Log.d(K9.LOG_TAG, "SleepService requested sleep time was " + sleepTime + ", actual was " + actualSleep); } }