Merge pull request #2455 from philipwhiuk/issue-2271

Fixes to various lint-detected issues
This commit is contained in:
Philip 2017-03-28 02:16:15 +01:00 committed by GitHub
commit 879aa72bb6
2 changed files with 13 additions and 9 deletions

View file

@ -57,7 +57,7 @@ public class BinaryTempFileBody implements RawDataBody, SizeAware {
File newFile = File.createTempFile("body", null, mTempDirectory);
final OutputStream out = new FileOutputStream(newFile);
try {
OutputStream wrappedOut = null;
OutputStream wrappedOut;
if (MimeUtil.ENC_QUOTED_PRINTABLE.equals(encoding)) {
wrappedOut = new QuotedPrintableOutputStream(out, false);
} else if (MimeUtil.ENC_BASE64.equals(encoding)) {
@ -134,8 +134,11 @@ public class BinaryTempFileBody implements RawDataBody, SizeAware {
try {
super.close();
} finally {
Timber.d("Deleting temporary binary file");
mFile.delete();
Timber.d("Deleting temporary binary file: %s", mFile.getName());
boolean fileSuccessfullyDeleted = mFile.delete();
if (!fileSuccessfullyDeleted) {
Timber.i("Failed to delete temporary binary file: %s", mFile.getName());
}
}
}

View file

@ -4,6 +4,8 @@ package com.fsck.k9;
import java.io.File;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -23,7 +25,6 @@ import android.os.Environment;
import android.os.Handler;
import android.os.Looper;
import android.os.StrictMode;
import android.text.format.Time;
import com.fsck.k9.Account.SortType;
import com.fsck.k9.activity.MessageCompose;
@ -979,14 +980,14 @@ public class K9 extends Application {
return false;
}
Time time = new Time();
time.setToNow();
GregorianCalendar gregorianCalendar = new GregorianCalendar();
Integer startHour = Integer.parseInt(mQuietTimeStarts.split(":")[0]);
Integer startMinute = Integer.parseInt(mQuietTimeStarts.split(":")[1]);
Integer endHour = Integer.parseInt(mQuietTimeEnds.split(":")[0]);
Integer endMinute = Integer.parseInt(mQuietTimeEnds.split(":")[1]);
Integer now = (time.hour * 60) + time.minute;
Integer now = (gregorianCalendar.get(Calendar.HOUR) * 60) + gregorianCalendar.get(Calendar.MINUTE);
Integer quietStarts = startHour * 60 + startMinute;
Integer quietEnds = endHour * 60 + endMinute;
@ -1422,7 +1423,7 @@ public class K9 extends Application {
if (save) {
Editor editor = sDatabaseVersionCache.edit();
editor.putInt(KEY_LAST_ACCOUNT_DATABASE_VERSION, LocalStore.DB_VERSION);
editor.commit();
editor.apply();
}
}